diff options
Diffstat (limited to 'shell')
-rwxr-xr-x | shell | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1,13 +1,19 @@ #!/bin/bash # -# Simple autossh and screen wrapper. +# Simple $AUTOSSH and screen wrapper. # # Parameters +# +# We're enforcing a random monitoring por for autossh +# as some systems might deny reading /proc/net/tcp like +# kernels with grsecurity patch. BASENAME="`basename $0`" DEST="$1" COMMAND="$2" MULTIPLEXER="wscreen" +MONITORING="-M $(($RANDOM + 1024))" +AUTOSSH="autossh $MONITORING" # Set window title # http://stackoverflow.com/questions/899609/gnu-screen-run-script-that-sends-commands-to-the-screen-session-it-is-being-run @@ -31,11 +37,11 @@ window_title $DEST # Dispatcher if [ "$BASENAME" == "shells" ]; then - # Remote screen shell using autossh + # Remote screen shell using $AUTOSSH if [ "$COMMAND" == "root" ]; then - autossh $DEST -t -- sudo screen -x + $AUTOSSH $DEST -t -- sudo screen -x else - autossh $DEST -t -- screen -x $COMMAND + $AUTOSSH $DEST -t -- screen -x $COMMAND fi else if [ -z "$COMMAND" ] && screen -ls $DEST | grep -q "There is a screen on"; then @@ -54,8 +60,8 @@ else window_title $COMMAND $MULTIPLEXER $COMMAND else - # Remote shell using autossh - autossh $DEST -t -- $COMMAND + # Remote shell using $AUTOSSH + $AUTOSSH $DEST -t -- $COMMAND fi fi |