[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[b4b71892] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[dd362e5] | 8 | <sect1 id="fw-firewall" xreflabel="Firewalling">
|
---|
[8920dfa] | 9 | <?dbhtml filename="firewall.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
| 12 | <othername>$LastChangedBy$</othername>
|
---|
| 13 | <date>$Date$</date>
|
---|
| 14 | </sect1info>
|
---|
| 15 |
|
---|
| 16 | <title>Setting Up a Network Firewall</title>
|
---|
| 17 |
|
---|
| 18 | <sect2 id="fw-intro" xreflabel="Firewalling Introduction">
|
---|
| 19 | <title>Introduction to Firewall Creation</title>
|
---|
| 20 |
|
---|
[018c0cc3] | 21 | <para>
|
---|
| 22 | The purpose of a firewall is to protect a computer or a network against
|
---|
| 23 | malicious access. In a perfect world every daemon or service, on every
|
---|
| 24 | machine, is perfectly configured and immune to security flaws, and all
|
---|
| 25 | users are trusted implicitly to use the equipment as intended. However,
|
---|
| 26 | this is rarely, if ever, the case. Daemons may be misconfigured, or
|
---|
| 27 | updates may not have been applied for known exploits against essential
|
---|
| 28 | services. Additionally, you may wish to choose which services are
|
---|
| 29 | accessible by certain machines or users, or you may wish to limit which
|
---|
| 30 | machines or applications are allowed external access. Alternatively, you
|
---|
| 31 | simply may not trust some of your applications or users. For these
|
---|
| 32 | reasons, a carefully designed firewall should be an essential part of
|
---|
| 33 | system security.
|
---|
| 34 | </para>
|
---|
| 35 |
|
---|
| 36 | <para>
|
---|
| 37 | While a firewall can greatly limit the scope of the above issues, do not
|
---|
| 38 | assume that having a firewall makes careful configuration redundant, or
|
---|
| 39 | that any negligent misconfiguration is harmless. A firewall does not
|
---|
| 40 | prevent the exploitation of any service you offer outside of it. Despite
|
---|
| 41 | having a firewall, you need to keep applications and daemons properly
|
---|
| 42 | configured and up to date.
|
---|
| 43 | </para>
|
---|
[8920dfa] | 44 |
|
---|
| 45 | </sect2>
|
---|
| 46 |
|
---|
| 47 | <sect2>
|
---|
| 48 | <title>Meaning of the Word "Firewall"</title>
|
---|
| 49 |
|
---|
[018c0cc3] | 50 | <para>
|
---|
| 51 | The word firewall can have several different meanings.
|
---|
| 52 | </para>
|
---|
[8920dfa] | 53 |
|
---|
| 54 | <sect3>
|
---|
[018c0cc3] | 55 | <title>Personal Firewall</title>
|
---|
[8920dfa] | 56 |
|
---|
[018c0cc3] | 57 | <para>
|
---|
| 58 | This is a hardware device or software program, intended to secure a
|
---|
| 59 | home or desktop computer connected to the Internet. This type of
|
---|
| 60 | firewall is highly relevant for users who do not know how their
|
---|
| 61 | computers might be accessed via the Internet or how to disable
|
---|
| 62 | that access, especially if they are always online and connected
|
---|
| 63 | via broadband links.
|
---|
| 64 | </para>
|
---|
| 65 |
|
---|
| 66 | <para>
|
---|
| 67 | An example configuration for a personal firewall is provided at
|
---|
| 68 | <xref linkend="fw-persFw-ipt"/>.
|
---|
| 69 | </para>
|
---|
[8920dfa] | 70 |
|
---|
| 71 | </sect3>
|
---|
| 72 |
|
---|
| 73 | <sect3>
|
---|
[018c0cc3] | 74 | <title>Masquerading Router</title>
|
---|
[8920dfa] | 75 |
|
---|
[018c0cc3] | 76 | <para>
|
---|
| 77 | This is a system placed between the Internet and an intranet.
|
---|
| 78 | To minimize the risk of compromising the firewall itself, it should
|
---|
| 79 | generally have only one role—that of protecting the intranet.
|
---|
| 80 | Although not completely risk-free, the tasks of doing the routing and
|
---|
| 81 | IP masquerading (rewriting IP headers of the packets it routes from
|
---|
| 82 | clients with private IP addresses onto the Internet so that they seem
|
---|
| 83 | to come from the firewall itself) are commonly considered relatively
|
---|
| 84 | secure.
|
---|
| 85 | </para>
|
---|
| 86 |
|
---|
| 87 | <para>
|
---|
| 88 | An example configuration for a masquerading firewall is provided at
|
---|
| 89 | <xref linkend="fw-masqRouter-ipt"/>.
|
---|
| 90 | </para>
|
---|
[8920dfa] | 91 |
|
---|
| 92 | </sect3>
|
---|
| 93 |
|
---|
[d612b9f] | 94 | <sect3>
|
---|
[018c0cc3] | 95 | <title>BusyBox</title>
|
---|
| 96 |
|
---|
| 97 | <para>
|
---|
| 98 | This is often an old computer you may have retired and nearly
|
---|
| 99 | forgotten, performing masquerading or routing functions, but offering
|
---|
| 100 | non-firewall services such as a web-cache or mail. This may be used
|
---|
| 101 | for home networks, but is not to be considered as secure as a firewall
|
---|
| 102 | only machine because the combination of server and router/firewall on
|
---|
| 103 | one machine raises the complexity of the setup.
|
---|
| 104 | </para>
|
---|
[8920dfa] | 105 |
|
---|
[018c0cc3] | 106 | <para>
|
---|
| 107 | An example configuration for a BusyBox is provided at
|
---|
| 108 | <xref linkend="fw-busybox-ipt"/>.
|
---|
| 109 | </para>
|
---|
[8920dfa] | 110 |
|
---|
| 111 | </sect3>
|
---|
| 112 |
|
---|
| 113 | <sect3>
|
---|
[018c0cc3] | 114 | <title>Firewall with a Demilitarized Zone</title>
|
---|
| 115 |
|
---|
| 116 | <para>
|
---|
| 117 | This type of firewall performs masquerading or routing, but grants
|
---|
| 118 | public access to some branch of your network that is physically
|
---|
| 119 | separated from your regular intranet and is essentially a separate
|
---|
| 120 | network with direct Internet access. The servers on this network are
|
---|
| 121 | those which must be easily accessible from both the Internet and
|
---|
| 122 | intranet. The firewall protects both networks. This type of firewall
|
---|
| 123 | has a minimum of three network interfaces.
|
---|
| 124 | </para>
|
---|
[8920dfa] | 125 |
|
---|
| 126 | </sect3>
|
---|
| 127 |
|
---|
| 128 | <sect3>
|
---|
| 129 | <title>Packetfilter</title>
|
---|
| 130 |
|
---|
[018c0cc3] | 131 | <para>
|
---|
| 132 | This type of firewall does routing or masquerading but does
|
---|
| 133 | not maintain a state table of ongoing communication streams. It is
|
---|
| 134 | fast but quite limited in its ability to block undesired packets
|
---|
| 135 | without blocking desired packets.
|
---|
| 136 | </para>
|
---|
[8920dfa] | 137 |
|
---|
| 138 | </sect3>
|
---|
| 139 |
|
---|
| 140 | </sect2>
|
---|
| 141 |
|
---|
[018c0cc3] | 142 | <sect2>
|
---|
| 143 | <title>Conclusion</title>
|
---|
[8920dfa] | 144 |
|
---|
| 145 | <caution>
|
---|
[018c0cc3] | 146 | <para>
|
---|
| 147 | The example configurations provided for <xref linkend="iptables"/>
|
---|
| 148 | <!-- and <xref linkend="nftables"/> -->
|
---|
| 149 | are not intended to be a complete guide to
|
---|
| 150 | securing systems. Firewalling is a complex issue that requires careful
|
---|
| 151 | configuration. The configurations provided by BLFS are intended only to
|
---|
| 152 | give examples of how a firewall works. They are not intended to fit any
|
---|
| 153 | particular configuration and may not provide complete protection from
|
---|
| 154 | an attack.
|
---|
| 155 | </para>
|
---|
[8920dfa] | 156 | </caution>
|
---|
[018c0cc3] | 157 | <!--
|
---|
| 158 | <para>
|
---|
| 159 | BLFS provides two utilities to manage the kernel Netfilter interface,
|
---|
| 160 | <xref linkend="iptables"/> and <xref linkend="nftables"/>.
|
---|
| 161 | </para>
|
---|
| 162 | -->
|
---|
| 163 | <para>
|
---|
| 164 | BLFS provides an utility to manage the kernel Netfilter interface,
|
---|
| 165 | <xref linkend="iptables"/>. It has been around since early 2.4 kernels,
|
---|
| 166 | and has been the standard since. This is likely the set of tools that
|
---|
| 167 | will be most familiar to existing admins. Other tools have been
|
---|
| 168 | developped more recently, see the list of further readings below
|
---|
| 169 | for more details. Here you will find a
|
---|
| 170 | list of URLs that contain comprehensive information about building
|
---|
| 171 | firewalls and further securing your system.
|
---|
| 172 | </para>
|
---|
| 173 | <!--
|
---|
| 174 | <para>
|
---|
| 175 | <xref linkend="nftables"/> is the successor to <xref linkend="iptables"/>
|
---|
| 176 | and provies all of the same functionality with a single userspace tool,
|
---|
| 177 | <command>nft</command>, that uses similar syntax to BSD's
|
---|
| 178 | <application>pf</application> utility, and may be easier for new users or
|
---|
| 179 | admins already familiar with that platform.
|
---|
| 180 | </para>
|
---|
| 181 |
|
---|
| 182 | <para>
|
---|
| 183 | While both can be used in tandem, that is an advanced configuration and
|
---|
| 184 | you should decide on one or the other. Both pages include very simple
|
---|
| 185 | example configurations, and customization of the provided configurations
|
---|
| 186 | for your specific environment will be necessary if you elect to use
|
---|
| 187 | either without a configuration tool.
|
---|
| 188 | </para>
|
---|
| 189 |
|
---|
| 190 | <para>
|
---|
| 191 | Additionally, a firewall management tool, <xref linkend="firewalld"/>, is
|
---|
| 192 | provided to greatly ease firewall configuration for both simple and
|
---|
| 193 | complex environments, and can be used with either tool. You should not
|
---|
| 194 | use the example configurations if you intend to use
|
---|
| 195 | <application>firewalld</application> to manage your firewall rules.
|
---|
| 196 | </para>
|
---|
| 197 |
|
---|
| 198 | <para>
|
---|
| 199 | If you elect to configure manually, have a look at the
|
---|
| 200 | list of further reading below for more details. Here you will find a
|
---|
| 201 | list of URLs that contain comprehensive information about building
|
---|
| 202 | firewalls and further securing your system.
|
---|
| 203 | </para>
|
---|
| 204 | -->
|
---|
[8920dfa] | 205 | </sect2>
|
---|
[b4b71892] | 206 |
|
---|
[018c0cc3] | 207 | <sect2 id="fw-extra-info">
|
---|
[8920dfa] | 208 | <title>Extra Information</title>
|
---|
[b4b71892] | 209 |
|
---|
[018c0cc3] | 210 | <sect3>
|
---|
| 211 | <title>Further Reading on Firewalls</title>
|
---|
[8920dfa] | 212 |
|
---|
| 213 | <blockquote>
|
---|
| 214 | <literallayout>
|
---|
[018c0cc3] | 215 | <ulink url="http://www.netfilter.org/">www.netfilter.org - Homepage of the netfilter/iptables/nftables projects</ulink>
|
---|
[b4b71892] | 216 | <ulink url="http://www.netfilter.org/documentation/FAQ/netfilter-faq.html">Netfilter related FAQ</ulink>
|
---|
| 217 | <ulink url="http://www.netfilter.org/documentation/index.html#HOWTO">Netfilter related HOWTO's</ulink>
|
---|
[018c0cc3] | 218 | <ulink url="https://wiki.nftables.org/wiki-nftables/index.php/Main_Page">nftables HOWTO</ulink>
|
---|
[b4b71892] | 219 | <ulink url="http://en.tldp.org/LDP/nag2/x-087-2-firewall.html">en.tldp.org/LDP/nag2/x-087-2-firewall.html</ulink>
|
---|
| 220 | <ulink url="http://en.tldp.org/HOWTO/Security-HOWTO.html">en.tldp.org/HOWTO/Security-HOWTO.html</ulink>
|
---|
| 221 | <ulink url="http://en.tldp.org/HOWTO/Firewall-HOWTO.html">en.tldp.org/HOWTO/Firewall-HOWTO.html</ulink>
|
---|
| 222 | <ulink url="http://www.linuxsecurity.com/docs/">www.linuxsecurity.com/docs/</ulink>
|
---|
| 223 | <ulink url="http://www.little-idiot.de/firewall">www.little-idiot.de/firewall (German & outdated, but very comprehensive)</ulink>
|
---|
| 224 | <ulink url="http://linux.oreillynet.com/pub/a/linux/2000/03/10/netadmin/ddos.html">linux.oreillynet.com/pub/a/linux/2000/03/10/netadmin/ddos.html</ulink>
|
---|
| 225 | <ulink url="http://staff.washington.edu/dittrich/misc/ddos">staff.washington.edu/dittrich/misc/ddos</ulink>
|
---|
| 226 | <ulink url="http://www.e-infomax.com/ipmasq">www.e-infomax.com/ipmasq</ulink>
|
---|
| 227 | <ulink url="http://www.circlemud.org/~jelson/writings/security/index.htm">www.circlemud.org/~jelson/writings/security/index.htm</ulink>
|
---|
| 228 | <ulink url="http://www.securityfocus.com">www.securityfocus.com</ulink>
|
---|
| 229 | <ulink url="http://www.cert.org/tech_tips/">www.cert.org - tech_tips</ulink>
|
---|
| 230 | <ulink url="http://security.ittoolbox.com/">security.ittoolbox.com</ulink>
|
---|
| 231 | <ulink url="http://www.insecure.org/reading.html">www.insecure.org/reading.html</ulink>
|
---|
[8920dfa] | 232 | </literallayout>
|
---|
| 233 | </blockquote>
|
---|
| 234 |
|
---|
| 235 | </sect3>
|
---|
| 236 |
|
---|
| 237 | </sect2>
|
---|
[b4b71892] | 238 |
|
---|
[f45b1953] | 239 | </sect1>
|
---|