From 52f484f4f815b77fc92d96ded0561e496766905c Mon Sep 17 00:00:00 2001 From: T31M Date: Wed, 27 May 2020 22:43:03 +0200 Subject: [PATCH] Added variable session timeout --- fish/theme-t31m/ssm_tunnel.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fish/theme-t31m/ssm_tunnel.fish b/fish/theme-t31m/ssm_tunnel.fish index bc43066..09e34c2 100644 --- a/fish/theme-t31m/ssm_tunnel.fish +++ b/fish/theme-t31m/ssm_tunnel.fish @@ -22,13 +22,14 @@ function ssm_tunnel --description 'access private AWS ressources via Bastion Hos # Ports to bind for forwarding set LOCAL_PORT $argv[2] set REM_PORT (math (random) % 65535 + 2000) + set TIMEOUT 21600 #seconds until forwarding session times out (48h max) # make sure jq is installed # Start socat on the remote server set CMD "'sudo socat TCP4-LISTEN:$REM_PORT,fork TCP4:$REMOTE_HOST'" set CMD_INVOC_ID (aws ssm send-command --instance-ids $INSTANCE_ID \ --document-name 'AWS-RunShellScript' \ - --parameters commands=$CMD --output json | jq -r '.Command.CommandId') + --parameters "commands=$CMD,executionTimeout=$TIMEOUT" --output json | jq -r '.Command.CommandId') # Start tunnel session echo "Starting Tunnel"