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
="\
39 IPSEC_DEFAULT_AUTH_MODE
="PSK"
40 IPSEC_DEFAULT_DPD_ACTION
="restart"
41 IPSEC_DEFAULT_DPD_DELAY
="30"
42 IPSEC_DEFAULT_DPD_TIMEOUT
="120"
43 IPSEC_DEFAULT_INACTIVITY_TIMEOUT
="0"
44 IPSEC_DEFAULT_MODE
="tunnel"
45 IPSEC_DEFAULT_SECURITY_POLICY
="system"
46 IPSEC_DEFAULT_START_ACTION
="on-demand"
48 IPSEC_VALID_MODES
="gre-transport tunnel vti"
49 IPSEC_VALID_AUTH_MODES
="PSK"
57 cli_ipsec_connection $@
60 error
"Unrecognized argument: ${action}"
66 cli_ipsec_connection
() {
67 if ipsec_connection_exists
${1}; then
74 authentication|down|dpd|inactivity_timeout|
local|mode|peer|remote|security_policy|start_action|up
)
75 ipsec_connection_
${key} ${connection} $@
78 cli_ipsec_connection_show
"${connection}"
82 error
"Unrecognized argument: ${key}"
92 ipsec_connection_new $@
95 ipsec_connection_destroy $@
98 if [ -n "${action}" ]; then
99 error
"Unrecognized argument: '${action}'"
107 cli_ipsec_connection_show
() {
108 local connection
="${1}"
110 # Read the config settings
111 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
112 if ! ipsec_connection_read_config
"${connection}"; then
113 error
"Could not read the connection configuration"
117 cli_headline
0 "IPsec VPN Connection: ${connection}"
122 cli_print_fmt1
1 "Peer" "${PEER}"
126 cli_print_fmt1
1 "Security Policy" "${SECURITY_POLICY-${IPSEC_DEFAULT_SECURITY_POLICY}}"
129 cli_headline
2 "Authentication"
130 case "${AUTH_MODE^^}" in
132 cli_print_fmt1
2 "Mode" "Pre-Shared-Key"
135 cli_print_fmt1
2 "Pre-Shared-Key" "****"
137 cli_print_fmt1
2 "Pre-Shared-Key" "- is not set -"
147 for i
in LOCAL REMOTE
; do
150 cli_headline
2 "Local"
153 cli_headline
2 "Remote"
157 local id_var
="${i}_ID"
158 if [ -n "${!id_var}" ]; then
159 cli_print_fmt1
2 "ID" "${!id_var}"
162 local prefix_var
="${i}_PREFIX"
163 if isset
${prefix_var}; then
164 cli_headline
3 "Prefix(es)"
167 for prefix
in ${!prefix_var}; do
168 cli_print_fmt1
3 "${prefix}"
175 cli_headline
2 "Misc."
179 cli_print_fmt1
2 "Transport Mode" "GRE Transport"
182 cli_print_fmt1
2 "Transport Mode" "Tunnel"
185 cli_print_fmt1
2 "Transport Mode" "Virtual Tunnel Interface"
188 cli_print_fmt1
2 "Transport Mode" "- Unknown -"
193 if isset INACTIVITY_TIMEOUT
&& [ ${INACTIVITY_TIMEOUT} -gt 0 ]; then
194 cli_print_fmt1
2 "Inactivity Timeout" "$(format_time ${INACTIVITY_TIMEOUT})"
201 # This function writes all values to a via ${connection} specificated VPN IPsec configuration file
202 ipsec_connection_write_config
() {
205 local connection
="${1}"
207 if ! ipsec_connection_exists
"${connection}"; then
208 log ERROR
"No such VPN IPsec connection: ${connection}"
212 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
214 if ! settings_write
"${path}" ${IPSEC_CONNECTION_CONFIG_SETTINGS}; then
215 log ERROR
"Could not write configuration settings for VPN IPsec connection ${connection}"
219 ipsec_reload
${connection}
222 # This funtion writes the value for one key to a via ${connection} specificated VPN IPsec connection configuration file
223 ipsec_connection_write_config_key
() {
226 local connection
=${1}
232 if ! ipsec_connection_exists
"${connection}"; then
233 log ERROR
"No such VPN ipsec connection: ${connection}"
237 log DEBUG
"Set '${key}' to new value '${value}' in VPN ipsec connection '${connection}'"
239 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
241 # Read the config settings
242 if ! ipsec_connection_read_config
"${connection}"; then
246 # Set the key to a new value
247 assign
"${key}" "${value}"
249 if ! ipsec_connection_write_config
"${connection}"; then
256 # Reads one or more keys out of a settings file or all if no key is provided.
257 ipsec_connection_read_config
() {
260 local connection
="${1}"
263 if ! ipsec_connection_exists
"${connection}"; then
264 log ERROR
"No such VPN IPsec connection : ${connection}"
270 if [ $# -eq 0 ] && [ -n "${IPSEC_CONNECTION_CONFIG_SETTINGS}" ]; then
271 list_append args
${IPSEC_CONNECTION_CONFIG_SETTINGS}
276 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
278 if ! settings_read
"${path}" ${args}; then
279 log ERROR
"Could not read settings for VPN IPsec connection ${connection}"
284 # This function checks if a vpn ipsec connection exists
285 # Returns True when yes and false when not
286 ipsec_connection_exists
() {
289 local connection
=${1}
291 local path
="${NETWORK_IPSEC_CONNS_DIR}/${connection}"
293 [ -d "${path}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
296 # Reloads the connection after config changes
298 local connection=${1}
300 if ! ipsec_connection_to_strongswan ${connection}; then
301 log ERROR "Could not generate strongswan config
for ${connnection}"
305 if ! cmd swanctl --load-all; then
306 log ERROR "Could not reload strongswan config
"
311 # Handle the cli after authentification
312 ipsec_connection_authentication() {
313 if [ ! $# -gt 1 ]; then
314 log ERROR "Not enough arguments
"
318 local connection=${1}
324 ipsec_connection_authentication_mode "${connection}" $@
327 ipsec_connection_authentication_psk "${connection}" $@
330 log ERROR "Unrecognized argument
: ${cmd}"
336 # Set the authentification mode
337 ipsec_connection_authentication_mode() {
338 if [ ! $# -eq 2 ]; then
339 log ERROR "Not enough arguments
"
342 local connection=${1}
345 if ! isoneof mode ${IPSEC_VALID_AUTH_MODES}; then
346 log ERROR "Auth mode
'${mode}' is invalid
"
350 if ! ipsec_connection_write_config_key "${connection}" "AUTH_MODE
" ${mode^^}; then
351 log ERROR "Could not
write configuration settings
"
357 ipsec_connection_authentication_psk() {
358 if [ ! $# -eq 2 ]; then
359 log ERROR "Not enough arguments
"
363 local connection=${1}
368 if [ ${length} -lt 4 ]; then
369 error "The PSK must be longer than four characters
"
373 if [ ${length} -gt 128 ]; then
374 error "The PSK cannot be longer than
128 characters
"
378 if ! ipsec_connection_write_config_key "${connection}" "PSK
" "${psk}"; then
379 log ERROR "Could not
write configuration settings
"
386 ipsec_connection_up() {
387 local connection="${1}"
389 if ! ipsec_connection_exists "${connection}"; then
390 error "No such VPN IPsec connection
: ${connection}"
394 cmd swanctl --initiate --child "${connection}"
397 ipsec_connection_down() {
398 local connection="${1}"
400 if ! ipsec_connection_exists "${connection}"; then
401 error "No such VPN IPsec connection
: ${connection}"
405 cmd swanctl --terminate --ike "${connection}"
408 # Handle the cli after authentification
409 ipsec_connection_dpd() {
410 if [ ! $# -gt 1 ]; then
411 log ERROR "Not enough arguments
"
415 local connection=${1}
421 ipsec_connection_dpd_action "${connection}" $@
424 ipsec_connection_dpd_delay "${connection}" $@
427 ipsec_connection_dpd_timeout "${connection}" $@
430 log ERROR "Unrecognized argument
: ${cmd}"
436 # Set the default dpd action
437 ipsec_connection_dpd_action() {
438 if [ ! $# -eq 2 ]; then
439 log ERROR "Not enough arguments
"
442 local connection=${1}
445 if ! isoneof action "restart
" "clear"; then
446 log ERROR "dpd action
'${action}' is invalid
"
450 if ! ipsec_connection_write_config_key "${connection}" "DPD_ACTION
" ${action}; then
451 log ERROR "Could not
write configuration settings
"
457 ipsec_connection_dpd_delay() {
458 if [ ! $# -ge 2 ]; then
459 log ERROR "Not enough arguments
"
463 local connection=${1}
467 if ! isinteger value; then
468 value=$(parse_time $@)
469 if [ ! $? -eq 0 ]; then
470 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
475 if [ ${value} -lt 0 ]; then
476 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
480 if ! ipsec_connection_write_config_key "${connection}" "DPD_DELAY
" ${value}; then
481 log ERROR "Could not
write configuration settings
"
488 # Set the dpd timeout
489 ipsec_connection_dpd_timeout() {
490 if [ ! $# -ge 2 ]; then
491 log ERROR "Not enough arguments
"
495 local connection=${1}
499 if ! isinteger value; then
500 value=$(parse_time $@)
501 if [ ! $? -eq 0 ]; then
502 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
507 if [ ${value} -le 0 ]; then
508 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
512 if ! ipsec_connection_write_config_key "${connection}" "DPD_TIMEOUT
" ${value}; then
513 log ERROR "Could not
write configuration settings
"
520 # Handle the cli after local
521 ipsec_connection_local() {
522 if [ ! $# -ge 2 ]; then
523 log ERROR "Not enough arguments
"
527 local connection=${1}
533 ipsec_connection_local_address "${connection}" $@
536 ipsec_connection_id "${connection}" "LOCAL
" $@
539 ipsec_connection_prefix "${connection}" "LOCAL
" $@
542 log ERROR "Unrecognized argument
: ${cmd}"
550 # Set the connection mode
551 ipsec_connection_mode() {
552 if [ ! $# -eq 2 ]; then
553 log ERROR "Not enough arguments
"
556 local connection=${1}
559 if ! isoneof mode ${IPSEC_VALID_MODES}; then
560 log ERROR "Mode
'${mode}' is invalid
"
564 if ! ipsec_connection_write_config_key "${connection}" "MODE
" ${mode}; then
565 log ERROR "Could not
write configuration settings
"
572 # Set the local address
573 ipsec_connection_local_address() {
574 if [ ! $# -eq 2 ]; then
575 log ERROR "Not enough arguments
"
578 local connection=${1}
579 local local_address=${2}
581 if ! ipsec_connection_check_peer ${local_address}; then
582 log ERROR "Local address
'${local_address}' is invalid
"
586 if ! ipsec_connection_write_config_key "${connection}" "LOCAL_ADDRESS
" ${local_address}; then
587 log ERROR "Could not
write configuration settings
"
594 # Set the peer to connect to
595 ipsec_connection_peer() {
596 if [ ! $# -eq 2 ]; then
597 log ERROR "Not enough arguments
"
600 local connection=${1}
603 if ! ipsec_connection_check_peer ${peer}; then
604 log ERROR "Peer
'${peer}' is invalid
"
608 if ! ipsec_connection_write_config_key "${connection}" "PEER
" ${peer}; then
609 log ERROR "Could not
write configuration settings
"
616 #Set the local or remote id
617 ipsec_connection_id() {
618 if [ ! $# -eq 3 ]; then
619 log ERROR "Not enough arguments
"
622 local connection=${1}
626 if ! ipsec_connection_check_id ${id}; then
627 log ERROR "Id
'${id}' is invalid
"
631 if ! ipsec_connection_write_config_key "${connection}" "${type}_ID" ${id}; then
632 log ERROR
"Could not write configuration settings"
639 # Set the local or remote prefix
640 ipsec_connection_prefix
() {
641 if [ ! $# -ge 3 ]; then
642 log ERROR
"Not enough arguments"
645 local connection
=${1}
649 local _prefix
="${type}_PREFIX"
651 if ! ipsec_connection_read_config
"${connection}" "${_prefix}"; then
655 # Remove duplicated entries to proceed the list safely
656 assign
"${_prefix}" "$(list_unique ${!_prefix} )"
659 local prefixes_removed
662 while [ $# -gt 0 ]; do
667 list_append prefixes_added
"${arg:1}"
670 list_append prefixes_removed
"${arg:1}"
673 list_append prefixes_set
"${arg}"
676 error
"Invalid argument: ${arg}"
683 # Check if the user is trying a mixed operation
684 if ! list_is_empty prefixes_set
&& (! list_is_empty prefixes_added ||
! list_is_empty prefixes_removed
); then
685 error
"You cannot reset the prefix list and add or remove prefixes at the same time"
689 # Set new prefix list
690 if ! list_is_empty prefixes_set
; then
691 # Check if all prefixes are valid
693 for prefix
in ${prefixes_set}; do
694 if ! ip_net_is_valid
${prefix}; then
695 error
"Unsupported prefix: ${prefix}"
700 assign
"${_prefix}" "${prefixes_set}"
702 # Perform incremental updates
706 # Perform all removals
707 for prefix
in ${prefixes_removed}; do
708 if ! list_remove
"${_prefix}" ${prefix}; then
709 warning
"${prefix} was not on the list and could not be removed"
714 for prefix
in ${prefixes_added}; do
715 if ip_net_is_valid
${prefix}; then
716 if ! list_append_unique
"${_prefix}" ${prefix}; then
717 warning
"${prefix} is already on the prefix list"
720 warning
"${prefix} is not a valid IP network and could not be added"
725 # Check if the list contain at least one valid prefix
726 if list_is_empty
${_prefix}; then
727 error
"Cannot save an empty prefix list"
732 if ! ipsec_connection_write_config_key
"${connection}" "${_prefix}" ${!_prefix}; then
733 log ERROR "Could not
write configuration settings
"
739 # Handle the cli after remote
740 ipsec_connection_remote() {
741 if [ ! $# -ge 2 ]; then
742 log ERROR "Not enough arguments
"
746 local connection=${1}
752 ipsec_connection_id "${connection}" "REMOTE
" $@
756 ipsec_connection_prefix "${connection}" "REMOTE
" $@
759 log ERROR "Unrecognized argument
: ${cmd}"
767 # Set the inactivity timeout
768 ipsec_connection_inactivity_timeout() {
769 if [ ! $# -ge 2 ]; then
770 log ERROR "Not enough arguments
"
774 local connection=${1}
778 if ! isinteger value; then
779 value=$(parse_time $@)
780 if [ ! $? -eq 0 ]; then
781 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
786 if [ ${value} -le 0 ]; then
787 log ERROR "The passed
time value must be
in the
sum greater zero seconds.
"
791 if ! ipsec_connection_write_config_key "${connection}" "INACTIVITY_TIMEOUT
" ${value}; then
792 log ERROR "Could not
write configuration settings
"
799 # Set the default start action
800 ipsec_connection_start_action() {
801 if [ ! $# -eq 2 ]; then
802 log ERROR "Not enough arguments
"
805 local connection=${1}
808 if ! isoneof action "on-demand
" "always-on
"; then
809 log ERROR "Start action
'${action}' is invalid
"
813 if ! ipsec_connection_write_config_key "${connection}" "START_ACTION
" ${action}; then
814 log ERROR "Could not
write configuration settings
"
819 # Set the security policy to use
820 ipsec_connection_security_policy() {
821 if [ ! $# -eq 2 ]; then
822 log ERROR "Not enough arguments
"
825 local connection=${1}
826 local security_policy=${2}
828 if ! vpn_security_policy_exists ${security_policy}; then
829 log ERROR "No such vpn security policy
'${security_policy}'"
833 if ! ipsec_connection_write_config_key "${connection}" "SECURITY_POLICY
" ${security_policy}; then
834 log ERROR "Could not
write configuration settings
"
839 # Check if a id is valid
840 ipsec_connection_check_id() {
844 if [[ ${id} =~ ^@[[:alnum:]]+$ ]] || ip_is_valid ${id}; then
851 # Checks if a peer is valid
852 ipsec_connection_check_peer() {
856 # TODO Accept also FQDNs
857 if ip_is_valid ${peer}; then
864 # This function checks if a VPN IPsec connection name is valid
865 # Allowed are only A-Za-z0-9
866 ipsec_connection_check_name() {
869 local connection=${1}
871 [[ "${connection}" =~ [^[:alnum:]$] ]]
874 # Function that creates one VPN IPsec connection
875 ipsec_connection_new() {
876 if [ $# -gt 1 ]; then
877 error "Too many arguments
"
881 local connection="${1}"
882 if ! isset connection; then
883 error "Please provide a connection name
"
887 # Check for duplicates
888 if ipsec_connection_exists "${connection}"; then
889 error "The VPN IPsec connection
${connection} already exists
"
893 # Check if the name of the connection is valid
894 if ipsec_connection_check_name "${connection}"; then
895 error "'${connection}' contains illegal characters
"
899 log DEBUG "Creating VPN IPsec connection
${connection}"
901 if ! mkdir -p "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
902 log ERROR "Could not create config directory
for ${connection}"
906 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
908 AUTH_MODE=${IPSEC_DEFAULT_AUTH_MODE}
909 DPD_ACTION=${IPSEC_DEFAULT_DPD_ACTION}
910 DPD_DELAY=${IPSEC_DEFAULT_DPD_DELAY}
911 DPD_TIMEOUT=${IPSEC_DEFAULT_DPD_TIMEOUT}
912 MODE=${IPSEC_DEFAULT_MODE}
913 START_ACTION=${IPSEC_DEFAULT_START_ACTION}
915 INACTIVITY_TIMEOUT=${IPSEC_DEFAULT_INACTIVITY_TIMEOUT}
916 SECURITY_POLICY=${IPSEC_DEFAULT_SECURITY_POLICY}
918 if ! ipsec_connection_write_config "${connection}"; then
919 log ERROR "Could not
write new config
file"
924 # Function that deletes based on the passed parameters one ore more vpn security policies
925 ipsec_connection_destroy() {
927 for connection in $@; do
928 if ! ipsec_connection_exists "${connection}"; then
929 log ERROR "The VPN IPsec connection
${connection} does not exist.
"
933 log DEBUG "Deleting VPN IPsec connection
${connection}"
934 if ! rm -rf "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
935 log ERROR "Deleting the VPN IPsec connection
${connection} was not sucessful
"
941 # List all ipsec connections
942 ipsec_list_connections() {
944 for connection in ${NETWORK_IPSEC_CONNS_DIR}/*; do
945 [ -d ${connection} ] || continue
946 basename ${connection}
950 ipsec_connection_to_strongswan() {
951 local connection="${1}"
953 # Read the config settings
954 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
955 if ! ipsec_connection_read_config "${connection}"; then
956 error "Could not
read the connection
${connection}"
960 local path="${NETWORK_IPSEC_SWANCTL_CONNECTIONS_DIR}/${connection}.conf
"
963 # Write the connection section
964 _ipsec_connection_to_strongswan_connection "${connection}"
966 # Write the secrets section
967 _ipsec_connection_to_strongswan_secrets "${connection}"
972 _ipsec_connection_to_strongswan_connection() {
973 local connection="${1}"
975 # Read the security policy
976 local ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
977 if ! vpn_security_policies_read_config "${SECURITY_POLICY}"; then
983 if isset DPD_DELAY && isinteger DPD_DELAY && [ ${DPD_DELAY} -gt 0 ]; then
987 print_indent 0 "connections
{"
988 print_indent 1 "${connection} {"
991 print_indent 2 "# IKE Version"
992 case "${KEY_EXCHANGE^^}" in
994 print_indent
2 "version = 1"
997 # Fall back to IKEv2 for any random values
999 print_indent
2 "version = 2"
1005 print_indent
2 "# Local Address"
1006 if isset LOCAL_ADDRESS
; then
1007 print_indent
2 "local_addrs = ${LOCAL_ADDRESS}"
1009 print_indent
2 "local_addrs = %any"
1014 print_indent
2 "# Remote Address"
1016 print_indent
2 "remote_addrs = ${PEER}"
1018 print_indent
2 "remote_addrs = %any"
1023 print_indent
2 "# IKE Proposals"
1024 print_indent
2 "proposals = $(vpn_security_policies_make_ike_proposal ${SECURITY_POLICY})"
1028 if enabled dpd
; then
1029 print_indent
2 "# Dead Peer Detection"
1030 print_indent
2 "dpd_delay = ${DPD_DELAY}"
1032 if isset DPD_TIMEOUT
; then
1033 print_indent
2 "dpd_timeout = ${DPD_TIMEOUT}"
1040 print_indent
2 "# Fragmentation"
1041 print_indent
2 "fragmentation = yes"
1045 print_indent
2 "local {"
1048 if isset LOCAL_ID
; then
1049 print_indent
3 "id = ${LOCAL_ID}"
1053 case "${AUTH_MODE}" in
1055 print_indent
3 "auth = psk"
1063 print_indent
2 "remote {"
1066 if isset REMOTE_ID
; then
1067 print_indent
3 "id = ${REMOTE_ID}"
1071 case "${AUTH_MODE}" in
1073 print_indent
3 "auth = psk"
1082 print_indent
2 "children {"
1083 print_indent
3 "${connection} {"
1085 print_indent
4 "# ESP Proposals"
1086 print_indent
4 "esp_proposals = $(vpn_security_policies_make_esp_proposal ${SECURITY_POLICY})"
1093 print_indent
4 "local_ts = dynamic[gre]"
1094 print_indent
4 "remote_ts = dynamic[gre]"
1098 if isset LOCAL_PREFIX
; then
1099 print_indent
4 "local_ts = $(list_join LOCAL_PREFIX ,)"
1101 print_indent
4 "local_ts = dynamic"
1105 if isset REMOTE_PREFIX
; then
1106 print_indent
4 "remote_ts = $(list_join REMOTE_PREFIX ,)"
1108 print_indent
4 "remote_ts = dynamic"
1115 print_indent
4 "# Netfilter Marks"
1116 print_indent
4 "mark_in = %unique"
1117 print_indent
4 "mark_out = %unique"
1120 # Dead Peer Detection
1121 if enabled dpd
; then
1122 print_indent
4 "# Dead Peer Detection"
1123 print_indent
4 "dpd_action = ${DPD_ACTION}"
1128 if isset LIFETIME
; then
1129 print_indent
4 "# Rekey Time"
1130 print_indent
4 "rekey_time = ${LIFETIME}"
1135 print_indent
4 "updown = ${NETWORK_HELPERS_DIR}/ipsec-updown"
1139 print_indent
4 "# Mode"
1142 print_indent
4 "mode = transport"
1145 print_indent
4 "mode = tunnel"
1151 print_indent
4 "# Compression"
1152 if enabled COMPRESSION
; then
1153 print_indent
4 "ipcomp = yes"
1155 print_indent
4 "ipcomp = no"
1159 # Inactivity Timeout
1160 if isset INACTIVITY_TIMEOUT
; then
1161 print_indent
4 "# Inactivity Timeout"
1162 print_indent
4 "inactivity = ${INACTIVITY_TIMEOUT}"
1167 print_indent
4 "# Start Action"
1168 case "${START_ACTION}" in
1170 print_indent
4 "start_action = trap"
1171 print_indent
4 "close_action = trap"
1174 print_indent
4 "start_action = none"
1175 print_indent
4 "close_action = none"
1178 print_indent
4 "start_action = start"
1179 print_indent
4 "close_action = start"
1193 _ipsec_connection_to_strongswan_secrets
() {
1194 local connection
="${1}"
1196 print_indent
0 "secrets {"
1198 case "${AUTH_MODE}" in
1200 print_indent
1 "ike {"
1203 print_indent
2 "secret = ${PSK}"
1206 if isset REMOTE_ID
; then
1207 print_indent
2 "id = ${REMOTE_ID}"