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.

The rules take the following values:<br />

INPUT Entering traffic<br />

OUTPUT Outgoing traffic<br />

FORWARD Will be used to carry out port forwarding<br />

The chains take the following values:<br />

MASQUERADE Will be used to carry out ip masquerading<br />

ACCEPT Accept the communication<br />

REJECT Forbid the communication and send a reject packet<br />

DROP Forbid the communication, but do not send any packet<br />

You can now create your own iptables configuration script. Here are a few examples. Beware, these<br />

are only simplistic examples, and in no way efficient filtering rules. We will see more efficient<br />

configurations in the following course.<br />

First <strong>of</strong> all, for the policy by default to be to forbid everything:<br />

iptables -P INPUT DROP<br />

iptables -P OUTPUT DROP<br />

iptables -P FORWARD DROP<br />

To authorize communications on the local network and on the interface lo:<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 />

To authorize outgoing dns requests:<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 />

To authorize the outgoing web navigation:<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 />

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

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

Saved successfully!

Ooh no, something went wrong!