07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The previous section lists available actions, but not their respective options. The LOG action,<br />

for instance, has the following options:<br />

• --log-priority, with default value warning, indicates the syslog message priority;<br />

• --log-prefix allows specifying a text prefix to differentiate between logged messages;<br />

• --log-tcp-sequence, --log-tcp-options and --log-ip-options indicate extra data to be integrated<br />

into the message: respectively, the TCP sequence number, TCP options, and IP<br />

options.<br />

The DNAT action (only available for IPv4) provides the --to-destination address:port option<br />

to indicate the new destination IP address and/or port. Similarly, SNAT provides --to-source<br />

address:port to indicate the new source IP address and/or port.<br />

The REDIRECT action (only available for IPv4) provides the --to-ports port(s) option to indicate<br />

the port, or port range, where the packets should be redirected.<br />

14.2.3. Creating Rules<br />

Each rule creation requires one invocation of iptables/ip6tables. Typing these commands<br />

manually can be tedious, so the calls are usually stored in a script so that the same configuration<br />

is set up automatically every time the machine boots. This script can be written by hand, but it<br />

can also be interesting to prepare it with a high-level tool such as fwbuilder.<br />

The principle is simple. In the first step, one needs to describe all the elements that will be<br />

involved in the actual rules:<br />

• the firewall itself, with its network interfaces;<br />

• the networks, with their corresponding IP ranges;<br />

• the servers;<br />

• the ports belonging to the services hosted on the servers.<br />

The rules are then created with simple drag-and-drop actions on the objects. A few contextual<br />

menus can change the condition (negating it, for instance). Then the action needs to be chosen<br />

and configured.<br />

As far as IPv6 is concerned, one can either create two distinct rulesets for IPv4 and IPv6, or<br />

create only one and let fwbuilder translate the rules according to the addresses assigned to<br />

the objects.<br />

380 The Debian Administrator's Handbook

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

Saved successfully!

Ooh no, something went wrong!