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 ipsec_strongswan_load() {
297 if ! cmd swanctl --load-all; then
298 log ERROR "Could not reload strongswan config
"
303 # Reloads the connection after config changes
305 local connection=${1}
307 if ! ipsec_connection_to_strongswan ${connection}; then
308 log ERROR "Could not generate strongswan config
for ${connnection}"
312 ipsec_strongswan_load
315 # Handle the cli after authentification
316 ipsec_connection_authentication() {
317 if [ ! $# -gt 1 ]; then
318 log ERROR "Not enough arguments
"
322 local connection=${1}
328 ipsec_connection_authentication_mode "${connection}" $@
331 ipsec_connection_authentication_psk "${connection}" $@
334 log ERROR "Unrecognized argument
: ${cmd}"
340 # Set the authentification mode
341 ipsec_connection_authentication_mode() {
342 if [ ! $# -eq 2 ]; then
343 log ERROR "Not enough arguments
"
346 local connection=${1}
349 if ! isoneof mode ${IPSEC_VALID_AUTH_MODES}; then
350 log ERROR "Auth mode
'${mode}' is invalid
"
354 if ! ipsec_connection_write_config_key "${connection}" "AUTH_MODE
" ${mode^^}; then
355 log ERROR "Could not
write configuration settings
"
361 ipsec_connection_authentication_psk() {
362 if [ ! $# -eq 2 ]; then
363 log ERROR "Not enough arguments
"
367 local connection=${1}
372 if [ ${length} -lt 4 ]; then
373 error "The PSK must be longer than four characters
"
377 if [ ${length} -gt 128 ]; then
378 error "The PSK cannot be longer than
128 characters
"
382 if ! ipsec_connection_write_config_key "${connection}" "PSK
" "${psk}"; then
383 log ERROR "Could not
write configuration settings
"
390 ipsec_connection_up() {
391 local connection="${1}"
393 if ! ipsec_connection_exists "${connection}"; then
394 error "No such VPN IPsec connection
: ${connection}"
398 cmd swanctl --initiate --child "${connection}"
401 ipsec_connection_down() {
402 local connection="${1}"
404 if ! ipsec_connection_exists "${connection}"; then
405 error "No such VPN IPsec connection
: ${connection}"
409 cmd swanctl --terminate --ike "${connection}"
412 # Handle the cli after authentification
413 ipsec_connection_dpd() {
414 if [ ! $# -gt 1 ]; then
415 log ERROR "Not enough arguments
"
419 local connection=${1}
425 ipsec_connection_dpd_action "${connection}" $@
428 ipsec_connection_dpd_delay "${connection}" $@
431 ipsec_connection_dpd_timeout "${connection}" $@
434 log ERROR "Unrecognized argument
: ${cmd}"
440 # Set the default dpd action
441 ipsec_connection_dpd_action() {
442 if [ ! $# -eq 2 ]; then
443 log ERROR "Not enough arguments
"
446 local connection=${1}
449 if ! isoneof action "restart
" "clear"; then
450 log ERROR "dpd action
'${action}' is invalid
"
454 if ! ipsec_connection_write_config_key "${connection}" "DPD_ACTION
" ${action}; then
455 log ERROR "Could not
write configuration settings
"
461 ipsec_connection_dpd_delay() {
462 if [ ! $# -ge 2 ]; then
463 log ERROR "Not enough arguments
"
467 local connection=${1}
471 if ! isinteger value; then
472 value=$(parse_time $@)
473 if [ ! $? -eq 0 ]; then
474 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
479 if [ ${value} -lt 0 ]; then
480 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
484 if ! ipsec_connection_write_config_key "${connection}" "DPD_DELAY
" ${value}; then
485 log ERROR "Could not
write configuration settings
"
492 # Set the dpd timeout
493 ipsec_connection_dpd_timeout() {
494 if [ ! $# -ge 2 ]; then
495 log ERROR "Not enough arguments
"
499 local connection=${1}
503 if ! isinteger value; then
504 value=$(parse_time $@)
505 if [ ! $? -eq 0 ]; then
506 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
511 if [ ${value} -le 0 ]; then
512 log ERROR "The passed
time value must be
in the
sum greater or equal zero seconds.
"
516 if ! ipsec_connection_write_config_key "${connection}" "DPD_TIMEOUT
" ${value}; then
517 log ERROR "Could not
write configuration settings
"
524 # Handle the cli after local
525 ipsec_connection_local() {
526 if [ ! $# -ge 2 ]; then
527 log ERROR "Not enough arguments
"
531 local connection=${1}
537 ipsec_connection_local_address "${connection}" $@
540 ipsec_connection_id "${connection}" "LOCAL
" $@
543 ipsec_connection_prefix "${connection}" "LOCAL
" $@
546 log ERROR "Unrecognized argument
: ${cmd}"
554 # Set the connection mode
555 ipsec_connection_mode() {
556 if [ ! $# -eq 2 ]; then
557 log ERROR "Not enough arguments
"
560 local connection=${1}
563 if ! isoneof mode ${IPSEC_VALID_MODES}; then
564 log ERROR "Mode
'${mode}' is invalid
"
568 if ! ipsec_connection_write_config_key "${connection}" "MODE
" ${mode}; then
569 log ERROR "Could not
write configuration settings
"
576 # Set the local address
577 ipsec_connection_local_address() {
578 if [ ! $# -eq 2 ]; then
579 log ERROR "Not enough arguments
"
582 local connection=${1}
583 local local_address=${2}
585 if ! ipsec_connection_check_peer ${local_address}; then
586 log ERROR "Local address
'${local_address}' is invalid
"
590 if ! ipsec_connection_write_config_key "${connection}" "LOCAL_ADDRESS
" ${local_address}; then
591 log ERROR "Could not
write configuration settings
"
598 # Set the peer to connect to
599 ipsec_connection_peer() {
600 if [ ! $# -eq 2 ]; then
601 log ERROR "Not enough arguments
"
604 local connection=${1}
607 if ! ipsec_connection_check_peer ${peer}; then
608 log ERROR "Peer
'${peer}' is invalid
"
612 if ! ipsec_connection_write_config_key "${connection}" "PEER
" ${peer}; then
613 log ERROR "Could not
write configuration settings
"
620 #Set the local or remote id
621 ipsec_connection_id() {
622 if [ ! $# -eq 3 ]; then
623 log ERROR "Not enough arguments
"
626 local connection=${1}
630 if ! ipsec_connection_check_id ${id}; then
631 log ERROR "Id
'${id}' is invalid
"
635 if ! ipsec_connection_write_config_key "${connection}" "${type}_ID" ${id}; then
636 log ERROR
"Could not write configuration settings"
643 # Set the local or remote prefix
644 ipsec_connection_prefix
() {
645 if [ ! $# -ge 3 ]; then
646 log ERROR
"Not enough arguments"
649 local connection
=${1}
653 local _prefix
="${type}_PREFIX"
655 if ! ipsec_connection_read_config
"${connection}" "${_prefix}"; then
659 # Remove duplicated entries to proceed the list safely
660 assign
"${_prefix}" "$(list_unique ${!_prefix} )"
663 local prefixes_removed
666 while [ $# -gt 0 ]; do
671 list_append prefixes_added
"${arg:1}"
674 list_append prefixes_removed
"${arg:1}"
677 list_append prefixes_set
"${arg}"
680 error
"Invalid argument: ${arg}"
687 # Check if the user is trying a mixed operation
688 if ! list_is_empty prefixes_set
&& (! list_is_empty prefixes_added ||
! list_is_empty prefixes_removed
); then
689 error
"You cannot reset the prefix list and add or remove prefixes at the same time"
693 # Set new prefix list
694 if ! list_is_empty prefixes_set
; then
695 # Check if all prefixes are valid
697 for prefix
in ${prefixes_set}; do
698 if ! ip_net_is_valid
${prefix}; then
699 error
"Unsupported prefix: ${prefix}"
704 assign
"${_prefix}" "${prefixes_set}"
706 # Perform incremental updates
710 # Perform all removals
711 for prefix
in ${prefixes_removed}; do
712 if ! list_remove
"${_prefix}" ${prefix}; then
713 warning
"${prefix} was not on the list and could not be removed"
718 for prefix
in ${prefixes_added}; do
719 if ip_net_is_valid
${prefix}; then
720 if ! list_append_unique
"${_prefix}" ${prefix}; then
721 warning
"${prefix} is already on the prefix list"
724 warning
"${prefix} is not a valid IP network and could not be added"
729 # Check if the list contain at least one valid prefix
730 if list_is_empty
${_prefix}; then
731 error
"Cannot save an empty prefix list"
736 if ! ipsec_connection_write_config_key
"${connection}" "${_prefix}" ${!_prefix}; then
737 log ERROR "Could not
write configuration settings
"
743 # Handle the cli after remote
744 ipsec_connection_remote() {
745 if [ ! $# -ge 2 ]; then
746 log ERROR "Not enough arguments
"
750 local connection=${1}
756 ipsec_connection_id "${connection}" "REMOTE
" $@
760 ipsec_connection_prefix "${connection}" "REMOTE
" $@
763 log ERROR "Unrecognized argument
: ${cmd}"
771 # Set the inactivity timeout
772 ipsec_connection_inactivity_timeout() {
773 if [ ! $# -ge 2 ]; then
774 log ERROR "Not enough arguments
"
778 local connection=${1}
782 if ! isinteger value; then
783 value=$(parse_time $@)
784 if [ ! $? -eq 0 ]; then
785 log ERROR "Parsing the passed
time was not sucessful please check the passed values.
"
790 if [ ${value} -le 0 ]; then
791 log ERROR "The passed
time value must be
in the
sum greater zero seconds.
"
795 if ! ipsec_connection_write_config_key "${connection}" "INACTIVITY_TIMEOUT
" ${value}; then
796 log ERROR "Could not
write configuration settings
"
803 # Set the default start action
804 ipsec_connection_start_action() {
805 if [ ! $# -eq 2 ]; then
806 log ERROR "Not enough arguments
"
809 local connection=${1}
812 if ! isoneof action "on-demand
" "always-on
"; then
813 log ERROR "Start action
'${action}' is invalid
"
817 if ! ipsec_connection_write_config_key "${connection}" "START_ACTION
" ${action}; then
818 log ERROR "Could not
write configuration settings
"
823 # Set the security policy to use
824 ipsec_connection_security_policy() {
825 if [ ! $# -eq 2 ]; then
826 log ERROR "Not enough arguments
"
829 local connection=${1}
830 local security_policy=${2}
832 if ! vpn_security_policy_exists ${security_policy}; then
833 log ERROR "No such vpn security policy
'${security_policy}'"
837 if ! ipsec_connection_write_config_key "${connection}" "SECURITY_POLICY
" ${security_policy}; then
838 log ERROR "Could not
write configuration settings
"
843 # Check if a id is valid
844 ipsec_connection_check_id() {
848 if [[ ${id} =~ ^@[[:alnum:]]+$ ]] || ip_is_valid ${id}; then
855 # Checks if a peer is valid
856 ipsec_connection_check_peer() {
860 # TODO Accept also FQDNs
861 if ip_is_valid ${peer}; then
868 # This function checks if a VPN IPsec connection name is valid
869 # Allowed are only A-Za-z0-9
870 ipsec_connection_check_name() {
873 local connection=${1}
875 [[ "${connection}" =~ [^[:alnum:]$] ]]
878 # Function that creates one VPN IPsec connection
879 ipsec_connection_new() {
880 if [ $# -gt 1 ]; then
881 error "Too many arguments
"
885 local connection="${1}"
886 if ! isset connection; then
887 error "Please provide a connection name
"
891 # Check for duplicates
892 if ipsec_connection_exists "${connection}"; then
893 error "The VPN IPsec connection
${connection} already exists
"
897 # Check if the name of the connection is valid
898 if ipsec_connection_check_name "${connection}"; then
899 error "'${connection}' contains illegal characters
"
903 log DEBUG "Creating VPN IPsec connection
${connection}"
905 if ! mkdir -p "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
906 log ERROR "Could not create config directory
for ${connection}"
910 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
912 AUTH_MODE=${IPSEC_DEFAULT_AUTH_MODE}
913 DPD_ACTION=${IPSEC_DEFAULT_DPD_ACTION}
914 DPD_DELAY=${IPSEC_DEFAULT_DPD_DELAY}
915 DPD_TIMEOUT=${IPSEC_DEFAULT_DPD_TIMEOUT}
916 MODE=${IPSEC_DEFAULT_MODE}
917 START_ACTION=${IPSEC_DEFAULT_START_ACTION}
919 INACTIVITY_TIMEOUT=${IPSEC_DEFAULT_INACTIVITY_TIMEOUT}
920 SECURITY_POLICY=${IPSEC_DEFAULT_SECURITY_POLICY}
922 if ! ipsec_connection_write_config "${connection}"; then
923 log ERROR "Could not
write new config
file"
928 # Function that deletes based on the passed parameters one ore more vpn security policies
929 ipsec_connection_destroy() {
931 for connection in $@; do
932 if ! ipsec_connection_exists "${connection}"; then
933 log ERROR "The VPN IPsec connection
${connection} does not exist.
"
937 log DEBUG "Deleting VPN IPsec connection
${connection}"
938 if ! rm -rf "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
939 log ERROR "Deleting the VPN IPsec connection
${connection} was not sucessful
"
945 # List all ipsec connections
946 ipsec_list_connections() {
948 for connection in ${NETWORK_IPSEC_CONNS_DIR}/*; do
949 [ -d ${connection} ] || continue
950 basename ${connection}
954 ipsec_connection_to_strongswan() {
955 local connection="${1}"
957 # Read the config settings
958 local ${IPSEC_CONNECTION_CONFIG_SETTINGS}
959 if ! ipsec_connection_read_config "${connection}"; then
960 error "Could not
read the connection
${connection}"
964 local path="${NETWORK_IPSEC_SWANCTL_CONNECTIONS_DIR}/${connection}.conf
"
967 # Write the connection section
968 _ipsec_connection_to_strongswan_connection "${connection}"
970 # Write the secrets section
971 _ipsec_connection_to_strongswan_secrets "${connection}"
976 _ipsec_connection_to_strongswan_connection() {
977 local connection="${1}"
979 # Read the security policy
980 local ${VPN_SECURITY_POLICIES_CONFIG_SETTINGS}
981 if ! vpn_security_policies_read_config "${SECURITY_POLICY}"; then
987 if isset DPD_DELAY && isinteger DPD_DELAY && [ ${DPD_DELAY} -gt 0 ]; then
991 print_indent 0 "connections
{"
992 print_indent 1 "${connection} {"
995 print_indent 2 "# IKE Version"
996 case "${KEY_EXCHANGE^^}" in
998 print_indent
2 "version = 1"
1001 # Fall back to IKEv2 for any random values
1003 print_indent
2 "version = 2"
1009 print_indent
2 "# Local Address"
1010 if isset LOCAL_ADDRESS
; then
1011 print_indent
2 "local_addrs = ${LOCAL_ADDRESS}"
1013 print_indent
2 "local_addrs = %any"
1018 print_indent
2 "# Remote Address"
1020 print_indent
2 "remote_addrs = ${PEER}"
1022 print_indent
2 "remote_addrs = %any"
1027 print_indent
2 "# IKE Proposals"
1028 print_indent
2 "proposals = $(vpn_security_policies_make_ike_proposal ${SECURITY_POLICY})"
1032 if enabled dpd
; then
1033 print_indent
2 "# Dead Peer Detection"
1034 print_indent
2 "dpd_delay = ${DPD_DELAY}"
1036 if isset DPD_TIMEOUT
; then
1037 print_indent
2 "dpd_timeout = ${DPD_TIMEOUT}"
1044 print_indent
2 "# Fragmentation"
1045 print_indent
2 "fragmentation = yes"
1049 print_indent
2 "local {"
1052 if isset LOCAL_ID
; then
1053 print_indent
3 "id = ${LOCAL_ID}"
1057 case "${AUTH_MODE}" in
1059 print_indent
3 "auth = psk"
1067 print_indent
2 "remote {"
1070 if isset REMOTE_ID
; then
1071 print_indent
3 "id = ${REMOTE_ID}"
1075 case "${AUTH_MODE}" in
1077 print_indent
3 "auth = psk"
1086 print_indent
2 "children {"
1087 print_indent
3 "${connection} {"
1089 print_indent
4 "# ESP Proposals"
1090 print_indent
4 "esp_proposals = $(vpn_security_policies_make_esp_proposal ${SECURITY_POLICY})"
1097 print_indent
4 "local_ts = dynamic[gre]"
1098 print_indent
4 "remote_ts = dynamic[gre]"
1102 if isset LOCAL_PREFIX
; then
1103 print_indent
4 "local_ts = $(list_join LOCAL_PREFIX ,)"
1105 print_indent
4 "local_ts = dynamic"
1109 if isset REMOTE_PREFIX
; then
1110 print_indent
4 "remote_ts = $(list_join REMOTE_PREFIX ,)"
1112 print_indent
4 "remote_ts = dynamic"
1119 print_indent
4 "# Netfilter Marks"
1120 print_indent
4 "mark_in = %unique"
1121 print_indent
4 "mark_out = %unique"
1124 # Dead Peer Detection
1125 if enabled dpd
; then
1126 print_indent
4 "# Dead Peer Detection"
1127 print_indent
4 "dpd_action = ${DPD_ACTION}"
1132 if isset LIFETIME
; then
1133 print_indent
4 "# Rekey Time"
1134 print_indent
4 "rekey_time = ${LIFETIME}"
1139 print_indent
4 "updown = ${NETWORK_HELPERS_DIR}/ipsec-updown"
1143 print_indent
4 "# Mode"
1146 print_indent
4 "mode = transport"
1149 print_indent
4 "mode = tunnel"
1155 print_indent
4 "# Compression"
1156 if enabled COMPRESSION
; then
1157 print_indent
4 "ipcomp = yes"
1159 print_indent
4 "ipcomp = no"
1163 # Inactivity Timeout
1164 if isset INACTIVITY_TIMEOUT
; then
1165 print_indent
4 "# Inactivity Timeout"
1166 print_indent
4 "inactivity = ${INACTIVITY_TIMEOUT}"
1171 print_indent
4 "# Start Action"
1172 case "${START_ACTION}" in
1174 print_indent
4 "start_action = trap"
1175 print_indent
4 "close_action = trap"
1178 print_indent
4 "start_action = none"
1179 print_indent
4 "close_action = none"
1182 print_indent
4 "start_action = start"
1183 print_indent
4 "close_action = start"
1197 _ipsec_connection_to_strongswan_secrets
() {
1198 local connection
="${1}"
1200 print_indent
0 "secrets {"
1202 case "${AUTH_MODE}" in
1204 print_indent
1 "ike {"
1207 print_indent
2 "secret = ${PSK}"
1210 if isset REMOTE_ID
; then
1211 print_indent
2 "id = ${REMOTE_ID}"