Skip to content

Instantly share code, notes, and snippets.

@hplc
Created November 28, 2011 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hplc/1402572 to your computer and use it in GitHub Desktop.
Save hplc/1402572 to your computer and use it in GitHub Desktop.
iptables setting for apache httpd web sites
#!/bin/sh
# Limit Apache user connect to updates.drupal.org,itself and LAN IPs only.
/sbin/iptables -A OUTPUT -p tcp -d 140.211.166.6 --dport 80 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp -d 140.211.166.21 --dport 80 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p all -d 202.68.199.208 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p all -d 192.168.168.0/24 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p all -d 10.0.0.0/8 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p all -d 127.0.0.1 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp --sport 8250 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p udp -d 202.181.224.2 --dport 53 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp --dport 25 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p udp -d 8.8.8.8 --dport 53 -m owner --uid-owner apache -j ACCEPT
/sbin/iptables -A OUTPUT -p all -m owner --uid-owner apache -j LOG
/sbin/iptables -A OUTPUT -p all -m owner --uid-owner apache -j REJECT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment