optimize: dont store @unfold values in hashes
[ferm.git] / doc / ferm.pod
blob2d4e80dc0eed281de8bde748ebdadf8f5deab451
2 # ferm pod manual file
6 # ferm, a firewall setup program that makes firewall rules easy!
8 # Copyright (C) 2001-2007  Auke Kok, Max Kellermann
10 # Comments, questions, greetings and additions to this program
11 # may be sent to <ferm@foo-projects.org>
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30 =head1 NAME
32 B<ferm> - a firewall rule parser for linux
34 =head1 SYNOPSIS
36 B<ferm> I<options> I<inputfile>
38 =head1 DESCRIPTION
40 B<ferm> is a frontend for B<iptables>. It reads the rules from a
41 structured configuration file and calls iptables(8) to insert them
42 into the running kernel.
44 B<ferm>'s goal is to make firewall rules easy to write and easy to
45 read. It tries to reduce the tedious task of writing down rules, thus
46 enabling the firewall administrator to spend more time on developing
47 good rules than the proper implementation of the rule.
49 To achieve this, B<ferm> uses a simple but powerful configuration
50 language, which allows variables, functions, arrays, blocks. It also
51 allows you to include other files, allowing you to create libraries of
52 commonly used structures and functions.
54 B<ferm>, pronounced "firm", stands for "For Easy Rule Making".
57 =head1 CAUTION
59 This manual page does I<not> indend to teach you how firewalling works
60 and how to write good rules.  There is already enough documentation on
61 this topic.
64 =head1 INTRODUCTION
66 Let's start with a simple example:
68     chain INPUT {
69         proto tcp ACCEPT;
70     }
72 This will add a rule to the predefined input chain, matching and
73 accepting all tcp packets.  Ok, let's make it more complicated:
75     chain (INPUT OUTPUT) {
76         proto (udp tcp) ACCEPT;
77     }
79 This will insert 4 rules, namely 2 in chain input, and 2 in chain
80 output, matching and accepting both udp and tcp packets.  Normally you
81 would type this:
83    iptables -A INPUT -p tcp -j ACCEPT
84    iptables -A OUTPUT -p tcp -j ACCEPT
85    iptables -A INPUT -p udp -j ACCEPT
86    iptables -A OUTPUT -p udp -j ACCEPT
88 Note how much less typing we need to do? :-)
90 Basically, this is all there is to it, although you can make it quite
91 more complex. Something to look at:
93    chain INPUT {
94        policy ACCEPT;
95        daddr 10.0.0.0/8 proto tcp dport ! ftp jump mychain sport :1023 TOS 4 settos 8 mark 2;
96        daddr 10.0.0.0/8 proto tcp dport ftp REJECT;
97    }
99 My point here is, that *you* need to make nice rules, keep
100 them readable to you and others, and not make it into a mess.
102 It would aid the reader if the resulting firewall rules were placed
103 here for reference. Also, you could include the nested version with
104 better readability.
106 Try using comments to show what you are doing:
108     # this line enables transparent http-proxying for the internal network:
109     proto tcp if eth0 daddr ! 192.168.0.0/255.255.255.0
110         dport http REDIRECT 3128;
112 You will be thankful for it later!
114     chain INPUT {
115         policy ACCEPT;
116         interface (eth0 ppp0) {
117             # deny access to notorius hackers, return here if no match
118             # was found to resume normal firewalling
119             jump badguys;
121             protocol tcp jump fw_tcp;
122             protocol udp jump fw_udp;
123         }
124     }
126 The more you nest, the better it looks. Make sure the order you
127 specify is correct, you would not want to do this:
129     chain FORWARD {
130         proto ! udp DROP;
131         proto tcp dport ftp ACCEPT;
132     }
134 because the second rule will never match. Best way is to specify
135 first everyting that is allowed, and then deny everything else.
136 Look at the examples for more good snapshots. Most people do
137 something like this:
139     proto tcp {
140         dport (
141             ssh http ftp
142         ) ACCEPT;
143         dport 1024:65535 ! syn ACCEPT;
144         DROP;
145     }
147 =head1 STRUCTURE OF A FIREWALL FILE
149 The structure of a proper firewall file looks like  simplified
150 C-code. Only a few syntactic characters are used in ferm-
151 configuration files. Besides these special caracters, ferm
152 uses 'keys' and 'values', think of them as options and
153 parameters, or as variables and values, whatever.
155 With these words, you define the characteristics of your firewall.
156 Every firewall consists of two things: First, look if network
157 traffic matches certain conditions, and second, what to do
158 with that traffic.
160 You may specify conditions that are valid for the kernel
161 interface program you are using, probably iptables(8). For
162 instance, in iptables, when you are trying to match tcp
163 packets, you would say:
165     iptables --protocol tcp
167 In ferm, this will become:
169     protocol tcp;
171 Just typing this in ferm doesn't do anything, you need to tell
172 ferm (actually, you need to tell iptables(8) and the kernel) what
173 to do with any traffic that matches this condition:
175     iptables --protocol tcp -j ACCEPT
177 Or, translated to B<ferm>:
179     protocol tcp ACCEPT;
181 The B<;> character is at the end of every ferm rule. Ferm ignores line
182 breaks, meaning the above example is identical to the following:
184     protocol tcp
185       ACCEPT;
187 Here's a list of the special characters:
189 =over 8
191 =item B<;>
193 This character finalizes a rule.
195 Separated by semicolons, you may write multiple rules in one line,
196 although this decreases readability:
198     protocol tcp ACCEPT; protocol udp DROP;
200 =item B<{}>
202 The nesting symbol defines a 'block' of rules.
204 The curly brackets contain any number of nested rules. All matches
205 before the block are carried forward to these.
207 The closing curly bracket finalizes the rule set. You should not write
208 a ';' after that, because that would be an empty rule.
210 Example:
212     chain INPUT proto icmp {
213         icmp-type echo-request ACCEPT;
214         DROP;
215     }
217 This block shows two rules inside a block, which will both be merged
218 with anything in front of it, so you will get two rules:
220     iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
221     iptables -A INPUT -p icmp -j DROP
223 There can be multiple nesting levels:
225     chain INPUT {
226         proto icmp {
227             icmp-type echo-request ACCEPT;
228             DROP;
229         }
230         daddr 172.16.0.0/12 REJECT;
231     }
233 Note that the 'REJECT' rule is not affected by 'proto icmp', although
234 there is no ';' after the closing curly brace. Translated to iptables:
236     iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
237     iptables -A INPUT -p icmp -j DROP
238     iptables -A INPUT -d 172.16.0.0/12 -j REJECT
240 =item B<$>
242 Variable expansion. Replaces '$FOO' by the value of the variable. See
243 the section I<VARIABLES> for details.
245 =item B<&>
247 Function call. See the section I<FUNCTIONS> for details.
249 =item B<()>
251 The array symbol. Using the parentheses, you can define
252 a 'list' of values that should be applied for the key to the
253 left of it.
255 Example:
257     protocol ( tcp udp icmp )
259 this will result in three rules:
261     ... -p tcp ...
262     ... -p udp ...
263     ... -p icmp ...
265 Only values can be 'listed', so you cannot do something like this:
267     proto tcp ( ACCEPT LOG );
269 but you can do this:
271     chain (INPUT OUTPUT FORWARD) proto (icmp udp tcp) DROP;
273 (which will result in nine rules!)
275 Values are separated by spaces. The array symbol is both left- and
276 right-associative, in contrast with the nesting block, which is
277 left-associative only.
279 =item C< # >
281 The comment symbol. Anything that follows this symbol up to
282 the end of line is ignored.
284 =item C<`command`>
286 Execute the command in a shell, and insert the process output. See the
287 section I<backticks> for details.
289 =item C<'string'>
291 Quote a string which may contain whitespaces, the dollar sign etc.
293     LOG log-prefix ' hey, this is my log prefix!';
295 =item C<"string">
297 Quote a string (see above), but variable references with a dollar sign
298 are evaluated:
300     DNAT to "$myhost:$myport";
302 =back
305 =head2 Keywords
307 In the previous section, we already introduced some basic keywords
308 like "chain", "protocol" and "ACCEPT". Let's explore their nature.
310 There are three kinds of keywords:
312 =over 8
314 =item
316 B<location> keywords define where a rule will be created. Example:
317 "table", "chain".
319 =item
321 B<match> keywords perform a test on all passing packets. The current
322 rule is without effect if one (or more) of the matches does not
323 pass. Example: "proto", "daddr".
325 Most matches are followed by a parameter: "proto tcp", "daddr
326 172.16.0.0/12".
328 =item
330 B<target> keywords state what to do with a packet. Example: "ACCEPT",
331 "REJECT", "jump".
333 Some targets define more keywords to specify details: "REJECT
334 reject-with icmp-net-unreachable".
336 =back
338 Every rule consists of a B<location> and a B<target>, plus any number
339 of B<matches>:
341     table filter                  # location
342     proto tcp dport (http https)  # match
343     ACCEPT;                       # target
345 Strictly speaking, there is a fourth kind: B<ferm> keywords (which
346 control ferm's internal behaviour), but they will be explained later.
349 =head2 Parameters
351 Many keywords take parameters. These can be specified as literals,
352 variable references or lists (arrays):
354     proto udp
355     saddr %TRUSTED_HOSTS;
356     proto tcp dport (http https ssh);
357     LOG log-prefix "funky wardriver alert: ";
359 Some of them can be negated (lists cannot be negated):
361     proto !esp;
362     proto udp dport !domain;
364 Keywords which take no parameters are negated by a prefixed '!':
366     proto tcp !syn;
368 Read iptables(8) to see where the B<!> can be used.
371 =head1 BASIC KEYWORDS
374 =head2 Location keywords
376 =over 8
378 =item B<domain [ip|ip6]>
380 Set the domain. "ip" is default and means "IPv4" (iptables). "ip6" is
381 for IPv6 support, using "ip6tables".
383 =item B<table [filter|nat|mangle]>
385 Specifies which netfilter table this rule will be inserted to:
386 "filter" (default), "nat" or "mangle".
388 =item B<chain [chain-name]>
390 Specifies the netfilter chain (within the current table) this rule
391 will be inserted to. Common predefined chain names are "INPUT",
392 "OUTPUT", "FORWARD", "PREROUTING", "POSTROUTING", depending on the
393 table. See the netfilter documentation for details.
395 If you specify a non-existing chain here, ferm will add the rule to a
396 custom chain with that name.
398 =item B<policy [ACCEPT|DROP|..]>
400 Specifies the default policy for the current chain (built-in
401 only). Can be one of the built-in targets (ACCEPT, DROP, REJECT,
402 ...). A packet that matches no rules in a chain will be treated as
403 specified by the policy.
405 To avoid ambiguity, always specify the policies of all predefined
406 chains explicitly.
408 =item B<@subchain ["CHAIN-NAME"] { ... }>
410 Works like the normal block operators (i.e. without the I<@subchain>
411 keyword), except that B<ferm> moves rules within the curly braces into
412 a new custom chain. The name for this chain is chosen automatically by
413 ferm.
415 In many cases, this is faster than just a block, because the kernel
416 may skip a huge block of rules when a precondition is false. Imagine
417 the following example:
419  table filter chain INPUT {
420      saddr (1.2.3.4 2.3.4.5 3.4.5.6 4.5.6.7 5.6.7.8) {
421          proto tcp dport (http https ssh) ACCEPT;
422          proto udp dport domain ACCEPT;
423      }
426 This generates 20 rules. When a packet arrives which does not pass the
427 B<saddr> match, it nonetheless checks all 20 rules. With B<@subchain>,
428 this check is done once, resulting in faster network filtering and
429 less CPU load:
431  table filter chain INPUT {
432      saddr (1.2.3.4 2.3.4.5 3.4.5.6 4.5.6.7 5.6.7.8) @subchain {
433          proto tcp dport (http https ssh) ACCEPT;
434          proto udp dport domain ACCEPT;
435      }
438 Optionally, you may define the name of the sub chain:
440  saddr (1.2.3.4 2.3.4.5 3.4.5.6) @subchain "foobar" {
441      proto tcp dport (http https ssh) ACCEPT;
442      proto udp dport domain ACCEPT;
445 You can achieve the same by explicitly declaring a custom chain, but
446 you may feel that using B<@subchain> requires less typing.
449 =back
452 =head2 Basic iptables match keywords
454 =over 8
456 =item B<interface [interface-name]>
458 Define the interface name, your outside network card, like eth0,
459 or dialup like ppp1, or whatever device you want to match for
460 passing packets. It is equivalent to the C<-i> switch in
461 iptables(8).
463 =item B<outerface [interface-name]>
465 Same as interface, only for matching the outgoing interface
466 for a packet, as in iptables(8).
468 =item B<protocol [protocol-name|protocol-number]>
470 Currently supported by the kernel are tcp, udp and icmp, or
471 their respective numbers.
473 =item B<saddr|daddr [address-spec]>
475 Matches on packets originating from the specified address (saddr) or
476 targeted at the address (daddr).
478 Examples:
480     saddr 192.168/8 ACCEPT; # (identical to the next one:)
481     saddr 192.168.0.0/255.255.255.0 ACCEPT;
482     daddr my.domain.com ACCEPT;
484 =item B<fragment>
486 Specify that only fragmented IP packets should be matched.
487 When packets are larger that the maximum packet size your
488 system can handle (called Maximum Transmission Unit or MTU)
489 they will be chopped into bits and sent one by one as single
490 packets. See ifconfig(8) if you want to find the MTU for
491 your system (the default is usually 1500 bytes).
493 Fragments are frequently used in DOS attacks, because there
494 is no way of finding out the origin of a fragment packet.
496 =item B<sport|dport [port-spec]>
498 Matches on packets on the specified TCP or UDP port. "sport" matches
499 the source port, and dport matches the destination port.
501 This match can be used only after you specified "protocol tcp" or
502 "protocol udp", because only these two protocols actually have ports.
504 And some examples of valid ports/ranges:
506     dport 80 ACCEPT;
507     dport http ACCEPT;
508     dport ssh:http ACCEPT;
509     dport 0:1023 ACCEPT; # equivalent to :1023
510     dport 1023:65535 ACCEPT;
512 =item B<syn>
514 Specify that the SYN flag in a tcp package should be matched,
515 which are used to build new tcp connections. You can identify
516 incoming connections with this, and decide wether you want
517 to allow it or not. Packets that do not have this flag are
518 probably from an already established connection, so it's
519 considered reasonably safe to let these through.
521 =item B<module [module-name]>
523 Load an iptables module. Most modules provide more match
524 keywords. We'll get to that later.
526 =back
529 =head2 Basic target keywords
531 =over 8
533 =item B<jump [custom-chain-name]>
535 Jumps to a custom chain. If no rule in the custom chain matched,
536 netfilter returns to the next rule in the previous chain.
538 =item B<realgoto [custom-chain-name]>
540 Go to a custom chain.  Unlike the B<jump> option, B<RETURN> will not
541 continue processing in this chain but instead in the chain that called
542 us via B<jump>.
544 The keyword B<realgoto> was chosen during the transition period,
545 because B<goto> (already deprecated) used to be an alias for B<jump>.
547 =item B<ACCEPT>
549 Accepts matching packets.
551 =item B<DROP>
553 Drop matching packets without further notice.
555 =item B<REJECT>
557 Rejects matching packets, i.e. send an ICMP packet to the sender,
558 which is port-unreachable by default. You may specify another ICMP
559 type.
561     REJECT; # default to icmp-port-unreachable
562     REJECT reject-with icmp-net-unreachable;
564 Type "iptables -j REJECT -h" for details.
566 =item B<RETURN>
568 Finish the current chain and return to the calling chain (if "jump
569 [custom-chain-name]" was used).
571 =item B<NOP>
573 No action at all.
575 =back
578 =head1 ADDITIONAL KEYWORDS
580 Netfilter is modular. Modules may provide additional targets and match
581 keywords. The list of netfilter modules is constantly growing, and
582 ferm tries to keep up with supporting them all. This chapter describes
583 modules which are currently supported.
586 =head2 iptables match modules
588 =over 8
590 =item B<account>
592 Account traffic for all hosts in defined network/netmask.  This is one
593 of the match modules which behave like a target, i.e. you will mostly
594 have to use the B<NOP> target.
596     mod account aname mynetwork aaddr 192.168.1.0/24 ashort NOP;
598 =item B<addrtype>
600 Check the address type; either source address or destination address.
602     mod addrtype src-type BROADCAST;
603     mod addrtype dst-type LOCAL;
605 Type "iptables -m addrtype -h" for details.
607 =item B<ah>
609 Checks the SPI header in an AH packet.
611     mod ah ahspi 0x101;
612     mod ah ahspi ! 0x200:0x2ff;
614 Additional arguments for IPv6:
616     mod ah ahlen 32 ACCEPT;
617     mod ah ahlen !32 ACCEPT;
618     mod ah ahres ACCEPT;
620 =item B<comment>
622 Adds a comment of up to 256 characters to a rule, without an effect.
623 Note that unlike ferm comments ('#'), this one will show up in
624 "iptables -L".
626     mod comment comment "This is my comment." ACCEPT;
628 =item B<condition>
630 Matches if a value in /proc/net/ipt_condition/NAME is 1 (path is
631 /proc/net/ip6t_condition/NAME for the ip6 domain).
633     mod condition condition (abc def) ACCEPT;
634     mod condition condition !foo ACCEPT;
636 =item B<connbytes>
638 Match by how many bytes or packets a connection (or one of the two
639 flows constituting the connection) have tranferred so far, or by
640 average bytes per packet.
642     mod connbytes connbytes 65536: connbytes-dir both connbytes-mode bytes ACCEPT;
643     mod connbytes connbytes !1024:2048 connbytes-dir reply connbytes-mode packets ACCEPT;
645 Valid values for I<connbytes-dir>: I<original>, I<reply>, I<both>; for
646 I<connbytes-mode>: I<packets>, I<bytes>, I<avgpkt>.
648 =item B<connlimit>
650 Allows you to restrict the number of parallel TCP connections to a
651 server per client IP address (or address block).
653     mod connlimit connlimit-above 4 REJECT;
654     mod connlimit connlimit-above !4 ACCEPT;
655     mod connlimit connlimit-above 4 connlimit-mask 24 REJECT;
657 =item B<connmark>
659 Check the mark field associated with the connection, set by the
660 CONNMARK target.
662     mod connmark mark 64;
663     mod connmark mark 6/7;
665 =item B<conntrack>
667 Check connection tracking information.
669     mod conntrack ctstate (ESTABLISHED RELATED);
670     mod conntrack ctproto tcp;
671     mod conntrack ctorigsrc 192.168.0.2;
672     mod conntrack ctorigdst 1.2.3.0/24;
673     mod conntrack ctreplsrc 2.3.4.5;
674     mod conntrack ctrepldst ! 3.4.5.6;
675     mod conntrack ctstatus ASSURED;
676     mod conntrack ctexpire 60;
677     mod conntrack ctexpire 180:240;
679 Type "iptables -m conntrack -h" for details.
681 =item B<dccp>
683 Check DCCP (Datagram Congestion Control Protocol) specific attributes.
684 This module is automatically loaded when you use "protocol dccp".
686     proto dccp sport 1234 dport 2345 ACCEPT;
687     proto dccp dccp-types (SYNCACK ACK) ACCEPT;
688     proto dccp dccp-types !REQUEST DROP;
689     proto dccp dccp-option 2 ACCEPT;
691 =item B<dscp>
693 Match the 6 bit DSCP field within the TOS field.
695     mod dscp dscp 11;
696     mod dscp dscp-class AF41;
698 =item B<dst>
700 Matches the Destination Options header (ip6).
702     mod dst dst-len 8 ACCEPT;
703     mod dst dst-len !8 ACCEPT;
704     mod dst dst-opts (1:4 2:8) ACCEPT;
706 =item B<ecn>
708 Match the ECN bits of an IPv4 TCP header.
710     mod ecn ecn-tcp-cwr;
711     mod ecn ecn-tcp-ece;
712     mod ecn ecn-ip-ect 2;
714 Type "iptables -m ecn -h" for details.
716 =item B<esp>
718 Checks the SPI header in an ESP packet.
720     mod esp espspi 0x101;
721     mod esp espspi ! 0x200:0x2ff;
723 =item B<eui64>
725 "This module matches the EUI-64 part of a stateless autoconfigured
726 IPv6 address.  It compares the EUI-64 derived from the source MAC
727 address in Ehternet frame with the lower 64 bits of the IPv6 source
728 address.  But "Universal/Local" bit is not compared.  This module
729 doesn't match other link layer frame, and is only valid in the
730 PREROUTING, INPUT and FORWARD chains."
732     mod eui64 ACCEPT;
734 =item B<frag>
736 Matches the Fragment header (ip6).
738     mod frag fragid 123:456 ACCEPT;
739     mod frag fragid !123:456 ACCEPT;
740     mod frag fragres ACCEPT;
741     mod frag fragfirst ACCEPT;
742     mod frag fragmore ACCEPT;
743     mod frag fraglast ACCEPT;
745 =item B<fuzzy>
747 "This module matches a rate limit based on a fuzzy logic controller [FLC]."
749     mod fuzzy lower-limit 10 upper-limit 20 ACCEPT;
751 =item B<hbh>
753 Matches the Hop-by-Hop Options header (ip6).
755     mod hbh hbh-len 8 ACCEPT;
756     mod hbh hbh-len !8 ACCEPT;
757     mod hbh hbh-opts (1:4 2:8) ACCEPT;
759 =item B<hl>
761 Matches the Hop Limit field (ip6).
763     mod hl hl-eq (8 10) ACCEPT;
764     mod hl hl-eq !5 ACCEPT;
765     mod hl hl-gt 15 ACCEPT;
766     mod hl hl-lt 2 ACCEPT;
768 =item B<helper>
770 Checks which conntrack helper module tracks this connection.  The port
771 may be specified with "-portnr".
773     mod helper helper irc ACCEPT;
774     mod helper helper ftp-21 ACCEPT;
776 =item B<icmp>
778 Check ICMP specific attributes.  This module is automatically loaded
779 when you use "protocol icmp".
781     proto icmp icmp-type echo-request ACCEPT;
783 This option can also be used in be I<ip6> domain, although this is
784 called B<icmpv6> in F<ip6tables>.
786 Use "iptables -p icmp C<-h>" to obtain a list of valid ICMP types.
788 =item B<iprange>
790 Match a range of IPv4 addresses.
792     mod iprange src-range 192.168.2.0-192.168.3.255;
793     mod iprange dst-range ! 192.168.6.0-192.168.6.255;
795 =item B<ipv6header>
797 Matches the IPv6 extension header (ip6).
799     mod ipv6header header !(hop frag) ACCEPT;
800     mod ipv6header header (auth dst) ACCEPT;
802 =item B<hashlimit>
804 Similar to 'mod limit', but adds the ability to add per-destination or
805 per-port limits managed in a hash table.
807     mod hashlimit  hashlimit 10/minute  hashlimit-burst 30/minute
808       hashlimit-mode dstip  hashlimit-name foobar  ACCEPT;
810 Possible values for hashlimit-mode: dstip dstport srcip srcport.
812 There are more possible settings, type "iptables -m hashlimit -h" for
813 documentation.
815 =item B<length>
817 Check the package length.
819     mod length length 128; # exactly 128 bytes
820     mod length length 512:768; # range
821     mod length length ! 256; # negated
823 =item B<limit>
825 Limits the packet rate.
827     mod limit limit 1/second;
828     mod limit limit 15/minute limit-burst 10;
830 Type "iptables -m limit -h" for details.
832 =item B<mac>
834 Match the source MAC address.
836     mod mac mac-source 01:23:45:67:89;
838 =item B<mark>
840 Matches packets based on their netfilter mark field. This may be a 32
841 bit integer between 0 and 4294967295.
843     mod mark mark 42;
845 =item B<mh>
847 Matches the mobility header (domain I<ip6>).
849     proto mh mh-type binding-update ACCEPT;
851 =item B<multiport>
853 Match a set of source or destination ports (UDP and TCP only).
855     mod multiport source-ports (https ftp);
856     mod multiport destination-ports (mysql domain);
858 This rule has a big advantage over "dport" and "sport": it generates
859 only one rule for up to 15 ports instead of one rule for every port.
861 =item B<nth>
863 Match every 'n'th packet.
865     mod nth every 3;
866     mod nth counter 5 every 2;
867     mod nth start 2 every 3;
868     mod nth start 5 packet 2 every 6;
870 Type "iptables -m nth -h" for details.
872 =item B<owner>
874 Check information about the packet creator, namely user id, group id,
875 process id, session id and command name.
877     mod owner uid-owner 0;
878     mod owner gid-owner 1000;
879     mod owner pid-owner 5432;
880     mod owner sid-owner 6543;
881     mod owner cmd-owner "sendmail";
883 =item B<physdev>
885 Matches the physical device on which a packet entered or is about to
886 leave the machine. This is useful for bridged interfaces.
888     mod physdev physdev-in ppp1;
889     mod physdev physdev-out eth2;
890     mod physdev physdev-is-in;
891     mod physdev physdev-is-out;
892     mod physdev physdev-is-bridged;
894 =item B<pkttype>
896 Check the link-layer packet type.
898     mod pkttype pkt-type unicast;
899     mod pkttype pkt-type broadcase;
900     mod pkttype pkt-type multicast;
902 =item B<policy>
904 Matches IPsec policy being applied to this packet.
906     mod policy dir out pol ipsec ACCEPT;
907     mod policy strict reqid 23 spi 0x10 proto ah ACCEPT;
908     mod policy mode tunnel tunnel-src 192.168.1.2 ACCEPT;
909     mod policy mode tunnel tunnel-dst 192.168.2.1 ACCEPT;
910     mod policy strict next reqid 24 spi 0x11 ACCEPT;
912 =item B<psd>
914 Detect TCP/UDP port scans.
916     mod psd psd-weight-threshold 21 psd-delay-threshold 300
917       psd-lo-ports-weight 3 psd-hi-ports-weight 1 DROP;
919 =item B<quota>
921 Implements network quotas by decrementing a byte counter with each packet.
923     mod quota quota 65536 ACCEPT;
925 =item B<random>
927 Match a random percentage of all packets.
929     mod random average 70;
931 =item B<realm>
933 Match the routing realm. Useful in environments using BGP.
935     mod realm realm 3;
937 =item B<recent>
939 Temporarily mark source IP addresses.
941     mod recent set;
942     mod recent rcheck seconds 60;
943     mod recent set rsource name "badguy";
944     mod recent set rdest;
945     mod recent rcheck rsource name "badguy" seconds 60;
946     mod recent update seconds 120 hitcount 3 rttl;
948 This netfilter module has a design flaw: although it is implemented as
949 a match module, it has target-like behaviour when using the "set"
950 keyword.
952 L<http://snowman.net/projects/ipt_recent/>
954 =item B<rt>
956 Match the IPv6 routing header (ip6 only).
958     mod rt rt-type 2 rt-len 20 ACCEPT;
959     mod rt rt-type !2 rt-len !20 ACCEPT;
960     mod rt rt-segsleft 2:3 ACCEPT;
961     mod rt rt-segsleft !4:5 ACCEPT;
962     mod rt rt-0-res rt-0-addrs (::1 ::2) rt-0-not-strict ACCEPT;
964 =item B<sctp>
966 Check SCTP (Stream Control Transmission Protocol) specific attributes.
967 This module is automatically loaded when you use "protocol sctp".
969     proto sctp sport 1234 dport 2345 ACCEPT;
970     proto sctp chunk-types only DATA:Be ACCEPT;
971     proto sctp chunk-types any (INIT INIT_ACK) ACCEPT;
972     proto sctp chunk-types !all (HEARTBEAT) ACCEPT;
974 Use "iptables -p sctp C<-h>" to obtain a list of valid chunk types.
976 =item B<set>
978 Checks the source or destination IP/Port/MAC against a set.
980     mod set set badguys src DROP;
982 See L<http://ipset.netfilter.org/> for more information.
984 =item B<state>
986 Checks the connection tracking state.
988     mod state state INVALID DROP;
989     mod state state (ESTABLISHED RELATED) ACCEPT;
991 Type "iptables -m state -h" for details.
993 =item B<statistic>
995 Successor of B<nth> and B<random>, currently undocumented in the
996 iptables(8) man page.
998     mod statistic mode random probability 0.8 ACCEPT;
999     mod statistic mode nth every 5 packet 0 DROP;
1001 =item B<tcp>
1003 Checks TCP specific attributes. This module is automatically loaded
1004 when you use "protocol tcp".
1006     proto tcp sport 1234;
1007     proto tcp dport 2345;
1008     proto tcp tcp-flags (SYN ACK) SYN;
1009     proto tcp tcp-flags ! (SYN ACK) SYN;
1010     proto tcp tcp-flags ALL (RST ACK);
1011     proto tcp syn;
1012     proto tcp tcp-option 2;
1013     proto tcp mss 512;
1015 Type "iptables -p tcp -h" for details.
1017 =item B<tcpmss>
1019 Check the TCP MSS field of a SYN or SYN/ACK packet.
1021     mod tcpmss mss 123 ACCEPT;
1022     mod tcpmss mss 234:567 ACCEPT;
1024 =item B<time>
1026 Check if the time a packet arrives is in given range.
1028     mod time timestart 12:00;
1029     mod time timestop 13:30;
1030     mod time days (Mon Wed Fri);
1031     mod time datestart 2005:01:01;
1032     mod time datestart 2005:01:01:23:59:59;
1033     mod time datestop 2005:04:01;
1035 Type "iptables -m time -h" for details.
1037 =item B<tos>
1039 Matches a packet on the specified TOS-value.
1041     mod tos tos Minimize-Cost ACCEPT;
1042     mod tos tos !Normal-Service ACCEPT;
1044 Type "iptables -m tos -h" for details.
1046 =item B<ttl>
1048 Matches the ttl (time to live) field in the IP header.
1050     mod ttl ttl-eq 12; # ttl equals
1051     mod ttl ttl-gt 10; # ttl greater than
1052     mod ttl ttl-lt 16; # ttl less than
1054 =item B<u32>
1056 Compares raw data from the packet.  You can specify more than one
1057 filter in a ferm list; these are not expanded into multiple rules.
1059     mod u32 u32 '6&0xFF=1' ACCEPT;
1060     mod u32 u32 ('27&0x8f=7' '31=0x527c4833') DROP;
1062 =item B<unclean>
1064 Matches packets which seem malformed or unusual. This match has no
1065 further parameters.
1067 =back
1070 =head2 iptables target modules
1072 The following additional targets are available in ferm, provided that
1073 you enabled them in your kernel:
1075 =over 8
1077 =item B<CONNMARK>
1079 Sets the netfilter mark value associated with a connection.
1081     CONNMARK set-mark 42;
1082     CONNMARK save-mark;
1083     CONNMARK restore-mark;
1084     CONNMARK save-mark mask 0x7fff;
1085     CONNMARK restore-mark mask 0x8000;
1087 =item B<CONNSECMARK>
1089 This module copies security markings from packets to connections (if
1090 unlabeled), and from connections back to packets (also only if
1091 unlabeled).  Typically used in conjunction with SECMARK, it is only
1092 valid in the mangle table.
1094     CONNSECMARK save;
1095     CONNSECMARK restore;
1097 =item B<DNAT to [ip-address|ip-range|ip-port-range]>
1099 Change the destination address of the packet.
1101     DNAT to 10.0.0.4;
1102     DNAT to 10.0.0.4:80;
1103     DNAT to 10.0.0.4:1024-2048;
1104     DNAT to 10.0.1.1-10.0.1.20;
1106 =item B<ECN>
1108 This target allows to selectively work around known ECN blackholes.
1109 It can only be used in the mangle table.
1111     ECN ecn-tcp-remove;
1113 =item B<HL>
1115 Modify the IPv6 Hop Limit field (ip6/mangle only).
1117     HL hl-set 5;
1118     HL hl-dec 2;
1119     HL hl-inc 1;
1121 =item B<LOG>
1123 Log all packets that match this rule in the kernel log. Be carefull
1124 with log flooding. Note that this is a "non-terminating target",
1125 i.e. rule traversal continues at the next rule.
1127     LOG log-level warning log-prefix "Look at this: ";
1128     LOG log-tcp-sequence log-tcp-options;
1129     LOG log-ip-options;
1131 =item B<MARK>
1133 Sets the netfilter mark field for the packet (a 32 bit integer between
1134 0 and 4294967295):
1136     MARK set-mark 42;
1138 =item B<MASQUERADE>
1140 Masquerades matching packets. Optionally followed by a port or
1141 port-range for iptables. Specify as "123", "123-456" or "123:456".
1142 The port range parameter specifies what local ports masqueraded
1143 connections should originate from.
1145     MASQUERADE;
1146     MASQUERADE to-ports 1234:2345;
1148 =item B<MIRROR>
1150 Experimental demonstration target which inverts the source and
1151 destination fields in the IP header.
1153     MIRROR;
1155 =item B<NETMAP>
1157 Map a whole network onto another network in the B<nat> table.
1159     NETMAP to 192.168.2.0/24;
1161 =item B<NOTRACK>
1163 Disable connection tracking for all packets matching that rule.
1165     proto tcp dport (135:139 445) NOTRACK;
1167 =item B<NFLOG>
1169 Log packets over netlink; this is the successor of I<ULOG>.
1171     NFLOG nflog-group 5 nflog-prefix "Look at this: ";
1172     NFLOG nflog-range 256;
1173     NFLOG nflog-threshold 10;
1175 =item B<NFQUEUE>
1177 Userspace queueing, requires nfnetlink_queue kernel support.
1179     proto tcp dport ftp NFQUEUE queue-num 20;
1181 =item B<QUEUE>
1183 Userspace queueing, the predecessor to B<NFQUEUE>.  All packets go to
1184 queue 0.
1186     proto tcp dport ftp QUEUE;
1188 =item B<REDIRECT to-ports [ports]>
1190 Transparent proxying: alter the destination IP of the packet to the
1191 machine itself.
1193     proto tcp dport http REDIRECT to-ports 3128;
1195 =item B<SECMARK>
1197 This is used to set the security mark value associated with the packet
1198 for use by security subsystems such as SELinux.  It is only valid in
1199 the mangle table.
1201     SECMARK selctx "system_u:object_r:httpd_packet_t:s0";
1203 =item B<SET [add-set|del-set] [setname] [flag(s)]>
1205 Add the IP to the specified set. See L<http://ipset.netfilter.org/>
1207     proto icmp icmp-type echo-request SET add-set badguys src;
1209 =item B<SNAT to [ip-address|ip-range|ip-port-range]>
1211 Change the source address of the packet.
1213     SNAT to 1.2.3.4;
1214     SNAT to 1.2.3.4:20000-30000;
1216 =item B<TCPMSS>
1218 Alter the MSS value of TCP SYN packets.
1220     TCPMSS set-mss 1400;
1221     TCPMSS clamp-mss-to-pmtu;
1223 =item B<TOS set-tos [value]>
1225 Set the tcp package Type Of Service bit to this value.  This will be
1226 used by whatever traffic scheduler is willing to, mostly your own
1227 linux-machine, but maybe more. The original tos-bits are blanked and
1228 overwritten by this value.
1230     TOS set-tos Maximize-Throughput;
1232 Type "iptables -j TOS -h" for details.
1234 =item B<TTL>
1236 Modify the TTL header field.
1238     TTL ttl-set 16;
1239     TTL ttl-dec 1; # decrease by 1
1240     TTL ttl-inc 4; # increase by 4
1242 =item B<ULOG>
1244 Log packets to a userspace program.
1246     ULOG ulog-nlgroup 5 ulog-prefix "Look at this: ";
1247     ULOG ulog-cprange 256;
1248     ULOG ulog-qthreshold 10;
1250 =back
1252 =head1 OTHER DOMAINS
1254 Since verison 2.0, B<ferm> supports not only I<ip> and I<ip6>, but
1255 also I<arp> (ARP tables) and I<eb> (ethernet bridging tables).  The
1256 concepts are similar to I<iptables>.
1258 =head2 arptables keywords
1260 =over 8
1262 =item B<source-ip>, B<destination-ip>
1264 Matches the source or destination IPv4 address.  Same as B<saddr> and
1265 B<daddr> in the I<ip> domain.
1267 =item B<source-mac>, B<destination-mac>
1269 Matches the source or destination MAC address.
1271 =item B<interface>, B<outerface>
1273 Input and output interface.
1275 =item B<h-length>
1277 Hardware length of the packet.
1279     chain INPUT h-length 64 ACCEPT;
1281 =item B<opcode>
1283 Operation code, for details see the iptables(8).
1285     opcode 9 ACCEPT;
1287 =item B<h-type>
1289 Hardware type.
1291     h-type 1 ACCEPT;
1293 =item B<proto-type>
1295 Protocol type.
1297     proto-type 0x800 ACCEPT;
1299 =item B<Mangling>
1301 The keywords B<mangle-ip-s>, B<mangle-ip-d>, B<mangle-mac-s>,
1302 B<mangle-mac-d>, B<mangle-target> may be used for ARP mangling.  See
1303 iptables(8) for details.
1305 =back
1307 =head2 ebtables keywords
1309 =over 8
1311 =item B<proto>
1313 Matches the protocol which created the frame, e.g. I<IPv4> or B<PPP>.
1314 For a list, see F</etc/ethertypes>.
1316 =item B<interface>, B<outerface>
1318 Physical input and output interface.
1320 =item B<logical-in>, B<logical-out>
1322 The logical bridge interface.
1324 =item B<saddr>, B<daddr>
1326 Matches source or destination MAC address.
1328 =back
1330 =head1 ADVANCED FEATURES
1332 =head2 Variables
1334 In complex firewall files, it is helpful to use variables, e.g. to
1335 give a network interface a meaningful name.
1337 To set variables, write:
1339     @def $DEV_INTERNET = eth0;
1340     @def $PORTS = (http ftp);
1341     @def $MORE_PORTS = ($PORTS 8080);
1343 In the real ferm code, variables are used like any other keyword
1344 parameter:
1346     chain INPUT interface $DEV_INTERNET proto tcp dport $MORE_PORTS ACCEPT;
1348 Note that variables can only be used in keyword parameters
1349 ("192.168.1.1", "http"); they cannot contain ferm keywords like
1350 "proto" or "interface".
1352 Variables are only valid in the current block:
1354     @def $DEV_INTERNET = eth1;
1355     chain INPUT {
1356         proto tcp {
1357             @def $DEV_INTERNET = ppp0;
1358             interface $DEV_INTERNET dport http ACCEPT;
1359         }
1360         interface $DEV_INTERNET DROP;
1361     }
1363 will be expanded to:
1365     chain INPUT {
1366         proto tcp {
1367             interface ppp0 dport http ACCEPT;
1368         }
1369         interface eth1 DROP;
1370     }
1372 The "def $DEV_INTERNET = ppp0" is only valid in the "proto tcp" block;
1373 the parent block still knows "set $DEV_INTERNET = eth1".
1375 Include files are special - variables declared in an included file are
1376 still available in the calling block. This is useful when you include
1377 a file which only declares variables.
1379 =head2 Automatic variables
1381 Some variables are set internally by ferm. Ferm scripts can use them
1382 just like any other variable.
1384 =over 8
1386 =item B<$DOMAIN>
1388 The current domain.  One of I<ip>, I<ip6>, I<arp>, I<eb>.
1390 =item B<$TABLE>
1392 The current netfilter table.
1394 =item B<$CHAIN>
1396 The current netfilter chain.
1398 =back
1400 =head2 Functions
1402 Functions are similar to variables, except that they may have
1403 parameters, and they provide ferm commands, not values.
1405     @def &FOO() = proto (tcp udp) dport domain;
1406     &FOO() ACCEPT;
1408     @def &TCP_TUNNEL($port, $dest) = {
1409         table filter chain FORWARD interface ppp0 proto tcp dport $port daddr $dest outerface eth0 ACCEPT;
1410         table nat chain PREROUTING interface ppp0 proto tcp dport $port daddr 1.2.3.4 DNAT to $dest;
1411     }
1413     &TCP_TUNNEL(http, 192.168.1.33);
1414     &TCP_TUNNEL(ftp, 192.168.1.30);
1415     &TCP_TUNNEL((ssh smtp), 192.168.1.2);
1417 A function call which contains a block (like '{...}') must be the last
1418 command in a ferm rule, i.e. it must be followed by ';'. The '&FOO()'
1419 example does not contain a block, thus you may write 'ACCEPT' after
1420 the call. To circumvent this, you can reorder the keywords:
1422     @def &IPSEC() = { proto (esp ah); proto udp dport 500; }
1423     chain INPUT ACCEPT &IPSEC();
1425 =head2 Backticks
1427 With backticks, you may use the output of an external command:
1429     @def $DNSSERVERS = `grep nameserver /etc/resolv.conf | awk '{print $2}'`;
1430     chain INPUT proto tcp saddr $DNSSERVERS ACCEPT;
1432 The command is executed with the shell (F</bin/sh>), just like
1433 backticks in perl.  ferm does not do any variable expansion here.
1435 The output is then tokenized, and saved as a ferm list (array). Lines
1436 beginning with '#' are ignored; the other lines may contain any number
1437 of values, separated by whitespace.
1439 =head2 Includes
1441 The B<@include> keyword allows you to include external files:
1443     @include 'vars.ferm';
1445 The file name is relative to the calling file, e.g. when including
1446 from F</etc/ferm/ferm.conf>, the above statement includes
1447 F</etc/ferm/vars.ferm>. Variables and functions declared in an
1448 included file are still available in the calling file.
1450 B<include> works within a block:
1452     chain INPUT {
1453         @include 'input.ferm';
1454     }
1456 If you specify a directory (with a trailing '/'), all files in this
1457 directory are included, sorted alphabetically:
1459     @include 'ferm.d/';
1461 =head2 Conditionals
1463 The keyword B<@if> introduces a conditional expression:
1465     @if $condition DROP;
1467 A value is evaluated true just like in Perl: zero, empty list, empty
1468 string are false, everything else is true.  Examples for true values:
1470     (a b); 1; 'foo'; (0 0)
1472 Examples for false values:
1474     (); 0; '0'; ''
1476 There is also B<@else>:
1478     @if $condition DROP; @else REJECT;
1480 Note the semicolon before the B<@else>.
1482 It is possible to use curly braces after either B<@if> or B<@else>:
1484     @if $condition {
1485         MARK set-mark 2;
1486         RETURN;
1487     } @else {
1488         MARK set-mark 3;
1489     }
1491 Since the closing curly brace also finishes the command, there is no
1492 need for semicolon.
1494 There is no B<@elsif>, use B<@else @if> instead.
1496 =head2 Hooks
1498 To run custom commands, you may install hooks:
1500     hook pre "echo 0 >/proc/sys/net/ipv4/conf/eth0/forwarding";
1501     hook post "echo 1 >/proc/sys/net/ipv4/conf/eth0/forwarding";
1503 The specified command is executed using the shell.  "pre" means run
1504 the command before applying the firewall rules, and "post" means run
1505 the command afterwards.  You may install any number of hooks.
1507 =head1 FUNCTIONS
1509 There are several built-in functions which you might find useful.
1511 =head2 @resolve((hostname1 hostname2 ...))
1513 Usually, host names are resolved by iptables.  To let ferm resolve
1514 host names, use the function @resolve:
1516     saddr @resolve(my.host.foo) proto tcp dport ssh ACCEPT;
1517     saddr @resolve((another.host.foo third.host.foo)) proto tcp dport openvpn ACCEPT;
1519 Note the double parentheses in the second line: the inner pair for
1520 creating a ferm list, and the outer pair as function parameter
1521 delimiters.
1523 This function currently only resolves B<A> records (i.e. IPv4
1524 addresses), rendering it useless for the I<ip6> domain.
1526 Be careful with resolved host names in firewall configuration.  DNS
1527 requests may block the firewall configuration for a long time, leaving
1528 the machine vulnerable, or they may fail.
1530 =head1 RECIPES
1532 The F<./examples/> directory contains numerous ferm configuration
1533 which can be used to begin a new firewall. This sections contains more
1534 samples, recipes and tricks.
1536 =head2 Easy port forwarding
1538 Ferm function make routine tasks quick and easy:
1540     @def &FORWARD_TCP($proto, $port, $dest) = {
1541         table filter chain FORWARD interface $DEV_WORLD outerface $DEV_DMZ daddr $dest proto $proto dport $port ACCEPT;
1542         table nat chain PREROUTING interface $DEV_WORLD daddr $HOST_STATIC proto $proto dport $port DNAT to $dest;
1543     }
1545     &FORWARD_TCP(tcp, http, 192.168.1.2);
1546     &FORWARD_TCP(tcp, smtp, 192.168.1.3);
1547     &FORWARD_TCP((tcp udp), domain, 192.168.1.4);
1549 =head2 Remote B<ferm>
1551 If the target machine is not able to run B<ferm> for some reason
1552 (maybe an embedded device without Perl), you can edit the B<ferm>
1553 configuration file on another computer and let B<ferm> generate a
1554 shell script there.
1556 Example for OpenWRT:
1558     ferm --remote --shell mywrt/ferm.conf >mywrt/firewall.user
1559     chmod +x mywrt/firewall.user
1560     scp mywrt/firewall.user mywrt.local.net:/etc/
1561     ssh mywrt.local.net /etc/firewall.user
1563 =head1 TRANSITION FROM FERM 1.1
1565 ferm 1.2 aims to be 100% compatible with ferm 1.1, i.e. old
1566 configuration files should work as expected.  For a "clean" ferm 1.2
1567 configuration without warnings, here is a list of the most important
1568 changes:
1570 =over 8
1572 =item I<ipfwadm and ipchains>
1574 Support for these has been removed.
1576 =item I<options B<clearall>, B<flushall>, B<flushchains>, B<createchains>>
1578 All these options are always implied.  There is no option anymore to
1579 disable them.
1581 =item I<option automod>
1583 Automatic module loading is deprecated.  It still works for now, at
1584 least for modules which were already supported by ferm 1.1, but it is
1585 expected to be removed in ferm 1.3.
1587 =item I<option location>
1589 ferm assumes that the iptables utilities are always installed in
1590 /sbin.
1592 =item I<Chain policies>
1594 Chain policies should be written in a dedicated statement; ferm 1.1:
1596  chain INPUT policy DROP {
1597    # ...
1600 ferm 1.2:
1602  chain INPUT {
1603    policy DROP;
1604    # ...
1607 =item I<Variables>
1609 The concept of variables has been overhauled in ferm 1.2; you can now
1610 declare functions which take parameters.  Besides that, you should use
1611 the new syntax:
1613  @def $FOO = (http ssh);
1614  chain INPUT proto tcp dport $FOO ACCEPT;
1616 =item I<Arrays>
1618 Arrays used to be specified with commas separating the items.  In ferm
1619 1.2, you separate array items only by whitespace.
1621 =item I<Misc syntax changes>
1623 Other small syntax changes:
1625 =over
1627 =item *
1629 built-in target names must be upper case; chains are lower case
1631 =item *
1633 MASQUERADE, not MASQ
1635 =item *
1637 A lot of shortcuts are deprecated, since they are polluting the namespace, e.g. "mac", "tosrc".
1639 =item *
1641 "source addr $A port $B" is deprecated, use "sdaddr $A sport $B"
1642 instead.  The same for "destination".
1644 =back
1646 =back
1648 =head1 OPTIONS
1650 =over 12
1652 =item B<--noexec>
1654 Do not execute the iptables(8) commands, but skip instead. This way
1655 you can parse your data, use B<--lines> to view the output.
1657 =item B<--flush>
1659 Clears the firewall rules and sets the policy of all chains to ACCEPT.
1660 B<ferm> needs a configuration file for that to determine which domains
1661 and tables are affected.
1663 =item B<--lines>
1665 Show the firewall lines that were generated from the rules. They
1666 will be shown just before they are executed, so if you get error
1667 messages from iptables(8) etc., you can see which rule caused
1668 the error.
1670 =item B<--interactive>
1672 Apply the firewall rules and ask the user for confirmation.  Reverts
1673 to the previous ruleset if there is no valid user response within 30
1674 seconds.  This is useful for remote firewall administration: you can
1675 test the rules without fearing to lock yourself out.
1677 =item B<--help>
1679 Show a brief list of available commandline options.
1681 =item B<--version>
1683 Shows the version number of the program.
1685 =item B<--fast>
1687 Enable fast mode: ferm generates an iptables-save(8) file, and
1688 installs it with iptables-restore(8). This is much faster, because
1689 ferm calls iptables(8) once for every rule by default.
1691 Watch out for iptables versions older than 1.3, they might not work
1692 with this option due to quoting bugs.
1694 =item B<--shell>
1696 Generate a shell script which calls iptables-restore(8) and prints it.
1697 Implies --fast --lines.
1699 =item B<--remote>
1701 Generate rules for a remote machine.  Implies B<--noexec> and
1702 B<--lines>.  Can be combined with B<--shell>.
1704 =item B<--domain {ip|ip6}>
1706 Handle only the specified domain. B<ferm> output may be empty if the
1707 domain is not configured in the input file.
1709 =item B<--def '$name=value'>
1711 Override a variable defined in the configuration file.
1713 =back
1716 =head1 SEE ALSO
1718 iptables(8)
1721 =head1 REQUIREMENTS
1723 =head2 Operating system
1725 Linux 2.4 or newer, with netfilter support and all netfilter modules
1726 used by your firewall script
1728 =head2 Software
1730 iptables and perl 5.6
1732 =head1 BUGS
1734 Bugs? What bugs?
1736 If you find a bug, please tell us: ferm@foo-projects.org
1738 =head1 COPYRIGHT
1740 Copyright (C) 2001-2007 Auke Kok <sofar@foo-projects.org>, Max
1741 Kellermann <max@foo-projects.org>
1743 This program is free software; you can redistribute it and/or modify
1744 it under the terms of the GNU General Public License as published by
1745 the Free Software Foundation; either version 2 of the License, or (at
1746 your option) any later version.
1748 This program is distributed in the hope that it will be useful, but
1749 WITHOUT ANY WARRANTY; without even the implied warranty of
1750 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1751 General Public License for more details.
1753 You should have received a copy of the GNU General Public License
1754 along with this program; if not, write to the Free Software
1755 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
1758 =head1 AUTHOR
1760 Auke Kok <sofar@foo-projects.org>, Max Kellermann
1761 <max@foo-projects.org>
1763 =cut