4 ms·
> Basically I want an API where I can torture an EC2 instance to see what happens to it, for science! # cat > dropme.sh <<'EOFILE' #!/bin/sh set -eu re
by peterwwillis 6y ago
> Basically I want an API where I can torture an EC2 instance to see what happens to it, for science!
# cat > dropme.sh <<'EOFILE'
#!/bin/sh
set -eu
read -r SLEEP
tmp=`mktemp` ; tmp6=`mktemp`
iptables-save > $tmp
ip6tables-save > $tmp6
for t in iptables ip6tables ; do
for c in INPUT OUTPUT FORWARD ; do $t -P $c DROP ; done
$t -t nat -F ; $t -t mangle -F ; $t -F ; $t -X
done
sleep "$SLEEP"
iptables-restore < $tmp
ip6tables-restore < $tmp6
rm -f $tmp $tmp6
EOFILE
# chmod 755 dropme.sh
# ncat -k -l -c ./dropme.sh $(ifconfig eth0 | grep 'inet ' | awk '{print $2}') 12345 &
# echo "60" | ncat -v $(ifconfig eth0 | grep 'inet ' | awk '{print $2}') 12345
If you're lucky the existing connections won't even die, but the box will be offline for 60 seconds.
- blaser-waffle 6y agoNot a bad script, but it's basically going "shields up!", blocking all traffic, and then taking them down. Definitely useful, but won't test for the hard stuff, like if my DB was in the middle of something and then died, scrambling my data. What's that gonna look like on reboot?