=================================================================== RCS file: /home/cvsd/home/cvs/scripts/shell/firewall/fw-universal.sh,v retrieving revision 2.87 retrieving revision 2.88 diff -u -p -r2.87 -r2.88 --- scripts/shell/firewall/fw-universal.sh 2012/02/10 23:01:58 2.87 +++ scripts/shell/firewall/fw-universal.sh 2012/02/11 18:59:55 2.88 @@ -22,7 +22,7 @@ # Licensed under terms of GNU General Public License. # All rights reserved. # -# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.86 2012-01-24 20:55:35 rajo Exp $ +# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.87 2012-02-10 23:01:58 rajo Exp $ # # Changelog: # 2003-10-24 - created @@ -1482,7 +1482,7 @@ deploy_block() TMPFILE=`mktemp -t fw-universal.sh-XXXXXX` || exit 1 trap 'rm -f $TMPFILE' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for i in $*; do - echo $i >> $TMPFILE; + echo "block $i" >> $TMPFILE; done while read conn keyfile do @@ -1492,7 +1492,7 @@ deploy_block() ;; esac print_info "Deploying to $conn ..."; - cat $TMPFILE | ssh -i $keyfile $conn $0 block + cat $TMPFILE | ssh -i $keyfile $conn $0 remote done < $DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list rm -f $TMPFILE } # }}} @@ -1516,16 +1516,37 @@ deploy_update() QUIET=yes $0 start while read conn keyfile do - case "$conn" in - ""|\#*) - continue - ;; - esac + case "$conn" in + ""|\#*) + continue + ;; + esac print_info "Updating $conn ..."; - ssh -i $keyfile $conn $0 update + echo "update" | ssh -i $keyfile $conn $0 remote done < $DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list } # }}} +remote() +{ # {{{ + while read comnd par + do + case "$comnd" in + block) + echo "Blocking '$par'..." + add_banned_ip $par + ;; + update) + echo "Updating..." + update + ;; + ""|\#*) + echo "Line '$comnd $par' ignored" + continue + ;; + esac + done +} # }}} + # Parse output from ifconfig: - tested on Linux and FreeBSD # http://platon.sk/cvs/cvs.php/scripts/shell/firewall/ifconfig-parse.sh parse_ifconfig() @@ -1774,6 +1795,9 @@ case "$1" in deploy-update) deploy_update; ;; + remote) + remote; + ;; *) echo "Usage: $0 {start|stop|really-off|status|purge|block|deploy-block|deploy-update|update}" >&2 exit 1