1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY iptables-download-http "https://www.netfilter.org/projects/iptables/files/iptables-&iptables-version;.tar.xz">
|
---|
8 | <!ENTITY iptables-download-ftp " ">
|
---|
9 | <!ENTITY iptables-md5sum "5eaa3bb424dd3a13c98c0cb026314029">
|
---|
10 | <!ENTITY iptables-size "628 KB">
|
---|
11 | <!ENTITY iptables-buildsize "16 MB">
|
---|
12 | <!ENTITY iptables-time "0.1 SBU">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="iptables" xreflabel="iptables-&iptables-version;">
|
---|
16 | <?dbhtml filename="iptables.html"?>
|
---|
17 |
|
---|
18 |
|
---|
19 | <title>iptables-&iptables-version;</title>
|
---|
20 |
|
---|
21 | <indexterm zone="iptables">
|
---|
22 | <primary sortas="a-iptables">iptables</primary>
|
---|
23 | </indexterm>
|
---|
24 |
|
---|
25 | <sect2 role="package">
|
---|
26 | <title>Introduction to iptables</title>
|
---|
27 |
|
---|
28 | <para>
|
---|
29 | <application>iptables</application> is a userspace command line program
|
---|
30 | used to configure the Linux 2.4 and later kernel packet filtering ruleset.
|
---|
31 | </para>
|
---|
32 |
|
---|
33 | &lfs122_checked;
|
---|
34 |
|
---|
35 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
36 | <itemizedlist spacing="compact">
|
---|
37 | <listitem>
|
---|
38 | <para>
|
---|
39 | Download (HTTP): <ulink url="&iptables-download-http;"/>
|
---|
40 | </para>
|
---|
41 | </listitem>
|
---|
42 | <listitem>
|
---|
43 | <para>
|
---|
44 | Download (FTP): <ulink url="&iptables-download-ftp;"/>
|
---|
45 | </para>
|
---|
46 | </listitem>
|
---|
47 | <listitem>
|
---|
48 | <para>
|
---|
49 | Download MD5 sum: &iptables-md5sum;
|
---|
50 | </para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>
|
---|
54 | Download size: &iptables-size;
|
---|
55 | </para>
|
---|
56 | </listitem>
|
---|
57 | <listitem>
|
---|
58 | <para>
|
---|
59 | Estimated disk space required: &iptables-buildsize;
|
---|
60 | </para>
|
---|
61 | </listitem>
|
---|
62 | <listitem>
|
---|
63 | <para>
|
---|
64 | Estimated build time: &iptables-time;
|
---|
65 | </para>
|
---|
66 | </listitem>
|
---|
67 | </itemizedlist>
|
---|
68 |
|
---|
69 | <bridgehead renderas="sect3">iptables Dependencies</bridgehead>
|
---|
70 |
|
---|
71 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
72 | <para role="optional">
|
---|
73 | <!-- <xref linkend="nftables"/>, -->
|
---|
74 | <xref linkend="libpcap"/> (required for BPF compiler or nfsynproxy support),
|
---|
75 | <ulink url="https://github.com/tadamdam/bpf-utils">bpf-utils</ulink>
|
---|
76 | (required for Berkeley Packet Filter support),
|
---|
77 | <ulink url="https://netfilter.org/projects/libnfnetlink/">libnfnetlink</ulink>
|
---|
78 | (required for connlabel support),
|
---|
79 | <ulink url="https://netfilter.org/projects/libnetfilter_conntrack/">libnetfilter_conntrack</ulink>
|
---|
80 | (required for connlabel support), and
|
---|
81 | <ulink url="https://netfilter.org/projects/nftables/">nftables</ulink>
|
---|
82 | </para>
|
---|
83 |
|
---|
84 | </sect2>
|
---|
85 |
|
---|
86 | <sect2 role="kernel" id="iptables-kernel">
|
---|
87 | <title>Kernel Configuration</title>
|
---|
88 |
|
---|
89 | <para>
|
---|
90 | A firewall in Linux is accomplished through the netfilter interface. To
|
---|
91 | use <application>iptables</application> to configure netfilter, the
|
---|
92 | following kernel configuration parameters are required:
|
---|
93 | </para>
|
---|
94 |
|
---|
95 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
96 | href="iptables-kernel.xml"/>
|
---|
97 |
|
---|
98 | <para>
|
---|
99 | Include any connection tracking protocols that will be used, as well as
|
---|
100 | any protocols that you wish to use for match support under the
|
---|
101 | "Core Netfilter Configuration" section. The above options are enough
|
---|
102 | for running <xref linkend="fw-persFw-ipt"/> below.
|
---|
103 | </para>
|
---|
104 |
|
---|
105 | <indexterm zone="iptables iptables-kernel">
|
---|
106 | <primary sortas="d-iptables">iptables</primary>
|
---|
107 | </indexterm>
|
---|
108 |
|
---|
109 | </sect2>
|
---|
110 |
|
---|
111 | <sect2 role="installation">
|
---|
112 | <title>Installation of iptables</title>
|
---|
113 |
|
---|
114 | <note>
|
---|
115 | <para>
|
---|
116 | The installation below does not include building some specialized
|
---|
117 | extension libraries which require the raw headers in the
|
---|
118 | <application>Linux</application> source code. If you wish to build the
|
---|
119 | additional extensions (if you aren't sure, then you probably don't), you
|
---|
120 | can look at the <filename>INSTALL</filename> file to see an example of
|
---|
121 | how to change the <parameter>KERNEL_DIR=</parameter> parameter to point
|
---|
122 | at the <application>Linux</application> source code. Note that if you
|
---|
123 | upgrade the kernel version, you may also need to recompile
|
---|
124 | <application>iptables</application> and that the BLFS team has not
|
---|
125 | tested using the raw kernel headers.
|
---|
126 | </para>
|
---|
127 | </note>
|
---|
128 |
|
---|
129 | <para>
|
---|
130 | Install <application>iptables</application> by running the following
|
---|
131 | commands:
|
---|
132 | </para>
|
---|
133 |
|
---|
134 | <screen><userinput>./configure --prefix=/usr \
|
---|
135 | --disable-nftables \
|
---|
136 | --enable-libipq &&
|
---|
137 | make</userinput></screen>
|
---|
138 |
|
---|
139 | <para>
|
---|
140 | <!-- there is a iptables-test.py script which seems to run a
|
---|
141 | lot of tests. Unfortunately, success rate is 50% only. Needs
|
---|
142 | to be clarified how to use and which prerequisites are required
|
---|
143 | to run to 100%. Contacted Shekhar Sharma for that (Dec'19),
|
---|
144 | waiting for answer (thomas). -->
|
---|
145 | This package does not come with a test suite.
|
---|
146 | </para>
|
---|
147 |
|
---|
148 | <para>
|
---|
149 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
150 | </para>
|
---|
151 |
|
---|
152 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
153 |
|
---|
154 | </sect2>
|
---|
155 |
|
---|
156 | <sect2 role="commands">
|
---|
157 | <title>Command Explanations</title>
|
---|
158 |
|
---|
159 | <para>
|
---|
160 | <parameter>--disable-nftables</parameter>: This switch disables building
|
---|
161 | nftables compatibility. <!--Omit this switch if you have installed
|
---|
162 | <xref linkend="nftables"/>.-->
|
---|
163 | </para>
|
---|
164 |
|
---|
165 | <para>
|
---|
166 | <parameter>--enable-libipq</parameter>: This switch enables building
|
---|
167 | of <filename class="libraryfile">libipq.so</filename> which
|
---|
168 | can be used by some packages outside of BLFS.
|
---|
169 | </para>
|
---|
170 |
|
---|
171 | <para>
|
---|
172 | <option>--enable-nfsynproxy</option>: This switch enables installation
|
---|
173 | of <application>nfsynproxy</application> SYNPROXY configuration tool.
|
---|
174 | </para>
|
---|
175 |
|
---|
176 | </sect2>
|
---|
177 |
|
---|
178 | <sect2 role="configuration">
|
---|
179 | <title>Configuring iptables</title>
|
---|
180 | <!--
|
---|
181 | <note>
|
---|
182 | <para>
|
---|
183 | If you intend to use <xref linkend="firewalld"/> to configure your
|
---|
184 | firewall rules, you should not use the example configurations provided
|
---|
185 | here, nor should you enable the
|
---|
186 | <phrase revision="sysv">bootscript.</phrase>
|
---|
187 | <phrase revision="systemd">systemd unit.</phrase>
|
---|
188 | </para>
|
---|
189 | </note>
|
---|
190 | -->
|
---|
191 | <note>
|
---|
192 | <para>
|
---|
193 | In the following example configurations, <emphasis
|
---|
194 | role="strong">LAN1</emphasis> is used for the internal LAN interface,
|
---|
195 | and <emphasis role="strong">WAN1</emphasis> is used for the external
|
---|
196 | interface connected to the Internet. You will need to replace these
|
---|
197 | values with appropriate interface names for your system.
|
---|
198 | </para>
|
---|
199 | </note>
|
---|
200 |
|
---|
201 | <sect3 id="fw-persFw-ipt"
|
---|
202 | xreflabel="Creating a Personal Firewall With iptables">
|
---|
203 | <title>Personal Firewall</title>
|
---|
204 |
|
---|
205 | <para>
|
---|
206 | A Personal Firewall is designed to let you access all the
|
---|
207 | services offered on the Internet while keeping your computer secure and
|
---|
208 | your data private.
|
---|
209 | </para>
|
---|
210 |
|
---|
211 | <para>
|
---|
212 | Below is a slightly modified version of Rusty Russell's
|
---|
213 | recommendation from the <ulink
|
---|
214 | url="https://www.netfilter.org/documentation/HOWTO/packet-filtering-HOWTO.html">
|
---|
215 | Linux 2.4 Packet Filtering HOWTO</ulink>. It is still applicable
|
---|
216 | to the Linux 6.x kernels.
|
---|
217 | </para>
|
---|
218 |
|
---|
219 | <screen role="root" revision="sysv"><?dbfo keep-together="auto"?><userinput>cat > /etc/rc.d/rc.iptables << "EOF"
|
---|
220 | <literal>#!/bin/sh
|
---|
221 |
|
---|
222 | # Begin rc.iptables
|
---|
223 |
|
---|
224 | # Insert connection-tracking modules
|
---|
225 | # (not needed if built into the kernel)
|
---|
226 | modprobe nf_conntrack
|
---|
227 | modprobe xt_LOG
|
---|
228 |
|
---|
229 | # Enable broadcast echo Protection
|
---|
230 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
---|
231 |
|
---|
232 | # Disable Source Routed Packets
|
---|
233 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
|
---|
234 | echo 0 > /proc/sys/net/ipv4/conf/default/accept_source_route
|
---|
235 |
|
---|
236 | # Enable TCP SYN Cookie Protection
|
---|
237 | echo 1 > /proc/sys/net/ipv4/tcp_syncookies
|
---|
238 |
|
---|
239 | # Disable ICMP Redirect Acceptance
|
---|
240 | echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
|
---|
241 |
|
---|
242 | # Do not send Redirect Messages
|
---|
243 | echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
|
---|
244 | echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
|
---|
245 |
|
---|
246 | # Drop Spoofed Packets coming in on an interface, where responses
|
---|
247 | # would result in the reply going out a different interface.
|
---|
248 | echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
|
---|
249 | echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
|
---|
250 |
|
---|
251 | # Log packets with impossible addresses.
|
---|
252 | echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
|
---|
253 | echo 1 > /proc/sys/net/ipv4/conf/default/log_martians
|
---|
254 |
|
---|
255 | # be verbose on dynamic ip-addresses (not needed in case of static IP)
|
---|
256 | echo 2 > /proc/sys/net/ipv4/ip_dynaddr
|
---|
257 |
|
---|
258 | # disable Explicit Congestion Notification
|
---|
259 | # too many routers are still ignorant
|
---|
260 | echo 0 > /proc/sys/net/ipv4/tcp_ecn
|
---|
261 |
|
---|
262 | # Set a known state
|
---|
263 | iptables -P INPUT DROP
|
---|
264 | iptables -P FORWARD DROP
|
---|
265 | iptables -P OUTPUT DROP
|
---|
266 |
|
---|
267 | # These lines are here in case rules are already in place and the
|
---|
268 | # script is ever rerun on the fly. We want to remove all rules and
|
---|
269 | # pre-existing user defined chains before we implement new rules.
|
---|
270 | iptables -F
|
---|
271 | iptables -X
|
---|
272 | iptables -Z
|
---|
273 |
|
---|
274 | iptables -t nat -F
|
---|
275 |
|
---|
276 | # Allow local-only connections
|
---|
277 | iptables -A INPUT -i lo -j ACCEPT
|
---|
278 |
|
---|
279 | # Free output on any interface to any ip for any service
|
---|
280 | # (equal to -P ACCEPT)
|
---|
281 | iptables -A OUTPUT -j ACCEPT
|
---|
282 |
|
---|
283 | # Permit answers on already established connections
|
---|
284 | # and permit new connections related to established ones
|
---|
285 | # (e.g. port mode ftp)
|
---|
286 | iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
---|
287 |
|
---|
288 | # Drop any incoming MULTICAST or BROADCAST packet before logging:
|
---|
289 | # The box outputs several of them when using netbios or mDNS, and those
|
---|
290 | # appear immediately as incoming, which clutters the log.
|
---|
291 | iptables -A INPUT -m addrtype --dst-type BROADCAST,MULTICAST -j DROP
|
---|
292 |
|
---|
293 | # Log everything else.
|
---|
294 | iptables -A INPUT -j LOG --log-prefix "FIREWALL:INPUT "
|
---|
295 |
|
---|
296 | # End $rc_base/rc.iptables</literal>
|
---|
297 | EOF
|
---|
298 | chmod 700 /etc/rc.d/rc.iptables</userinput></screen>
|
---|
299 |
|
---|
300 | <screen role="root" revision="systemd"><?dbfo keep-together="auto"?><userinput>install -v -dm755 /etc/systemd/scripts
|
---|
301 |
|
---|
302 | cat > /etc/systemd/scripts/iptables << "EOF"
|
---|
303 | <literal>#!/bin/sh
|
---|
304 |
|
---|
305 | # Begin /etc/systemd/scripts/iptables
|
---|
306 |
|
---|
307 | # Insert connection-tracking modules
|
---|
308 | # (not needed if built into the kernel)
|
---|
309 | modprobe nf_conntrack
|
---|
310 | modprobe xt_LOG
|
---|
311 |
|
---|
312 | # Enable broadcast echo Protection
|
---|
313 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
---|
314 |
|
---|
315 | # Disable Source Routed Packets
|
---|
316 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
|
---|
317 | echo 0 > /proc/sys/net/ipv4/conf/default/accept_source_route
|
---|
318 |
|
---|
319 | # Enable TCP SYN Cookie Protection
|
---|
320 | echo 1 > /proc/sys/net/ipv4/tcp_syncookies
|
---|
321 |
|
---|
322 | # Disable ICMP Redirect Acceptance
|
---|
323 | echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
|
---|
324 |
|
---|
325 | # Do not send Redirect Messages
|
---|
326 | echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
|
---|
327 | echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
|
---|
328 |
|
---|
329 | # Drop Spoofed Packets coming in on an interface, where responses
|
---|
330 | # would result in the reply going out a different interface.
|
---|
331 | echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
|
---|
332 | echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
|
---|
333 |
|
---|
334 | # Log packets with impossible addresses.
|
---|
335 | echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
|
---|
336 | echo 1 > /proc/sys/net/ipv4/conf/default/log_martians
|
---|
337 |
|
---|
338 | # be verbose on dynamic ip-addresses (not needed in case of static IP)
|
---|
339 | echo 2 > /proc/sys/net/ipv4/ip_dynaddr
|
---|
340 |
|
---|
341 | # disable Explicit Congestion Notification
|
---|
342 | # too many routers are still ignorant
|
---|
343 | echo 0 > /proc/sys/net/ipv4/tcp_ecn
|
---|
344 |
|
---|
345 | # Set a known state
|
---|
346 | iptables -P INPUT DROP
|
---|
347 | iptables -P FORWARD DROP
|
---|
348 | iptables -P OUTPUT DROP
|
---|
349 |
|
---|
350 | # These lines are here in case rules are already in place and the
|
---|
351 | # script is ever rerun on the fly. We want to remove all rules and
|
---|
352 | # pre-existing user defined chains before we implement new rules.
|
---|
353 | iptables -F
|
---|
354 | iptables -X
|
---|
355 | iptables -Z
|
---|
356 |
|
---|
357 | iptables -t nat -F
|
---|
358 |
|
---|
359 | # Allow local-only connections
|
---|
360 | iptables -A INPUT -i lo -j ACCEPT
|
---|
361 |
|
---|
362 | # Free output on any interface to any ip for any service
|
---|
363 | # (equal to -P ACCEPT)
|
---|
364 | iptables -A OUTPUT -j ACCEPT
|
---|
365 |
|
---|
366 | # Permit answers on already established connections
|
---|
367 | # and permit new connections related to established ones
|
---|
368 | # (e.g. port mode ftp)
|
---|
369 | iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
---|
370 |
|
---|
371 | # Log everything else.
|
---|
372 | iptables -A INPUT -j LOG --log-prefix "FIREWALL:INPUT "
|
---|
373 |
|
---|
374 | # End /etc/systemd/scripts/iptables</literal>
|
---|
375 | EOF
|
---|
376 | chmod 700 /etc/systemd/scripts/iptables</userinput></screen>
|
---|
377 |
|
---|
378 | <para>
|
---|
379 | This script is quite simple, it drops all traffic coming
|
---|
380 | into your computer that wasn't initiated from your computer, but
|
---|
381 | as long as you are simply surfing the Internet you are unlikely
|
---|
382 | to exceed its limits.
|
---|
383 | </para>
|
---|
384 |
|
---|
385 | <para>
|
---|
386 | If you frequently encounter certain delays at accessing
|
---|
387 | FTP servers, take a look at <xref linkend="fw-BB-4-ipt"/>.
|
---|
388 | </para>
|
---|
389 |
|
---|
390 | <para>
|
---|
391 | Even if you have daemons or services running on your system,
|
---|
392 | these will be inaccessible everywhere but from your computer itself.
|
---|
393 | If you want to allow access to services on your machine, such as
|
---|
394 | <command>ssh</command> or <command>ping</command>, take a look at
|
---|
395 | <xref linkend="fw-busybox-ipt"/>.
|
---|
396 | </para>
|
---|
397 |
|
---|
398 | </sect3>
|
---|
399 |
|
---|
400 | <sect3 id="fw-masqRouter-ipt"
|
---|
401 | xreflabel="Creating a Masquerading Router With iptables">
|
---|
402 | <title>Masquerading Router</title>
|
---|
403 |
|
---|
404 | <para>
|
---|
405 | A Network Firewall has two interfaces, one connected to an
|
---|
406 | intranet, in this example <emphasis role="strong">LAN1</emphasis>,
|
---|
407 | and one connected to the Internet, here <emphasis
|
---|
408 | role="strong">WAN1</emphasis>. To provide the maximum security
|
---|
409 | for the firewall itself, make sure that there are no unnecessary
|
---|
410 | servers running on it such as <application>X11</application>.
|
---|
411 | As a general principle, the firewall itself should not access
|
---|
412 | any untrusted service (think of a remote server giving answers that
|
---|
413 | makes a daemon on your system crash, or even worse, that implements
|
---|
414 | a worm via a buffer-overflow).
|
---|
415 | </para>
|
---|
416 |
|
---|
417 | <screen role="root" revision="sysv"><?dbfo keep-together="auto"?><userinput>cat > /etc/rc.d/rc.iptables << "EOF"
|
---|
418 | <literal>#!/bin/sh
|
---|
419 |
|
---|
420 | # Begin rc.iptables
|
---|
421 |
|
---|
422 | echo
|
---|
423 | echo "You're using the example configuration for a setup of a firewall"
|
---|
424 | echo "from Beyond Linux From Scratch."
|
---|
425 | echo "This example is far from being complete, it is only meant"
|
---|
426 | echo "to be a reference."
|
---|
427 | echo "Firewall security is a complex issue, that exceeds the scope"
|
---|
428 | echo "of the configuration rules below."
|
---|
429 | echo "You can find additional information"
|
---|
430 | echo "about firewalls in Chapter 4 of the BLFS book."
|
---|
431 | echo "https://www.&lfs-domainname;/blfs"
|
---|
432 | echo
|
---|
433 |
|
---|
434 | # Insert iptables modules (not needed if built into the kernel).
|
---|
435 |
|
---|
436 | modprobe nf_conntrack
|
---|
437 | modprobe nf_conntrack_ftp
|
---|
438 | modprobe xt_conntrack
|
---|
439 | modprobe xt_LOG
|
---|
440 | modprobe xt_state
|
---|
441 |
|
---|
442 | # Enable broadcast echo Protection
|
---|
443 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
---|
444 |
|
---|
445 | # Disable Source Routed Packets
|
---|
446 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
|
---|
447 |
|
---|
448 | # Enable TCP SYN Cookie Protection
|
---|
449 | echo 1 > /proc/sys/net/ipv4/tcp_syncookies
|
---|
450 |
|
---|
451 | # Disable ICMP Redirect Acceptance
|
---|
452 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
|
---|
453 |
|
---|
454 | # Don't send Redirect Messages
|
---|
455 | echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
|
---|
456 |
|
---|
457 | # Drop Spoofed Packets coming in on an interface where responses
|
---|
458 | # would result in the reply going out a different interface.
|
---|
459 | echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
|
---|
460 |
|
---|
461 | # Log packets with impossible addresses.
|
---|
462 | echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
|
---|
463 |
|
---|
464 | # Be verbose on dynamic ip-addresses (not needed in case of static IP)
|
---|
465 | echo 2 > /proc/sys/net/ipv4/ip_dynaddr
|
---|
466 |
|
---|
467 | # Disable Explicit Congestion Notification
|
---|
468 | # Too many routers are still ignorant
|
---|
469 | echo 0 > /proc/sys/net/ipv4/tcp_ecn
|
---|
470 |
|
---|
471 | # Set a known state
|
---|
472 | iptables -P INPUT DROP
|
---|
473 | iptables -P FORWARD DROP
|
---|
474 | iptables -P OUTPUT DROP
|
---|
475 |
|
---|
476 | # These lines are here in case rules are already in place and the
|
---|
477 | # script is ever rerun on the fly. We want to remove all rules and
|
---|
478 | # pre-existing user defined chains before we implement new rules.
|
---|
479 | iptables -F
|
---|
480 | iptables -X
|
---|
481 | iptables -Z
|
---|
482 |
|
---|
483 | iptables -t nat -F
|
---|
484 |
|
---|
485 | # Allow local connections
|
---|
486 | iptables -A INPUT -i lo -j ACCEPT
|
---|
487 | iptables -A OUTPUT -o lo -j ACCEPT
|
---|
488 |
|
---|
489 | # Allow forwarding if the initiated on the intranet
|
---|
490 | iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
---|
491 | iptables -A FORWARD ! -i WAN1 -m conntrack --ctstate NEW -j ACCEPT
|
---|
492 |
|
---|
493 | # Do masquerading
|
---|
494 | # (not needed if intranet is not using private ip-addresses)
|
---|
495 | iptables -t nat -A POSTROUTING -o WAN1 -j MASQUERADE
|
---|
496 |
|
---|
497 | # Log everything for debugging
|
---|
498 | # (last of all rules, but before policy rules)
|
---|
499 | iptables -A INPUT -j LOG --log-prefix "FIREWALL:INPUT "
|
---|
500 | iptables -A FORWARD -j LOG --log-prefix "FIREWALL:FORWARD "
|
---|
501 | iptables -A OUTPUT -j LOG --log-prefix "FIREWALL:OUTPUT "
|
---|
502 |
|
---|
503 | # Enable IP Forwarding
|
---|
504 | echo 1 > /proc/sys/net/ipv4/ip_forward</literal>
|
---|
505 | EOF
|
---|
506 | chmod 700 /etc/rc.d/rc.iptables</userinput></screen>
|
---|
507 |
|
---|
508 | <screen role="root" revision="systemd"><?dbfo keep-together="auto"?><userinput>install -v -dm755 /etc/systemd/scripts
|
---|
509 |
|
---|
510 | cat > /etc/systemd/scripts/iptables << "EOF"
|
---|
511 | <literal>#!/bin/sh
|
---|
512 |
|
---|
513 | # Begin /etc/systemd/scripts/iptables
|
---|
514 |
|
---|
515 | echo
|
---|
516 | echo "You're using the example configuration for a setup of a firewall"
|
---|
517 | echo "from Beyond Linux From Scratch."
|
---|
518 | echo "This example is far from being complete, it is only meant"
|
---|
519 | echo "to be a reference."
|
---|
520 | echo "Firewall security is a complex issue, that exceeds the scope"
|
---|
521 | echo "of the configuration rules below."
|
---|
522 |
|
---|
523 | echo "You can find additional information"
|
---|
524 | echo "about firewalls in Chapter 4 of the BLFS book."
|
---|
525 | echo "https://www.&lfs-domainname;/blfs"
|
---|
526 | echo
|
---|
527 |
|
---|
528 | # Insert iptables modules (not needed if built into the kernel).
|
---|
529 |
|
---|
530 | modprobe nf_conntrack
|
---|
531 | modprobe nf_conntrack_ftp
|
---|
532 | modprobe xt_conntrack
|
---|
533 | modprobe xt_LOG
|
---|
534 | modprobe xt_state
|
---|
535 |
|
---|
536 | # Enable broadcast echo Protection
|
---|
537 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
|
---|
538 |
|
---|
539 | # Disable Source Routed Packets
|
---|
540 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
|
---|
541 |
|
---|
542 | # Enable TCP SYN Cookie Protection
|
---|
543 | echo 1 > /proc/sys/net/ipv4/tcp_syncookies
|
---|
544 |
|
---|
545 | # Disable ICMP Redirect Acceptance
|
---|
546 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
|
---|
547 |
|
---|
548 | # Don't send Redirect Messages
|
---|
549 | echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
|
---|
550 |
|
---|
551 | # Drop Spoofed Packets coming in on an interface where responses
|
---|
552 | # would result in the reply going out a different interface.
|
---|
553 | echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
|
---|
554 |
|
---|
555 | # Log packets with impossible addresses.
|
---|
556 | echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
|
---|
557 |
|
---|
558 | # Be verbose on dynamic ip-addresses (not needed in case of static IP)
|
---|
559 | echo 2 > /proc/sys/net/ipv4/ip_dynaddr
|
---|
560 |
|
---|
561 | # Disable Explicit Congestion Notification
|
---|
562 | # Too many routers are still ignorant
|
---|
563 | echo 0 > /proc/sys/net/ipv4/tcp_ecn
|
---|
564 |
|
---|
565 | # Set a known state
|
---|
566 | iptables -P INPUT DROP
|
---|
567 | iptables -P FORWARD DROP
|
---|
568 | iptables -P OUTPUT DROP
|
---|
569 |
|
---|
570 | # These lines are here in case rules are already in place and the
|
---|
571 | # script is ever rerun on the fly. We want to remove all rules and
|
---|
572 | # pre-existing user defined chains before we implement new rules.
|
---|
573 | iptables -F
|
---|
574 | iptables -X
|
---|
575 | iptables -Z
|
---|
576 |
|
---|
577 | iptables -t nat -F
|
---|
578 |
|
---|
579 | # Allow local connections
|
---|
580 | iptables -A INPUT -i lo -j ACCEPT
|
---|
581 | iptables -A OUTPUT -o lo -j ACCEPT
|
---|
582 |
|
---|
583 | # Allow forwarding if the initiated on the intranet
|
---|
584 | iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
---|
585 | iptables -A FORWARD ! -i WAN1 -m conntrack --ctstate NEW -j ACCEPT
|
---|
586 |
|
---|
587 | # Do masquerading
|
---|
588 | # (not needed if intranet is not using private ip-addresses)
|
---|
589 | iptables -t nat -A POSTROUTING -o WAN1 -j MASQUERADE
|
---|
590 |
|
---|
591 | # Log everything for debugging
|
---|
592 | # (last of all rules, but before policy rules)
|
---|
593 | iptables -A INPUT -j LOG --log-prefix "FIREWALL:INPUT "
|
---|
594 | iptables -A FORWARD -j LOG --log-prefix "FIREWALL:FORWARD "
|
---|
595 | iptables -A OUTPUT -j LOG --log-prefix "FIREWALL:OUTPUT "
|
---|
596 |
|
---|
597 | # Enable IP Forwarding
|
---|
598 | echo 1 > /proc/sys/net/ipv4/ip_forward
|
---|
599 |
|
---|
600 | # The following sections allow inbound packets for specific examples
|
---|
601 | # Uncomment the example lines and adjust as necessary
|
---|
602 |
|
---|
603 | # Allow ping on the external interface
|
---|
604 | #iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j ACCEPT
|
---|
605 | #iptables -A OUTPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT
|
---|
606 |
|
---|
607 | # Reject ident packets with TCP reset to avoid delays with FTP or IRC
|
---|
608 | #iptables -A INPUT -p tcp --dport 113 -j REJECT --reject-with tcp-reset
|
---|
609 |
|
---|
610 | # Allow HTTP and HTTPS to 192.168.0.2
|
---|
611 | #iptables -A PREROUTING -t nat -i WAN1 -p tcp --dport 80 -j DNAT --to 192.168.0.2
|
---|
612 | #iptables -A PREROUTING -t nat -i WAN1 -p tcp --dport 443 -j DNAT --to 192.168.0.2
|
---|
613 | #iptables -A FORWARD -p tcp -d 192.168.0.2 --dport 80 -j ACCEPT
|
---|
614 | #iptables -A FORWARD -p tcp -d 192.168.0.2 --dport 443 -j ACCEPT
|
---|
615 |
|
---|
616 | # End /etc/systemd/scripts/iptables</literal>
|
---|
617 | EOF
|
---|
618 | chmod 700 /etc/systemd/scripts/iptables</userinput></screen>
|
---|
619 |
|
---|
620 | <para>
|
---|
621 | With this script your intranet should be reasonably secure
|
---|
622 | against external attacks. No one should be able to setup a new
|
---|
623 | connection to any internal service and, if it's masqueraded,
|
---|
624 | makes your intranet invisible to the Internet. Furthermore, your
|
---|
625 | firewall should be relatively safe because there are no services
|
---|
626 | running that a cracker could attack.
|
---|
627 | </para>
|
---|
628 |
|
---|
629 | </sect3>
|
---|
630 |
|
---|
631 | <sect3 id="fw-busybox-ipt" xreflabel="Creating a BusyBox With iptables">
|
---|
632 | <title>BusyBox</title>
|
---|
633 |
|
---|
634 | <para>
|
---|
635 | This scenario isn't too different from the <xref
|
---|
636 | linkend="fw-masqRouter-ipt"/>, but additionally offers some
|
---|
637 | services to your intranet. Examples of this can be when
|
---|
638 | you want to administer your firewall from another host on
|
---|
639 | your intranet or use it as a proxy or a name server.
|
---|
640 | </para>
|
---|
641 |
|
---|
642 | <note>
|
---|
643 | <para>
|
---|
644 | Outlining specifically how to protect a server that
|
---|
645 | offers services on the Internet goes far beyond the scope of
|
---|
646 | this document. See the references in <xref linkend="fw-extra-info"/>
|
---|
647 | for more information.
|
---|
648 | </para>
|
---|
649 | </note>
|
---|
650 |
|
---|
651 | <para>
|
---|
652 | Be cautious. Every service you have enabled makes your
|
---|
653 | setup more complex and your firewall less secure. You are
|
---|
654 | exposed to the risks of misconfigured services or running
|
---|
655 | a service with an exploitable bug. A firewall should generally
|
---|
656 | not run any extra services. See the introduction to the
|
---|
657 | <xref linkend="fw-masqRouter-ipt"/> for some more details.
|
---|
658 | </para>
|
---|
659 |
|
---|
660 | <para>
|
---|
661 | If you want to add services such as internal Samba or
|
---|
662 | name servers that do not need to access the Internet themselves,
|
---|
663 | the additional statements are quite simple and should still be
|
---|
664 | acceptable from a security standpoint. Just add the following lines
|
---|
665 | into the script <emphasis>before</emphasis> the logging rules.
|
---|
666 | </para>
|
---|
667 |
|
---|
668 | <screen><literal>iptables -A INPUT -i ! WAN1 -j ACCEPT
|
---|
669 | iptables -A OUTPUT -o ! WAN1 -j ACCEPT</literal></screen>
|
---|
670 |
|
---|
671 | <para>
|
---|
672 | If daemons, such as squid, have to access the Internet
|
---|
673 | themselves, you could open OUTPUT generally and restrict
|
---|
674 | INPUT.
|
---|
675 | </para>
|
---|
676 |
|
---|
677 | <screen><literal>iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
---|
678 | iptables -A OUTPUT -j ACCEPT</literal></screen>
|
---|
679 |
|
---|
680 | <para>
|
---|
681 | However, it is generally not advisable to leave OUTPUT
|
---|
682 | unrestricted. You lose any control over trojans who would like
|
---|
683 | to "call home", and a bit of redundancy in case you've
|
---|
684 | (mis-)configured a service so that it broadcasts its existence
|
---|
685 | to the world.
|
---|
686 | </para>
|
---|
687 |
|
---|
688 | <para>
|
---|
689 | To accomplish this, you should restrict INPUT and OUTPUT
|
---|
690 | on all ports except those that it's absolutely necessary to have
|
---|
691 | open. Which ports you have to open depends on your needs: mostly
|
---|
692 | you will find them by looking for failed accesses in your log
|
---|
693 | files.
|
---|
694 | </para>
|
---|
695 |
|
---|
696 | <itemizedlist spacing="compact" role='iptables'>
|
---|
697 | <title>Have a Look at the Following Examples:</title>
|
---|
698 | <listitem>
|
---|
699 | <para>
|
---|
700 | Squid is caching the web:
|
---|
701 | </para>
|
---|
702 |
|
---|
703 | <screen><literal>iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
|
---|
704 | iptables -A INPUT -p tcp --sport 80 -m conntrack --ctstate ESTABLISHED \
|
---|
705 | -j ACCEPT</literal></screen>
|
---|
706 |
|
---|
707 | </listitem>
|
---|
708 | <listitem>
|
---|
709 | <para>
|
---|
710 | Your caching name server (e.g., named) does its lookups via UDP:
|
---|
711 | </para>
|
---|
712 |
|
---|
713 | <screen><literal>iptables -A OUTPUT -p udp --dport 53 -j ACCEPT</literal></screen>
|
---|
714 |
|
---|
715 | </listitem>
|
---|
716 | <listitem>
|
---|
717 | <para>
|
---|
718 | You want to be able to ping your computer to ensure it's still
|
---|
719 | alive:
|
---|
720 | </para>
|
---|
721 |
|
---|
722 | <screen><literal>iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j ACCEPT
|
---|
723 | iptables -A OUTPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT</literal></screen>
|
---|
724 |
|
---|
725 | </listitem>
|
---|
726 | <listitem>
|
---|
727 | <para id='fw-BB-4-ipt' xreflabel="BusyBox with iptables example number 4">
|
---|
728 | If you are frequently accessing FTP servers or enjoy chatting, you
|
---|
729 | might notice delays because some implementations of these daemons
|
---|
730 | query an identd daemon on your system to obtain usernames. Although
|
---|
731 | there's really little harm in this, having an identd running is not
|
---|
732 | recommended because many security experts feel the service gives
|
---|
733 | out too much additional information.
|
---|
734 | </para>
|
---|
735 |
|
---|
736 | <para>
|
---|
737 | To avoid these delays you could reject the requests with a
|
---|
738 | 'tcp-reset' response:
|
---|
739 | </para>
|
---|
740 |
|
---|
741 | <screen><literal>iptables -A INPUT -p tcp --dport 113 -j REJECT --reject-with tcp-reset</literal></screen>
|
---|
742 |
|
---|
743 | </listitem>
|
---|
744 | <listitem>
|
---|
745 | <para>
|
---|
746 | To log and drop invalid packets (packets
|
---|
747 | that came in after netfilter's timeout or some types of
|
---|
748 | network scans) insert these rules at the top of the chain:
|
---|
749 | </para>
|
---|
750 |
|
---|
751 | <screen><literal>iptables -I INPUT 0 -p tcp -m conntrack --ctstate INVALID \
|
---|
752 | -j LOG --log-prefix "FIREWALL:INVALID "
|
---|
753 | iptables -I INPUT 1 -p tcp -m conntrack --ctstate INVALID -j DROP</literal></screen>
|
---|
754 |
|
---|
755 | </listitem>
|
---|
756 | <listitem>
|
---|
757 | <para>
|
---|
758 | Anything coming from the outside should not have a
|
---|
759 | private address, this is a common attack called IP-spoofing:
|
---|
760 | </para>
|
---|
761 |
|
---|
762 | <screen><literal>iptables -A INPUT -i WAN1 -s 10.0.0.0/8 -j DROP
|
---|
763 | iptables -A INPUT -i WAN1 -s 172.16.0.0/12 -j DROP
|
---|
764 | iptables -A INPUT -i WAN1 -s 192.168.0.0/16 -j DROP</literal></screen>
|
---|
765 |
|
---|
766 | <para>
|
---|
767 | There are other addresses that you may also want to drop:
|
---|
768 | 0.0.0.0/8, 127.0.0.0/8, 224.0.0.0/3 (multicast and
|
---|
769 | experimental), 169.254.0.0/16 (Link Local Networks), and
|
---|
770 | 192.0.2.0/24 (IANA defined test network).
|
---|
771 | </para>
|
---|
772 | </listitem>
|
---|
773 | <listitem>
|
---|
774 | <para>
|
---|
775 | If your firewall is a DHCP client, you need to allow those packets:
|
---|
776 | </para>
|
---|
777 |
|
---|
778 | <screen><literal>iptables -A INPUT -i WAN1 -p udp -s 0.0.0.0 --sport 67 \
|
---|
779 | -d 255.255.255.255 --dport 68 -j ACCEPT</literal></screen>
|
---|
780 |
|
---|
781 | </listitem>
|
---|
782 | <listitem>
|
---|
783 | <para>
|
---|
784 | To simplify debugging and be fair to anyone who'd like
|
---|
785 | to access a service you have disabled, purposely or by mistake,
|
---|
786 | you could REJECT those packets that are dropped.
|
---|
787 | </para>
|
---|
788 |
|
---|
789 | <para>
|
---|
790 | Obviously this must be done directly after logging as the very
|
---|
791 | last lines before the packets are dropped by policy:
|
---|
792 | </para>
|
---|
793 |
|
---|
794 | <screen><literal>iptables -A INPUT -j REJECT</literal></screen>
|
---|
795 |
|
---|
796 | </listitem>
|
---|
797 | </itemizedlist>
|
---|
798 |
|
---|
799 | <para>
|
---|
800 | These are only examples to show you some of the capabilities
|
---|
801 | of the firewall code in Linux. Have a look at the man page of iptables.
|
---|
802 | There you will find much more information. The port numbers needed for
|
---|
803 | this can be found in <filename>/etc/services</filename>, in case you
|
---|
804 | didn't find them by trial and error in your log file.
|
---|
805 | </para>
|
---|
806 |
|
---|
807 | </sect3>
|
---|
808 |
|
---|
809 | <sect3 id="iptables-init">
|
---|
810 | <title><phrase revision="sysv">Boot Script</phrase>
|
---|
811 | <phrase revision="systemd">Systemd Unit</phrase></title>
|
---|
812 |
|
---|
813 | <para revision="sysv">
|
---|
814 | To set up the iptables firewall at boot, install the
|
---|
815 | <filename>/etc/rc.d/init.d/iptables</filename> init script included
|
---|
816 | in the <xref linkend="bootscripts"/> package.
|
---|
817 | </para>
|
---|
818 |
|
---|
819 | <para revision="systemd">
|
---|
820 | To set up the iptables firewall at boot, install the
|
---|
821 | <filename>iptables.service</filename> unit included in the
|
---|
822 | <xref linkend="systemd-units"/> package.
|
---|
823 | </para>
|
---|
824 |
|
---|
825 | <indexterm zone="iptables iptables-init">
|
---|
826 | <primary sortas="f-iptables">iptables</primary>
|
---|
827 | </indexterm>
|
---|
828 |
|
---|
829 | <screen role="root"><userinput>make install-iptables</userinput></screen>
|
---|
830 |
|
---|
831 | </sect3>
|
---|
832 |
|
---|
833 | </sect2>
|
---|
834 |
|
---|
835 | <sect2 role="content">
|
---|
836 | <title>Contents</title>
|
---|
837 |
|
---|
838 | <segmentedlist>
|
---|
839 | <segtitle>Installed Programs</segtitle>
|
---|
840 | <segtitle>Installed Libraries</segtitle>
|
---|
841 | <segtitle>Installed Directories</segtitle>
|
---|
842 |
|
---|
843 | <seglistitem>
|
---|
844 | <seg>
|
---|
845 | ip6tables,
|
---|
846 | ip6tables-apply,
|
---|
847 | ip6tables-legacy,
|
---|
848 | ip6tables-legacy-restore,
|
---|
849 | ip6tables-legacy-save,
|
---|
850 | ip6tables-restore,
|
---|
851 | ip6tables-save,
|
---|
852 | iptables,
|
---|
853 | iptables-apply,
|
---|
854 | iptables-legacy,
|
---|
855 | iptables-legacy-restore,
|
---|
856 | iptables-legacy-apply,
|
---|
857 | iptables-restore,
|
---|
858 | iptables-save,
|
---|
859 | iptables-xml,
|
---|
860 | nfsynproxy (optional),
|
---|
861 | and xtables-multi
|
---|
862 | </seg>
|
---|
863 | <seg>
|
---|
864 | libip4tc.so,
|
---|
865 | libip6tc.so,
|
---|
866 | libipq.so,
|
---|
867 | libiptc.so,
|
---|
868 | and libxtables.so
|
---|
869 | </seg>
|
---|
870 | <seg>
|
---|
871 | /lib/xtables and
|
---|
872 | /usr/include/libiptc
|
---|
873 | </seg>
|
---|
874 | </seglistitem>
|
---|
875 | </segmentedlist>
|
---|
876 |
|
---|
877 | <variablelist>
|
---|
878 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
879 | <?dbfo list-presentation="list"?>
|
---|
880 | <?dbhtml list-presentation="table"?>
|
---|
881 |
|
---|
882 | <varlistentry id="iptables-prog">
|
---|
883 | <term><command>iptables</command></term>
|
---|
884 | <listitem>
|
---|
885 | <para>
|
---|
886 | is used to set up, maintain, and inspect the tables of
|
---|
887 | IP packet filter rules in the Linux kernel
|
---|
888 | </para>
|
---|
889 | <indexterm zone="iptables iptables-prog">
|
---|
890 | <primary sortas="b-iptables">iptables</primary>
|
---|
891 | </indexterm>
|
---|
892 | </listitem>
|
---|
893 | </varlistentry>
|
---|
894 |
|
---|
895 | <varlistentry id="iptables-apply">
|
---|
896 | <term><command>iptables-apply</command></term>
|
---|
897 | <listitem>
|
---|
898 | <para>
|
---|
899 | is a safer way to update iptables remotely
|
---|
900 | </para>
|
---|
901 | <indexterm zone="iptables iptables-apply">
|
---|
902 | <primary sortas="b-iptables-apply">iptables-apply</primary>
|
---|
903 | </indexterm>
|
---|
904 | </listitem>
|
---|
905 | </varlistentry>
|
---|
906 |
|
---|
907 | <varlistentry id="iptables-legacy">
|
---|
908 | <term><command>iptables-legacy</command></term>
|
---|
909 | <listitem>
|
---|
910 | <para>
|
---|
911 | is used to interact with iptables using the legacy command set
|
---|
912 | </para>
|
---|
913 | <indexterm zone="iptables iptables-legacy">
|
---|
914 | <primary sortas="b-iptables-legacy">iptables-legacy</primary>
|
---|
915 | </indexterm>
|
---|
916 | </listitem>
|
---|
917 | </varlistentry>
|
---|
918 |
|
---|
919 | <varlistentry id="iptables-legacy-restore">
|
---|
920 | <term><command>iptables-legacy-restore</command></term>
|
---|
921 | <listitem>
|
---|
922 | <para>
|
---|
923 | is used to restore a set of legacy iptables rules
|
---|
924 | </para>
|
---|
925 | <indexterm zone="iptables iptables-legacy-restore">
|
---|
926 | <primary sortas="b-iptables-legacy-restore">iptables-legacy-restore</primary>
|
---|
927 | </indexterm>
|
---|
928 | </listitem>
|
---|
929 | </varlistentry>
|
---|
930 |
|
---|
931 | <varlistentry id="iptables-legacy-save">
|
---|
932 | <term><command>iptables-legacy-save</command></term>
|
---|
933 | <listitem>
|
---|
934 | <para>
|
---|
935 | is used to save a set of legacy iptables rules
|
---|
936 | </para>
|
---|
937 | <indexterm zone="iptables iptables-legacy-save">
|
---|
938 | <primary sortas="b-iptables-legacy-save">iptables-legacy-save</primary>
|
---|
939 | </indexterm>
|
---|
940 | </listitem>
|
---|
941 | </varlistentry>
|
---|
942 |
|
---|
943 | <varlistentry id="iptables-restore">
|
---|
944 | <term><command>iptables-restore</command></term>
|
---|
945 | <listitem>
|
---|
946 | <para>
|
---|
947 | is used to restore IP Tables from data specified on
|
---|
948 | STDIN. Use I/O redirection provided by your
|
---|
949 | shell to read from a file
|
---|
950 | </para>
|
---|
951 | <indexterm zone="iptables iptables-restore">
|
---|
952 | <primary sortas="b-iptables-restore">iptables-restore</primary>
|
---|
953 | </indexterm>
|
---|
954 | </listitem>
|
---|
955 | </varlistentry>
|
---|
956 |
|
---|
957 | <varlistentry id="iptables-save">
|
---|
958 | <term><command>iptables-save</command></term>
|
---|
959 | <listitem>
|
---|
960 | <para>
|
---|
961 | is used to dump the contents of an IP Table in easily
|
---|
962 | parseable format to STDOUT. Use I/O-redirection
|
---|
963 | provided by your shell to write to a file
|
---|
964 | </para>
|
---|
965 | <indexterm zone="iptables iptables-save">
|
---|
966 | <primary sortas="b-iptables-save">iptables-save</primary>
|
---|
967 | </indexterm>
|
---|
968 | </listitem>
|
---|
969 | </varlistentry>
|
---|
970 |
|
---|
971 | <varlistentry id="iptables-xml">
|
---|
972 | <term><command>iptables-xml</command></term>
|
---|
973 | <listitem>
|
---|
974 | <para>
|
---|
975 | is used to convert the output of
|
---|
976 | <command>iptables-save</command> to an XML format. Using the
|
---|
977 | <filename>iptables.xslt</filename> stylesheet converts the XML
|
---|
978 | back to the format of <command>iptables-restore</command>
|
---|
979 | </para>
|
---|
980 | <indexterm zone="iptables iptables-xml">
|
---|
981 | <primary sortas="b-iptables-xml">iptables-xml</primary>
|
---|
982 | </indexterm>
|
---|
983 | </listitem>
|
---|
984 | </varlistentry>
|
---|
985 |
|
---|
986 | <varlistentry id="ip6tables">
|
---|
987 | <term><command>ip6tables*</command></term>
|
---|
988 | <listitem>
|
---|
989 | <para>
|
---|
990 | are a set of commands for IPV6 that parallel the iptables
|
---|
991 | commands above
|
---|
992 | </para>
|
---|
993 | <indexterm zone="iptables ip6tables">
|
---|
994 | <primary sortas="b-ip6tables">ip6tables</primary>
|
---|
995 | </indexterm>
|
---|
996 | </listitem>
|
---|
997 | </varlistentry>
|
---|
998 |
|
---|
999 | <varlistentry id="nfsynproxy">
|
---|
1000 | <term><command>nfsynproxy</command></term>
|
---|
1001 | <listitem>
|
---|
1002 | <para>
|
---|
1003 | (optional) configuration tool. SYNPROXY target makes handling of
|
---|
1004 | large SYN floods possible without the large performance penalties
|
---|
1005 | imposed by the connection tracking in such cases
|
---|
1006 | </para>
|
---|
1007 | <indexterm zone="iptables nfsynproxy">
|
---|
1008 | <primary sortas="b-nfsynproxy">nfsynproxy</primary>
|
---|
1009 | </indexterm>
|
---|
1010 | </listitem>
|
---|
1011 | </varlistentry>
|
---|
1012 |
|
---|
1013 | <varlistentry id="xtables-multi">
|
---|
1014 | <term><command>xtables-multi</command></term>
|
---|
1015 | <listitem>
|
---|
1016 | <para>
|
---|
1017 | is a binary that behaves according to the name it is called by
|
---|
1018 | </para>
|
---|
1019 | <indexterm zone="iptables xtables-multi">
|
---|
1020 | <primary sortas="b-xtables-multi">xtables-multi</primary>
|
---|
1021 | </indexterm>
|
---|
1022 | </listitem>
|
---|
1023 | </varlistentry>
|
---|
1024 |
|
---|
1025 | </variablelist>
|
---|
1026 |
|
---|
1027 | </sect2>
|
---|
1028 |
|
---|
1029 | </sect1>
|
---|