aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/aristanetworks/goarista/iptables.sh
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aristanetworks/goarista/iptables.sh')
-rwxr-xr-xvendor/github.com/aristanetworks/goarista/iptables.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/aristanetworks/goarista/iptables.sh b/vendor/github.com/aristanetworks/goarista/iptables.sh
new file mode 100755
index 000000000..f118ff493
--- /dev/null
+++ b/vendor/github.com/aristanetworks/goarista/iptables.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+DEFAULT_PORT=6042
+
+set -e
+
+if [ "$#" -lt 1 ]
+then
+ echo "usage: $0 <host> [<port>]"
+ exit 1
+fi
+
+host=$1
+port=$DEFAULT_PORT
+if [ "$#" -gt 1 ]
+then
+ port=$2
+fi
+iptables="bash sudo iptables -A INPUT -p tcp --dport $port -j ACCEPT"
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $host "$iptables"
+echo "opened TCP port $port on $host"