2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2017 IPFire Network Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 IPSEC_CONNECTION_CONFIG_SETTINGS
="AUTH_MODE DPD_ACTION DPD_DELAY DPD_TIMEOUT"
23 IPSEC_CONNECTION_CONFIG_SETTINGS
="INACTIVITY_TIMEOUT LOCAL_ADDRESS LOCAL_ID LOCAL_PREFIX"
24 IPSEC_CONNECTION_CONFIG_SETTINGS
="${IPSEC_CONNECTION_CONFIG_SETTINGS} MODE PEER PSK"
25 IPSEC_CONNECTION_CONFIG_SETTINGS
="${IPSEC_CONNECTION_CONFIG_SETTINGS} REMOTE_ID REMOTE_PREFIX"
26 IPSEC_CONNECTION_CONFIG_SETTINGS
="${IPSEC_CONNECTION_CONFIG_SETTINGS} SECURITY_POLICY"
29 IPSEC_DEFAULT_AUTH_MODE
="PSK"
30 IPSEC_DEFAULT_DPD_ACTION
="restart"
31 IPSEC_DEFAULT_DPD_DELAY
="30"
32 IPSEC_DEFAULT_DPD_TIMEOUT
="120"
33 IPSEC_DEFAULT_INACTIVITY_TIMEOUT
="0"
34 IPSEC_DEFAULT_MODE
="tunnel"
35 IPSEC_DEFAULT_SECURITY_POLICY
="system"
36 IPSEC_DEFAULT_START_ACTION
="on-demand"
38 IPSEC_VALID_MODES
="gre-transport tunnel vti"
39 IPSEC_VALID_AUTH_MODES
="PSK"
47 cli_ipsec_connection $@
50 error
"Unrecognized argument: ${action}"
56 cli_ipsec_connection
() {
57 if ipsec_connection_exists
${1}; then
64 authentication|dpd|inactivity_timeout|
local|mode|peer|remote|security_policy|start_action
)
65 ipsec_connection_
${key} ${connection} $@
68 cli_ipsec_connection_show
"${connection}"
72 error
"Unrecognized argument: ${key}"
82 ipsec_connection_new $@
85 ipsec_connection_destroy $@
88 if [ -n "${action}" ]; then
89 error
"Unrecognized argument: '${action}'"
97 cli_ipsec_connection_show
() {
98 local connection
="${1}"
100 # Read the config settings
101 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
102 if ! ipsec_connection_read_config
"${connection}"; then
103 error
"Could not read the connection configuration"
107 cli_headline
0 "IPsec VPN Connection: ${connection}"
112 cli_print_fmt1
1 "Peer" "${PEER}"
116 cli_print_fmt1
1 "Security Policy" "${SECURITY_POLICY-${IPSEC_DEFAULT_SECURITY_POLICY}}"
119 cli_headline
2 "Authentication"
120 case "${AUTH_MODE^^}" in
122 cli_print_fmt1
2 "Mode" "Pre-Shared-Key"
125 cli_print_fmt1
2 "Pre-Shared-Key" "****"
127 cli_print_fmt1
2 "Pre-Shared-Key" "- is not set -"
137 for i
in LOCAL REMOTE
; do
140 cli_headline
2 "Local"
143 cli_headline
2 "Remote"
147 local id_var
="${i}_ID"
148 if [ -n "${!id_var}" ]; then
149 cli_print_fmt1
2 "ID" "${!id_var}"
152 local prefix_var
="${i}_PREFIX"
153 if isset
${prefix_var}; then
154 cli_headline
3 "Prefix(es)"
157 for prefix
in ${!prefix_var}; do
158 cli_print_fmt1
3 "${prefix}"
165 cli_headline
2 "Misc."
169 cli_print_fmt1
2 "Transport Mode" "GRE Transport"
172 cli_print_fmt1
2 "Transport Mode" "Tunnel"
175 cli_print_fmt1
2 "Transport Mode" "Virtual Tunnel Interface"
178 cli_print_fmt1
2 "Transport Mode" "- Unknown -"
183 if isset INACTIVITY_TIMEOUT
&& [ ${INACTIVITY_TIMEOUT} -gt 0 ]; then
184 cli_print_fmt1
2 "Inactivity Timeout" "$(format_time ${INACTIVITY_TIMEOUT})"
191 # This function writes all values to a via ${connection} specificated VPN IPsec configuration file
192 ipsec_connection_write_config
() {
195 local connection
="${1}"
197 if ! ipsec_connection_exists
"${connection}"; then
198 log ERROR
"No such VPN IPsec connection: ${connection}"
202 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
204 if ! settings_write
"${path}" ${IPSEC_CONNECTION_CONFIG_SETTINGS}; then
205 log ERROR
"Could not write configuration settings for VPN IPsec connection ${connection}"
209 ipsec_reload
${connection}
212 # This funtion writes the value for one key to a via ${connection} specificated VPN IPsec connection configuration file
213 ipsec_connection_write_config_key
() {
216 local connection
=${1}
222 if ! ipsec_connection_exists
"${connection}"; then
223 log ERROR
"No such VPN ipsec connection: ${connection}"
227 log DEBUG
"Set '${key}' to new value '${value}' in VPN ipsec connection '${connection}'"
229 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
231 # Read the config settings
232 if ! ipsec_connection_read_config
"${connection}"; then
236 # Set the key to a new value
237 assign
"${key}" "${value}"
239 if ! ipsec_connection_write_config
"${connection}"; then
246 # Reads one or more keys out of a settings file or all if no key is provided.
247 ipsec_connection_read_config
() {
250 local connection
="${1}"
253 if ! ipsec_connection_exists
"${connection}"; then
254 log ERROR
"No such VPN IPsec connection : ${connection}"
260 if [ $# -eq 0 ] && [ -n "${IPSEC_CONNECTION_CONFIG_SETTINGS}" ]; then
261 list_append args
${IPSEC_CONNECTION_CONFIG_SETTINGS}
266 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
268 if ! settings_read
"${path}" ${args}; then
269 log ERROR
"Could not read settings for VPN IPsec connection ${connection}"
274 # This function checks if a vpn ipsec connection exists
275 # Returns True when yes and false when not
276 ipsec_connection_exists
() {
279 local connection
=${1}
281 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}"
283 [ -d "${path}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
286 # Reloads the connection after config changes
291 # Handle the cli after authentification
292 ipsec_connection_authentication() {
293 if [ ! $# -gt 1 ]; then
294 log ERROR "Not enough arguments
"
298 local connection=${1}
304 ipsec_connection_authentication_mode "${connection}" $@
307 ipsec_connection_authentication_psk "${connection}" $@
310 log ERROR "Unrecognized argument
: ${cmd}"
316 # Set the authentification mode
317 ipsec_connection_authentication_mode() {
318 if [ ! $# -eq 2 ]; then
319 log ERROR "Not enough arguments
"
322 local connection=${1}
325 if ! isoneof mode ${IPSEC_VALID_AUTH_MODES}; then
326 log ERROR "Auth mode
'${mode}' is invalid
"
330 if ! ipsec_connection_write_config_key "${connection}" "AUTH_MODE
" ${mode^^}; then
331 log ERROR "Could not
write configuration settings
"
337 ipsec_connection_authentication_psk() {
338 if [ ! $# -eq 2 ]; then
339 log ERROR "Not enough arguments
"
343 local connection=${1}
348 if [ ${length} -lt 4 ]; then
349 error "The PSK must be longer than four characters
"
353 if [ ${length} -gt 128 ]; then
354 error "The PSK cannot be longer than
128 characters
"
358 if ! ipsec_connection_write_config_key "${connection}" "PSK
" "${psk}"; then
359 log ERROR "Could not
write configuration settings
"
367 # Handle the cli after authentification
368 ipsec_connection_dpd() {
369 if [ ! $# -gt 1 ]; then
370 log ERROR "Not enough arguments
"
374 local connection=${1}
380 ipsec_connection_dpd_action "${connection}" $@
383 ipsec_connection_dpd_delay "${connection}" $@
386 ipsec_connection_dpd_timeout "${connection}" $@
389 log ERROR "Unrecognized argument
: ${cmd}"
395 # Set the default dpd action
396 ipsec_connection_dpd_action() {
397 if [ ! $# -eq 2 ]; then
398 log ERROR "Not enough arguments
"
401 local connection=${1}
404 if ! isoneof action "restart
" "clear"; then
405 log ERROR "dpd action
'${action}' is invalid
"
409 if ! ipsec_connection_write_config_key "${connection}" "DPD_ACTION
" ${action}; then
410 log ERROR "Could not
write configuration settings
"
416 ipsec_connection_dpd_delay() {
417 if [ ! $# -ge 2 ]; then
418 log ERROR "Not enough arguments
"
422 local connection=${1}
426 if ! isinteger value; then
427 value=$(parse_time $@)
428 if [ ! $? -eq 0 ]; then
429 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
434 if [ ${value} -lt 0 ]; then
435 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
439 if ! ipsec_connection_write_config_key "${connection}" "DPD_DELAY
" ${value}; then
440 log ERROR "Could not
write configuration settings
"
447 # Set the dpd timeout
448 ipsec_connection_dpd_timeout() {
449 if [ ! $# -ge 2 ]; then
450 log ERROR "Not enough arguments
"
454 local connection=${1}
458 if ! isinteger value; then
459 value=$(parse_time $@)
460 if [ ! $? -eq 0 ]; then
461 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
466 if [ ${value} -le 0 ]; then
467 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
471 if ! ipsec_connection_write_config_key "${connection}" "DPD_TIMEOUT
" ${value}; then
472 log ERROR "Could not
write configuration settings
"
479 # Handle the cli after local
480 ipsec_connection_local() {
481 if [ ! $# -ge 2 ]; then
482 log ERROR "Not enough arguments
"
486 local connection=${1}
492 ipsec_connection_local_address "${connection}" $@
495 ipsec_connection_id "${connection}" "LOCAL
" $@
498 ipsec_connection_prefix "${connection}" "LOCAL
" $@
501 log ERROR "Unrecognized argument
: ${cmd}"
509 # Set the connection mode
510 ipsec_connection_mode() {
511 if [ ! $# -eq 2 ]; then
512 log ERROR "Not enough arguments
"
515 local connection=${1}
518 if ! isoneof mode ${IPSEC_VALID_MODES}; then
519 log ERROR "Mode
'${mode}' is invalid
"
523 if ! ipsec_connection_write_config_key "${connection}" "MODE
" ${mode}; then
524 log ERROR "Could not
write configuration settings
"
531 # Set the local address
532 ipsec_connection_local_address() {
533 if [ ! $# -eq 2 ]; then
534 log ERROR "Not enough arguments
"
537 local connection=${1}
538 local local_address=${2}
540 if ! ipsec_connection_check_peer ${local_address}; then
541 log ERROR "Local address
'${local_address}' is invalid
"
545 if ! ipsec_connection_write_config_key "${connection}" "LOCAL_ADDRESS
" ${local_address}; then
546 log ERROR "Could not
write configuration settings
"
553 # Set the peer to connect to
554 ipsec_connection_peer() {
555 if [ ! $# -eq 2 ]; then
556 log ERROR "Not enough arguments
"
559 local connection=${1}
562 if ! ipsec_connection_check_peer ${peer}; then
563 log ERROR "Peer
'${peer}' is invalid
"
567 if ! ipsec_connection_write_config_key "${connection}" "PEER
" ${peer}; then
568 log ERROR "Could not
write configuration settings
"
575 #Set the local or remote id
576 ipsec_connection_id() {
577 if [ ! $# -eq 3 ]; then
578 log ERROR "Not enough arguments
"
581 local connection=${1}
585 if ! ipsec_connection_check_id ${id}; then
586 log ERROR "Id
'${id}' is invalid
"
590 if ! ipsec_connection_write_config_key "${connection}" "${type}_ID" ${id}; then
591 log ERROR
"Could not write configuration settings"
598 # Set the local or remote prefix
599 ipsec_connection_prefix
() {
600 if [ ! $# -ge 3 ]; then
601 log ERROR
"Not enough arguments"
604 local connection
=${1}
608 local _prefix
="${type}_PREFIX"
610 if ! ipsec_connection_read_config
"${connection}" "${_prefix}"; then
614 # Remove duplicated entries to proceed the list safely
615 assign
"${_prefix}" "$(list_unique ${!_prefix} )"
618 local prefixes_removed
621 while [ $# -gt 0 ]; do
626 list_append prefixes_added
"${arg:1}"
629 list_append prefixes_removed
"${arg:1}"
632 list_append prefixes_set
"${arg}"
635 error
"Invalid argument: ${arg}"
642 # Check if the user is trying a mixed operation
643 if ! list_is_empty prefixes_set
&& (! list_is_empty prefixes_added ||
! list_is_empty prefixes_removed
); then
644 error
"You cannot reset the prefix list and add or remove prefixes at the same time"
648 # Set new prefix list
649 if ! list_is_empty prefixes_set
; then
650 # Check if all prefixes are valid
652 for prefix
in ${prefixes_set}; do
653 if ! ip_net_is_valid
${prefix}; then
654 error
"Unsupported prefix: ${prefix}"
659 assign
"${_prefix}" "${prefixes_set}"
661 # Perform incremental updates
665 # Perform all removals
666 for prefix
in ${prefixes_removed}; do
667 if ! list_remove
"${_prefix}" ${prefix}; then
668 warning
"${prefix} was not on the list and could not be removed"
673 for prefix
in ${prefixes_added}; do
674 if ip_net_is_valid
${prefix}; then
675 if ! list_append_unique
"${_prefix}" ${prefix}; then
676 warning
"${prefix} is already on the prefix list"
679 warning
"${prefix} is not a valid IP network and could not be added"
684 # Check if the list contain at least one valid prefix
685 if list_is_empty
${_prefix}; then
686 error
"Cannot save an empty prefix list"
691 if ! ipsec_connection_write_config_key
"${connection}" "${_prefix}" ${!_prefix}; then
692 log ERROR "Could not
write configuration settings
"
698 # Handle the cli after remote
699 ipsec_connection_remote() {
700 if [ ! $# -ge 2 ]; then
701 log ERROR "Not enough arguments
"
705 local connection=${1}
711 ipsec_connection_id "${connection}" "REMOTE
" $@
715 ipsec_connection_prefix "${connection}" "REMOTE
" $@
718 log ERROR "Unrecognized argument
: ${cmd}"
726 # Set the inactivity timeout
727 ipsec_connection_inactivity_timeout() {
728 if [ ! $# -ge 2 ]; then
729 log ERROR "Not enough arguments
"
733 local connection=${1}
737 if ! isinteger value; then
738 value=$(parse_time $@)
739 if [ ! $? -eq 0 ]; then
740 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
745 if [ ${value} -le 0 ]; then
746 log ERROR "The passed
time value must be
in the
sum greater zero seconds.
"
750 if ! ipsec_connection_write_config_key "${connection}" "INACTIVITY_TIMEOUT
" ${value}; then
751 log ERROR "Could not
write configuration settings
"
758 # Set the default start action
759 ipsec_connection_start_action() {
760 if [ ! $# -eq 2 ]; then
761 log ERROR "Not enough arguments
"
764 local connection=${1}
767 if ! isoneof action "on-demand
" "always-on
"; then
768 log ERROR "Start action
'${action}' is invalid
"
772 if ! ipsec_connection_write_config_key "${connection}" "START_ACTION
" ${action}; then
773 log ERROR "Could not
write configuration settings
"
778 # Set the security policy to use
779 ipsec_connection_security_policy() {
780 if [ ! $# -eq 2 ]; then
781 log ERROR "Not enough arguments
"
784 local connection=${1}
785 local security_policy=${2}
787 if ! vpn_security_policy_exists ${security_policy}; then
788 log ERROR "No such vpn security policy
'${security_policy}'"
792 if ! ipsec_connection_write_config_key "${connection}" "SECURITY_POLICY
" ${security_policy}; then
793 log ERROR "Could not
write configuration settings
"
798 # Check if a id is valid
799 ipsec_connection_check_id() {
803 if [[ ${id} =~ ^@[[:alnum:]]+$ ]] || ip_is_valid ${id}; then
810 # Checks if a peer is valid
811 ipsec_connection_check_peer() {
815 # TODO Accept also FQDNs
816 if ip_is_valid ${peer}; then
823 # This function checks if a VPN IPsec connection name is valid
824 # Allowed are only A-Za-z0-9
825 ipsec_connection_check_name() {
828 local connection=${1}
830 [[ "${connection}" =~ [^[:alnum:]$] ]]
833 # Function that creates one VPN IPsec connection
834 ipsec_connection_new() {
835 if [ $# -gt 1 ]; then
836 error "Too many arguments
"
840 local connection="${1}"
841 if ! isset connection; then
842 error "Please provide a connection name
"
846 # Check for duplicates
847 if ipsec_connection_exists "${connection}"; then
848 error "The VPN IPsec connection
${connection} already exists
"
852 # Check if the name of the connection is valid
853 if ipsec_connection_check_name "${connection}"; then
854 error "'${connection}' contains illegal characters
"
858 log DEBUG "Creating VPN IPsec connection
${connection}"
860 if ! mkdir -p "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
861 log ERROR "Could not create config directory
for ${connection}"
865 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
867 AUTH_MODE=${IPSEC_DEFAULT_AUTH_MODE}
868 DPD_ACTION=${IPSEC_DEFAULT_DPD_ACTION}
869 DPD_DELAY=${IPSEC_DEFAULT_DPD_DELAY}
870 DPD_TIMEOUT=${IPSEC_DEFAULT_DPD_TIMEOUT}
871 MODE=${IPSEC_DEFAULT_MODE}
872 START_ACTION=${IPSEC_DEFAULT_START_ACTION}
874 INACTIVITY_TIMEOUT=${IPSEC_DEFAULT_INACTIVITY_TIMEOUT}
875 SECURITY_POLICY=${IPSEC_DEFAULT_SECURITY_POLICY}
877 if ! ipsec_connection_write_config "${connection}"; then
878 log ERROR "Could not
write new config
file"
883 # Function that deletes based on the passed parameters one ore more vpn security policies
884 ipsec_connection_destroy() {
886 for connection in $@; do
887 if ! ipsec_connection_exists "${connection}"; then
888 log ERROR "The VPN IPsec connection
${connection} does not exist.
"
892 log DEBUG "Deleting VPN IPsec connection
${connection}"
893 if ! rm -rf "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
894 log ERROR "Deleting the VPN IPsec connection
${connection} was not sucessful
"
900 # List all ipsec connections
901 ipsec_list_connections() {
903 for connection in ${NETWORK_IPSEC_CONNS_DIR}/*; do
904 [ -d ${connection} ] || continue
905 basename ${connection}
909 ipsec_connection_to_strongswan() {
910 local connection="${1}"
912 # Read the config settings
913 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
914 if ! ipsec_connection_read_config "${connection}"; then
915 error "Could not
read the connection
${connection}"
919 local path="${NETWORK_IPSEC_SWANCTL_CONNECTIONS_DIR}/${connection}.conf
"
922 # Write the connection section
923 _ipsec_connection_to_strongswan_connection "${connection}"
925 # Write the secrets section
926 _ipsec_connection_to_strongswan_secrets "${connection}"
931 _ipsec_connection_to_strongswan_connection() {
932 local connection="${1}"
934 # Read the security policy
935 local ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
936 if ! vpn_security_policies_read_config "${SECURITY_POLICY}"; then
940 print_indent 0 "connections
{"
941 print_indent 1 "${connection} {"
944 print_indent 2 "# IKE Version"
945 case "${KEY_EXCHANGE^^}" in
947 print_indent
2 "version = 1"
950 # Fall back to IKEv2 for any random values
952 print_indent
2 "version = 2"
958 print_indent
2 "# Local Address"
959 if isset LOCAL_ADDRESS
; then
960 print_indent
2 "local_addrs = ${LOCAL_ADDRESS}"
962 print_indent
2 "local_addrs = %any"
967 print_indent
2 "# Remote Address"
969 print_indent
2 "remote_addrs = ${PEER}"
971 print_indent
2 "remote_addrs = %any"
976 print_indent
2 "# IKE Proposals"
977 print_indent
2 "proposals = $(vpn_security_policies_make_ah_proposal ${SECURITY_POLICY})"
981 if isset DPD_DELAY
&& isinteger DPD_DELAY
&& [ ${DPD_DELAY} -gt 0 ]; then
982 print_indent
2 "# Dead Peer Detection"
984 print_indent
2 "dpd_action = ${DPD_ACTION}"
985 print_indent
2 "dpd_delay = ${DPD_DELAY}"
987 if isset DPD_TIMEOUT
; then
988 print_indent
2 "dpd_timeout = ${DPD_TIMEOUT}"
995 print_indent
2 "# Fragmentation"
996 print_indent
2 "fragmentation = yes"
1000 print_indent
2 "local {"
1003 if isset LOCAL_ID
; then
1004 print_indent
3 "id = ${LOCAL_ID}"
1008 case "${AUTH_MODE}" in
1010 print_indent
3 "auth = psk"
1018 print_indent
2 "remote {"
1021 if isset REMOTE_ID
; then
1022 print_indent
3 "id = ${REMOTE_ID}"
1026 case "${AUTH_MODE}" in
1028 print_indent
3 "auth = psk"
1037 print_indent
2 "children {"
1038 print_indent
3 "${connection} {"
1040 print_indent
4 "# ESP Proposals"
1041 print_indent
4 "esp_proposals = $(vpn_security_policies_make_esp_proposal ${SECURITY_POLICY})"
1047 if isset LOCAL_PREFIX
; then
1048 print_indent
4 "local_ts = $(list_join LOCAL_PREFIX ,)"
1050 print_indent
4 "local_ts = dynamic"
1054 if isset REMOTE_PREFIX
; then
1055 print_indent
4 "remote_ts = $(list_join REMOTE_PREFIX ,)"
1057 print_indent
4 "remote_ts = dynamic"
1062 if isset LIFETIME
; then
1063 print_indent
4 "# Rekey Time"
1064 print_indent
4 "rekey_time = ${LIFETIME}"
1069 print_indent
4 "updown = ${NETWORK_HELPERS_DIR}/ipsec-updown"
1073 print_indent
4 "# Mode"
1076 print_indent
4 "mode = transport"
1079 print_indent
4 "mode = tunnel"
1085 print_indent
4 "# Compression"
1086 if enabled COMPRESSION
; then
1087 print_indent
4 "ipcomp = yes"
1089 print_indent
4 "ipcomp = no"
1093 # Inactivity Timeout
1094 if isset INACTIVITY_TIMEOUT
; then
1095 print_indent
4 "# Inactivity Timeout"
1096 print_indent
4 "inactivity = ${INACTIVITY_TIMEOUT}"
1101 print_indent
4 "# Start Action"
1102 case "${START_ACTION}" in
1104 print_indent
4 "start_action = trap"
1105 print_indent
4 "close_action = trap"
1108 print_indent
4 "start_action = none"
1109 print_indent
4 "close_action = none"
1112 print_indent
4 "start_action = start"
1113 print_indent
4 "close_action = start"
1127 _ipsec_connection_to_strongswan_secrets
() {
1128 local connection
="${1}"
1130 print_indent
0 "secrets {"
1132 case "${AUTH_MODE}" in
1134 print_indent
1 "ike {"
1137 print_indent
2 "secret = ${PSK}"
1140 if isset REMOTE_ID
; then
1141 print_indent
2 "id = ${REMOTE_ID}"