Skip to content

Instantly share code, notes, and snippets.

@egeneralov
Created May 18, 2021 08:30
Show Gist options
  • Save egeneralov/8d94d1363aafafa7cc7af1a330a70b87 to your computer and use it in GitHub Desktop.
Save egeneralov/8d94d1363aafafa7cc7af1a330a70b87 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
apt-get install iptables{,-persistent}
iptables -N node-exporter
iptables -A node-exporter -s 1.1.1.1 -j ACCEPT
iptables -A node-exporter -s 1.0.0.1 -j ACCEPT
iptables -A node-exporter -s 8.8.8.8 -j ACCEPT
iptables -A node-exporter -s 127.0.0.0/8 -j ACCEPT
iptables -A node-exporter -j REJECT
iptables -A INPUT -p tcp --dport 9100 -j node-exporter
iptables-save > /etc/iptables/rules.v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment