All pastes #292504 Raw Edit

Mine

public shellscript v1 · immutable
#292504 ·published 2006-12-26 16:37 UTC
rendered paste body
#!/bin/shPATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"port_forward() {     iptables -t nat -A PREROUTING -p $2 -i eth1 --dport $1 -j DNAT --to 192.168.0.5:$1}firewall_start() {    #do_qos    # nat    iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE    iptables -A INPUT -p udp --source-port 53 -j ACCEPT # ?    iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT    iptables -A INPUT -p tcp --dport 80 -j ACCEPT # apache    iptables -A INPUT -p tcp --dport 6936 -j ACCEPT # rtorrent    iptables -A INPUT -p tcp --dport 25 -j ACCEPT # mail    iptables -A INPUT -p tcp --dport 44 -j ACCEPT # sshd    iptables -A INPUT -p tcp --dport 15432 -j ACCEPT # postgres    iptables -A INPUT -p udp --dport 123 -j ACCEPT # ntp    iptables -A INPUT -p udp --dport 161 -j ACCEPT # snmpd    iptables -A INPUT -p udp --sport 161 -j ACCEPT # snmpd    # allow from lan (eth0)    iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT    port_forward 32459 tcp # bt    port_forward 6823  tcp # emule    iptables -A FORWARD -m limit -j LOG    iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s --limit-burst 2 -j ACCEPT    iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT    iptables -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT    iptables -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT # traceroute    iptables -A INPUT -j DROP}case "$1" in    start)        echo -n "Starting firewall... "        firewall_start        echo "Done"    ;;    stop)        echo -n "Stopping firewall... "        iptables -F; iptables -t nat -F; iptables -t mangle -F        iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE        tc qdisc del dev $QOS_DEV root    2> /dev/null > /dev/null        tc qdisc del dev $QOS_DEV ingress 2> /dev/null > /dev/null        echo -e "Done"    ;;    force-reload|restart)        $0 stop &        sleep 0.4        $0 start    ;;    *)        echo "Usage: /etc/init.d/firewall {start|stop|restart|force-reload}"        exit 1    ;;esacexit 0