Skip to content

Commit

Permalink
Make the following options configurable via env vars: ClientAliveCoun…
Browse files Browse the repository at this point in the history
…tMax, ClientAliveInterval and TCPKeepAlive
  • Loading branch information
loranmutafov committed Mar 8, 2023
1 parent cbc96d5 commit d82405e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bastion
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@ else
CONFIG_AGENT_FORWARDING="-o AllowAgentForwarding=yes"
fi

# Connection limits, timeouts and thresholds

if [ -n "$CLIENT_ALIVE_COUNT_MAX" ]; then
CONFIG_CLIENT_ALIVE_COUNT_MAX="-o ClientAliveCountMax=$CLIENT_ALIVE_COUNT_MAX"
else
CONFIG_CLIENT_ALIVE_COUNT_MAX=""
fi

if [ -n "$CLIENT_ALIVE_INTERVAL" ]; then
CONFIG_CLIENT_ALIVE_INTERVAL="-o ClientAliveInterval=$CLIENT_ALIVE_INTERVAL"
else
CONFIG_CLIENT_ALIVE_INTERVAL=""
fi

if [ -n "$TCP_KEEP_ALIVE" ]; then
CONFIG_TCP_KEEP_ALIVE="-o TCPKeepAlive=$TCP_KEEP_ALIVE"
else
CONFIG_TCP_KEEP_ALIVE=""
fi

# Generate keys if they don't exist

if [ ! -f "$HOST_KEYS_PATH/ssh_host_rsa_key" ]; then
/usr/bin/ssh-keygen -A -f "$HOST_KEYS_PATH_PREFIX"
fi
Expand Down Expand Up @@ -89,5 +111,8 @@ fi
$CONFIG_TCP_FORWARDING \
$CONFIG_TRUSTED_USER_CA_KEYS \
$CONFIG_AUTHORIZED_PRINCIPALS_FILE \
$CONFIG_CLIENT_ALIVE_COUNT_MAX \
$CONFIG_CLIENT_ALIVE_INTERVAL \
$CONFIG_TCP_KEEP_ALIVE \
$CONFIG_LISTEN_ADDRESS \
$CONFIG_LISTEN_PORT

0 comments on commit d82405e

Please sign in to comment.