Last active
June 19, 2019 18:16
-
-
Save imayobrown/138580e7dc68930d9f567fb0d5ee1c22 to your computer and use it in GitHub Desktop.
Isolate a machine from 2 others
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INSTANCE_TO_ISOLATE=$1 | |
INSTANCE_TO_ISOLATE_FROM_1=$2 | |
INSTANCE_TO_ISOLATE_FROM_2=$3 | |
PEM_PATH=$4 | |
ssh -i $PEM_PATH -t centos@$INSTANCE_TO_ISOLATE "sudo iptables -I INPUT -s $INSTANCE_TO_ISOLATE_FROM_1 -j DROP && sudo iptables -I INPUT -s $INSTANCE_TO_ISOLATE_FROM_2 -j DROP" | |
ssh -i $PEM_PATH -t centos@$INSTANCE_TO_ISOLATE "sudo iptables -I OUTPUT -d $INSTANCE_TO_ISOLATE_FROM_1 -j DROP && sudo iptables -I OUTPUT -d $INSTANCE_TO_ISOLATE_FROM_2 -j DROP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment