27.06.2013 Views

Hack Security Pro.pdf - Index of

Hack Security Pro.pdf - Index of

Hack Security Pro.pdf - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

To share the Internet connection with other computers <strong>of</strong> your network:<br />

iptables -F FORWARD<br />

iptables -A FORWARD -j ACCEPT<br />

iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE<br />

Finally, to redirect all entering connections to port destination 80, up to machine 192.168.1.10 on its<br />

port 8080 (port forwarding):<br />

iptables -t nat -A PREROUTING -d votre_addresse_ip_internet -p tcp --dport 80 -j DNAT -to-destination<br />

192.168.1.10:8080<br />

Here is a summary <strong>of</strong> the script you could use if applying all <strong>of</strong> these rules:<br />

#/bin/sh<br />

#let's find which is our Internet address:<br />

IP=`ifconfig ppp0 | grep inet | awk {'print $2'} | awk -F ":" {'print $2}`<br />

iptables -P INPUT DROP<br />

iptables -P OUTPUT DROP<br />

iptables -P FORWARD DROP<br />

iptables -A INPUT -i lo -j ACCEPT<br />

iptables -A OUTPUT -o lo -j ACCEPT<br />

iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT<br />

iptables -A OUTPUT -d 192.168.1.0/24 -j ACCEPT<br />

iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT<br />

iptables -A INPUT -i ppp0 --protocol udp --source-port 53 -j ACCEPT<br />

iptables -A OUTPUT -o ppp0 --protocol udp --destination-port 53 -j ACCEPT<br />

iptables -A INPUT -i ppp0 --protocol tcp --source-port 53 -j ACCEPT<br />

iptables -A OUTPUT -o ppp0 --protocol tcp --destination-port 53 -j ACCEPT<br />

iptables -A INPUT -i ppp0 --protocol tcp --source-port 80 -m state --state ESTABLISHED<br />

iptables -A OUTPUT -o ppp0 --protocol tcp --destination-port 80 -m state --state<br />

NEW,ESTABLISHED<br />

iptables -t nat -A PREROUTING -d $IP -p tcp --dport 80 -j DNAT --to-destination<br />

192.168.1.10:8080<br />

The <strong>Hack</strong>ademy DMP -204/209- SYSDREAM

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!