[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY iptables-download-http "http://www.iptables.org/files/iptables-&iptables-version;.tar.bz2">
|
---|
| 8 | <!ENTITY iptables-download-ftp "ftp://ftp.netfilter.org/pub/iptables/iptables-&iptables-version;.tar.bz2">
|
---|
[2197589] | 9 | <!ENTITY iptables-size "157 KB">
|
---|
| 10 | <!ENTITY iptables-buildsize "4.4 MB">
|
---|
[b4b71892] | 11 | <!ENTITY iptables-time "0.13 SBU">
|
---|
| 12 | ]>
|
---|
| 13 |
|
---|
[f45b1953] | 14 | <sect1 id="postlfs-security-iptables">
|
---|
[bae6e15] | 15 | <?dbhtml filename="iptables.html"?>
|
---|
[ca3bcd40] | 16 | <title>iptables-&iptables-version;</title>
|
---|
[f45b1953] | 17 |
|
---|
[b4b71892] | 18 | <para>The next part of this chapter deals with firewalls. The principle
|
---|
| 19 | firewall tool for Linux, as of the 2.4 kernel series, is
|
---|
[e760c5c] | 20 | <application>iptables</application>. It replaces
|
---|
| 21 | <application>ipchains</application> from the 2.2 series and
|
---|
[b4b71892] | 22 | <application>ipfwadm</application> from the 2.0 series. You will need to
|
---|
| 23 | install <application>iptables</application> if you intend on using any form of
|
---|
| 24 | a firewall.</para>
|
---|
| 25 |
|
---|
| 26 | <sect2>
|
---|
| 27 | <title>Introduction to <application>iptables</application></title>
|
---|
| 28 |
|
---|
| 29 | <para>To use a firewall, as well as installing
|
---|
| 30 | <application>iptables</application>, you will need
|
---|
| 31 | to configure the relevant options into your kernel. This is discussed
|
---|
[2197589] | 32 | in the next part of this chapter –
|
---|
| 33 | <xref linkend="postlfs-security-fw-kernel"/>.</para>
|
---|
[b4b71892] | 34 |
|
---|
| 35 | <para>If you intend to use <acronym>IP</acronym>v6 you might consider extending
|
---|
| 36 | the kernel by running <command>make patch-o-matic</command> in the top-level
|
---|
[2197589] | 37 | source tree directory of <application>iptables</application>. If you are
|
---|
[b4b71892] | 38 | going to do this, on a freshly untarred kernel, you need to run
|
---|
| 39 | <command>yes "" | make config && make dep</command> first because
|
---|
| 40 | otherwise the patch-o-matic command is likely to fail while setting up
|
---|
| 41 | some dependencies.</para>
|
---|
| 42 |
|
---|
| 43 | <para>If you are going to patch the kernel, you need to do it before you
|
---|
| 44 | compile <application>iptables</application>, because during the compilation,
|
---|
| 45 | the kernel source tree is checked (if it is available at <filename
|
---|
| 46 | class="directory">/usr/src/linux-<replaceable>[version]</replaceable>
|
---|
| 47 | </filename>) to see which features are available. Support will only be compiled
|
---|
| 48 | into <application>iptables</application> for the features recognized at
|
---|
| 49 | compile-time. Applying a kernel patch may result in errors, often because the
|
---|
[2197589] | 50 | hooks for the patches have changed or because the <command>runme</command>
|
---|
| 51 | script doesn't recognize that a patch has already been incorporated.</para>
|
---|
[b4b71892] | 52 |
|
---|
| 53 | <para>Note that for most people, patching the kernel is unnecessary.
|
---|
| 54 | With the later 2.4.x kernels, most functionality is already available
|
---|
| 55 | and those who need to patch it are generally those who need a specific
|
---|
| 56 | feature; if you don't know why you need to patch the kernel, you're
|
---|
| 57 | unlikely to need to!</para>
|
---|
| 58 |
|
---|
| 59 | <sect3><title>Package information</title>
|
---|
| 60 | <itemizedlist spacing='compact'>
|
---|
| 61 | <listitem><para>Download (HTTP): <ulink
|
---|
| 62 | url="&iptables-download-http;"/></para></listitem>
|
---|
| 63 | <listitem><para>Download (FTP): <ulink
|
---|
| 64 | url="&iptables-download-ftp;"/></para></listitem>
|
---|
| 65 | <listitem><para>Download size: &iptables-size;</para></listitem>
|
---|
| 66 | <listitem><para>Estimated Disk space required:
|
---|
| 67 | &iptables-buildsize;</para></listitem>
|
---|
| 68 | <listitem><para>Estimated build time:
|
---|
| 69 | &iptables-time;</para></listitem></itemizedlist>
|
---|
| 70 | </sect3>
|
---|
| 71 |
|
---|
[721f994b] | 72 | <sect3><title>Additional downloads</title>
|
---|
| 73 | <itemizedlist spacing='compact'>
|
---|
| 74 | <listitem><para>Required Patch (fixes a build issue with
|
---|
| 75 | <application>linux</application>-2.6.7): <ulink
|
---|
| 76 | url="&patch-root;/iptables-&iptables-version;-build_fix-1.patch"/></para>
|
---|
| 77 | </listitem>
|
---|
| 78 | </itemizedlist></sect3>
|
---|
| 79 |
|
---|
[b4b71892] | 80 | </sect2>
|
---|
| 81 |
|
---|
| 82 | <sect2>
|
---|
| 83 | <title>Installation of <application>iptables</application></title>
|
---|
| 84 |
|
---|
[2197589] | 85 | <para>Install <application>iptables</application> by running the following
|
---|
| 86 | commands:</para>
|
---|
[b4b71892] | 87 |
|
---|
[721f994b] | 88 | <screen><userinput><command>patch -Np1 -i ../iptables-&iptables-version;-build_fix-1.patch &&
|
---|
| 89 | make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin &&
|
---|
[b4b71892] | 90 | make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin install</command></userinput></screen>
|
---|
| 91 |
|
---|
| 92 | </sect2>
|
---|
| 93 |
|
---|
| 94 | <sect2>
|
---|
| 95 | <title>Command explanations</title>
|
---|
| 96 |
|
---|
[2197589] | 97 | <para><parameter>PREFIX=/usr LIBDIR=/lib BINDIR=/sbin</parameter>: Compiles
|
---|
| 98 | and installs <application>iptables</application> libraries into
|
---|
| 99 | <filename class="directory">/lib</filename>, binaries into
|
---|
| 100 | <filename class="directory">/sbin</filename> and the remainder into the
|
---|
[b4b71892] | 101 | <filename class="directory">/usr</filename> hierarchy instead of
|
---|
| 102 | <filename class="directory">/usr/local</filename>. Firewalls are
|
---|
[2197589] | 103 | generally activated during the boot process and
|
---|
| 104 | <filename class="directory">/usr</filename> may not be mounted at that
|
---|
| 105 | time.</para>
|
---|
[b4b71892] | 106 |
|
---|
| 107 | </sect2>
|
---|
| 108 |
|
---|
| 109 | <sect2>
|
---|
| 110 | <title>Contents</title>
|
---|
| 111 |
|
---|
[2197589] | 112 | <para>The <application>iptables</application> package contains
|
---|
| 113 | <command>iptables</command>, <command>iptables-restore</command>,
|
---|
| 114 | <command>iptables-save</command>, <command>ip6tables</command>
|
---|
| 115 | and the <filename class='libraryfile'>libip*.so</filename> library
|
---|
| 116 | modules.</para>
|
---|
[b4b71892] | 117 |
|
---|
| 118 | </sect2>
|
---|
| 119 |
|
---|
| 120 | <sect2><title>Description</title>
|
---|
| 121 |
|
---|
| 122 | <sect3><title>iptables</title>
|
---|
| 123 | <para><command>iptables</command> is used to set up, maintain, and inspect the
|
---|
| 124 | tables of <acronym>IP</acronym> packet filter rules in the Linux kernel.</para>
|
---|
| 125 | </sect3>
|
---|
| 126 |
|
---|
| 127 | <sect3><title>iptables-restore, iptables-save</title>
|
---|
| 128 | <para>These are used to save and to restore your elaborated set of chains and
|
---|
| 129 | rules. Until <application>iptables</application>-1.2.5, they were declared
|
---|
| 130 | experimental.</para>
|
---|
| 131 | </sect3>
|
---|
| 132 |
|
---|
| 133 | <sect3 id="ip6tables" xreflabel="ip6tables"><title>ip6tables</title>
|
---|
| 134 | <para>This is the same as <command>iptables</command> but for use with
|
---|
| 135 | <acronym>IP</acronym>v6. As of v1.2.5, it is not as complete as the standard
|
---|
[2197589] | 136 | <acronym>IP</acronym>v4 version, especially with regard to some of the
|
---|
| 137 | modules.</para>
|
---|
[b4b71892] | 138 | </sect3>
|
---|
| 139 |
|
---|
[2197589] | 140 | <sect3><title>libip*.so library modules</title>
|
---|
[b4b71892] | 141 | <para>These are various modules (implemented as dynamic libraries) which
|
---|
| 142 | extend the core functionality of <command>iptables</command>.</para>
|
---|
| 143 | </sect3>
|
---|
| 144 |
|
---|
| 145 | </sect2>
|
---|
[f45b1953] | 146 |
|
---|
| 147 | </sect1>
|
---|