Skip to content

Instantly share code, notes, and snippets.

@SharkyRawr
Created December 22, 2018 08:53
Show Gist options
  • Save SharkyRawr/050c5f44c911a252eeec5ad4774bd43d to your computer and use it in GitHub Desktop.
Save SharkyRawr/050c5f44c911a252eeec5ad4774bd43d to your computer and use it in GitHub Desktop.
Dont block my server plz Hetzner plz
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#
# Block any currently known *private* subnet so that the overly sensitive Hetzner "NetScan" wont get scared (triggered)
# (you may want to replace enp4s0 with your own *public* interface)
#
/sbin/iptables -I OUTPUT -o enp4s0 -d 0.0.0.0/8 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 10.0.0.0/8 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 100.64.0.0/10 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 169.254.0.0/16 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 172.16.0.0/12 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 192.0.0.0/24 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 192.0.2.0/24 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 192.88.99.0/24 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 192.168.0.0/16 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 198.18.0.0/15 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 198.51.100.0/24 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 203.0.113.0/24 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 224.0.0.0/4 -j DROP
/sbin/iptables -I OUTPUT -o enp4s0 -d 240.0.0.0/4 -j DROP
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment