Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 29278 | Differences between
and this patch

Collapse All | Expand All

(-)gentoo-security-1.16.xml (-80 / +74 lines)
Lines 2117-2127 Link Here
2117
<body>
2117
<body>
2118
2118
2119
<p>
2119
<p>
2120
People often think that a firewall is the ultimate security, but they are wrong. In most cases a mis configured firewall gives worse security than not having one at all. A firewall is also a piece of software and should be treated the same way as any other service, because is just as likely to have bugs (security holes).
2120
People often think that a firewall provides the ultimate security, but they are wrong. In most cases a misconfigured firewall gives worse security than not having one at all. A firewall is also a piece of software and should be treated the same way as any other piece of software, because is just as likely to contain bugs.
2121
</p>
2121
</p>
2122
2122
2123
<p>
2123
<p>
2124
So think before implementing one! Do you really need one ? If you think you need one write a policy on how it should work, what type of firewall and who should operate it.
2124
So think before implementing one! Do you really need one? If you think you need one write a policy on how it should work, what type of firewall and who should operate it. But first read this guide.
2125
</p>
2125
</p>
2126
2126
2127
<p>
2127
<p>
Lines 2155-2174 Link Here
2155
<body>
2155
<body>
2156
2156
2157
<p>
2157
<p>
2158
All network traffic is in the form of packets. Large amounts of traffic also split up into small packets for easy handling and then reassembled when arriving at it's destination. Every packet contains information on how and where is should be delivered. And these information is exactly what a packing filtering firewall uses. Filtering is based on:
2158
All network traffic is in the form of packets. Large amounts of traffic also split up into small packets for easy handling and then reassembled when arriving at its destination. In the packet header every packet contains information on how and where it should be delivered. And these informations are exactly what a packing filtering firewall uses. Filtering is based on:
2159
</p>
2159
</p>
2160
2160
2161
<ul>
2161
<ul>
2162
2162
2163
<li>Allow or disallow packets based on source/destination IP address.</li>
2163
<li>Allow or disallow packets based on source/destination IP address.</li>
2164
<li>Allow or disallow packets based on source/destination port.</li>
2164
<li>Allow or disallow packets based on source/destination port.</li>
2165
<li>Allow or disallow packets according to protocol.</li>
2165
<li>Allow or disallow packets based on protocol.</li>
2166
<li>Allow or disallow packets according to flags within a specific protocol</li>
2166
<li>Allow or disallow packets based on flags within a specific protocol.</li>
2167
2167
2168
</ul>
2168
</ul>
2169
2169
2170
<p>
2170
<p>
2171
Basically filtering on all data within the header of a packet and not it's content.
2171
Basically filtering is based on all data within the header of a packet and not its content.
2172
</p>
2172
</p>
2173
2173
2174
<p>
2174
<p>
Lines 2176-2184 Link Here
2176
</p>
2176
</p>
2177
2177
2178
<ul>
2178
<ul>
2179
<li>Address information in a packet can potentially be a bogus address or as we say <e>spoofed</e> by the sender</li>
2179
<li>Address information in a packet can potentially be a bogus IP address or as we say <e>spoofed</e> by the sender.</li>
2180
<li>Data or requests within the allowed packet may contain unwanted data that the attacker can use to exploit known bugs in the services on or behind the firewall</li>
2180
<li>Data or requests within the allowed packet may contain unwanted data that the attacker can use to exploit known bugs in the services on or behind the firewall.</li>
2181
<li>Usually single point of failure</li>
2181
<li>Usually single point of failure.</li>
2182
</ul>
2182
</ul>
2183
2183
2184
<p>
2184
<p>
Lines 2186-2194 Link Here
2186
</p>
2186
</p>
2187
2187
2188
<ul>
2188
<ul>
2189
<li>Simple and easy to implement</li>
2189
<li>Simple and easy to implement.</li>
2190
<li>Can give warnings on a possible attack before they happened (by detecting portscans)</li>
2190
<li>Can give warnings of a possible attack before it happeneds (ie. by detecting portscans).</li>
2191
<li>Good for stopping SYN attacks</li>
2191
<li>Good for stopping SYN attacks.</li>
2192
</ul>
2192
</ul>
2193
2193
2194
<p>
2194
<p>
Lines 2209-2228 Link Here
2209
<body>
2209
<body>
2210
2210
2211
<p>
2211
<p>
2212
Or circuit level gateways is a firewall that validates connections before allowing data to be exchanged. This means that is simply does not allow or deny packets based based on the header of the packet but determines whether the connection between both ends is valid according to configurable rules before it opens a session and allows data to and from the allowed source address. Filtering is based on:
2212
Or circuit level gateways is a firewall that validates connections before allowing data to be exchanged. This means that it simply does not allow or deny packets based on the packet header but determines whether the connection between both ends is valid according to configurable rules before it opens a session and allows data to be exchanged. Filtering is based on:
2213
</p>
2213
</p>
2214
2214
2215
<ul>
2215
<ul>
2216
<li>Source/destination IP address</li>
2216
<li>Source/destination IP address.</li>
2217
<li>Source/destination port</li>
2217
<li>Source/destination port.</li>
2218
<li>A period of time</li>
2218
<li>A period of time.</li>
2219
<li>Protocol</li>
2219
<li>Protocol.</li>
2220
<li>User</li>
2220
<li>User.</li>
2221
<li>Password</li>
2221
<li>Password.</li>
2222
</ul>
2222
</ul>
2223
2223
2224
<p>
2224
<p>
2225
All traffic is validated, monitored and traffic without is disallowed.
2225
All traffic is validated, monitored and unwanted traffic can be dropped.
2226
</p>
2226
</p>
2227
2227
2228
<p>
2228
<p>
Lines 2243-2256 Link Here
2243
<body>
2243
<body>
2244
2244
2245
<p>
2245
<p>
2246
The application level gateway is a proxy for application, exchanging data with remote systems on behalf of the clients. It is kept away from the public safely behind a DMZ or firewall with no connection from the outside. Filtering is based on:
2246
The application level gateway is a proxy for applications, exchanging data with remote systems on behalf of the clients. It is kept away from the public safely behind a DMZ (De-Militarized Zone: the protion of a private network that is visible through the firewall.) or a firewall allowing no connections from the outside. Filtering is based on:
2247
</p>
2247
</p>
2248
2248
2249
<ul>
2249
<ul>
2250
<li>Allow or disallow based on source/destination IP address</li>
2250
<li>Allow or disallow based on source/destination IP address.</li>
2251
<li>Based on the packets content</li>
2251
<li>Based on the packets content.</li>
2252
<li>Can even alter the packet content on the fly</li>
2252
<li>Limiting file access based on file type or extension.</li>
2253
<li>Limiting file access based on file type or extension</li>
2254
</ul>
2253
</ul>
2255
2254
2256
<p>
2255
<p>
Lines 2258-2267 Link Here
2258
</p>
2257
</p>
2259
2258
2260
<ul>
2259
<ul>
2261
<li>Can cache files, increasing network performance</li>
2260
<li>Can cache files, increasing network performance.</li>
2262
<li>Detailed logging of all connections</li>
2261
<li>Detailed logging of all connections.</li>
2263
<li>Scales perfectly (some proxy servers can "share" the cached data)</li>
2262
<li>Scales perfectly (some proxy servers can "share" the cached data).</li>
2264
<li>No direct access from the outside</li>
2263
<li>No direct access from the outside.</li>
2264
<li>Can even alter the packet content on the fly.</li>
2265
</ul>
2265
</ul>
2266
2266
2267
<p>
2267
<p>
Lines 2269-2279 Link Here
2269
</p>
2269
</p>
2270
2270
2271
<ul>
2271
<ul>
2272
<li>The setup is complex</li>
2272
<li>Configuration is complex.</li>
2273
</ul>
2273
</ul>
2274
2274
2275
<p>
2275
<p>
2276
Application gateways are considered to be the most secure solution since it does not have to run as root and is not public to the Internet.
2276
Application gateways are considered to be the most secure solution since it does not have to run as root and the hosts behind it are not reachable from the Internet.
2277
</p>
2277
</p>
2278
2278
2279
<p>
2279
<p>
Lines 2292-2298 Link Here
2292
<body>
2292
<body>
2293
2293
2294
<p>
2294
<p>
2295
In order to get iptables working, it has to be enabled in the kernel. I have added them as modules (the iptables command will load them as they are needed) and recompiled my kernel. After you have compiled it (or while compiling the kernel) you have to add the iptables commands. Just <c>emerge iptables</c> and it should work.
2295
In order to get <c>iptables</c> working, it has to be enabled in the kernel. I have added them as modules (the <c>iptables</c> command will load them as they are needed) and recompiled my kernel. For more information on how to configure your kernel for <c>iptables</c> look go to the <uri link="http://iptables-tutorial.frozentux.net/chunkyhtml/kernelsetup.html">Iptables Tutorial Chapter 2. Preparations</uri>. After you have compiled your new kernel (or while compiling the kernel) you have to add the <c>iptables</c> command. Just <c>emerge iptables</c> and it should work.
2296
</p>
2296
</p>
2297
2297
2298
<p>
2298
<p>
Lines 2300-2340 Link Here
2300
</p>
2300
</p>
2301
2301
2302
<p>
2302
<p>
2303
Iptables is a stateful packet filter which means that it provides greater control and greater security than ipchains (Linux version 2.2) which is not stateful. You are properly asking yourself what is the stateful part? and what is the difference?
2303
Iptables is the new and heavily improved packet filter in the Linux 2.4.x kernel. It is the successor of the previous ipchains packet filter in the Linux 2.2.x kernel. One of the major improvements is that <c>iptables</c> is able to perform stateful packet filtering. With stateful packet filtering it is possible to keep track of each established TCP connection.
2304
</p>
2304
</p>
2305
2305
2306
<p>
2306
<p>
2307
We all know that a TCP connection consists of a series of packets. Each packet contains information about source IP address, the destination IP address and a sequence number so the packets can be reassembled. And we all know that TCP is connection-oriented and UDP is connectionless right? these are the states that is stored .. now you are probably asking yourself and so what? Well I'm getting to that.
2307
A TCP connection consists of a series of packets containing information about source IP address, destination IP address, sequence number so the packets can be reassembled and not to forget data. TCP is a connection-oriented protocol in contrast to UDP which is connectionless.
2308
</p>
2308
</p>
2309
2309
2310
<p>
2310
<p>
2311
Now imagine that you have a stateless firewall (ipchains) and do not want to allow external computers to originate a connection to your internal services but how can the firewall determine whether a packet is part of an ongoing connection or not? A stateless firewall cannot distinguish between an existing connection and one that is part of a new connection by looking at the SYN flag!. 
2311
By examining the TCP packet header a stateful packet filter can determine if a received TCP packet is part of an already established connection or not and either accept or drop the packet.
2312
</p>
2312
</p>
2313
2313
2314
<p>
2314
<p>
2315
Lets say an attacker is sending hand crafted packets (a packet created by the attacker) where he alters the SYN flags or any other flags. This is quite often what attackers do. Send packets right through the firewall altering routing tables or compromising services running on the firewall which are supposed to be safe behind a filter. A stateful firewall will keep track of all connections and can thus detect if a received packet does not belong to an existing connection. When a packet not belonging to any existing connection is found it is marked as invalid and can be discarded. This will also stop the possibility of "stealth scans" since the connection was invalid.
2315
With a stateless packet filter it is possible to fool the packet filter to accept packets that should be dropped by manipulating the TCP packet headers. This could be done by manipulating the SYN flag or other flags in the TCP header. With stateful packet filtering it is possible to drop such packets as they are not part of an already established connection. This will also stop the possibility of "stealth scans" since such packets will not be part of an already established connection.
2316
</p>
2316
</p>
2317
2317
2318
<p>
2318
<p>
2319
I could probably find a dozen other reasons but I think you got the picture .. simple rules result in a smaller firewall configuration that is easier to maintain.
2319
Iptables provides several other features like NAT (Network Address Translation) and rate limiting. Rate limiting is extremely useful when trying to prevent certain DoS (Denial of Service) attacks like SYN floods.
2320
</p>
2320
</p>
2321
2321
2322
<p>
2322
<p>
2323
Iptables provides several other features like rate limiting. This features is extremely useful when trying to prevent certain DoS (Denial of Service) attacks like a SYN attack. Now what is a SYN attack?
2323
A TCP connection is established by a so called three-way handshake. When establishing a TCP connection the client-side sends a packet to the server with the SYN flag set. When the server-side receives the SYN packet it responds by sending a SYNACK packet back to the client-side. When the SYNACK is received the client-side responds with a third ACK packet in effect acknowledging the connection.
2324
</p>
2324
</p>
2325
2325
2326
<p>
2326
<p>
2327
Again .. when creating a connection with TCP it uses three-way handshake to establish the connection like this:
2327
A SYN flood attack is performed by sending the SYN packet but failing to respond to the SYNACK packet. The client-side can forge a packet with a fake source IP address because it does not need a reply. The server-side system will add an entry to a queue of half-open connections when it receives the SYN packet and then wait for the final ACK packet before deleting the entry from the queue. The queue has a limitied number of slots and if all the slots are filled it is unable to open any further connections. If the ACK packet is not received before a specified timeout period the entry will automatically be deleted from the queue. The timeout settings vary but will typically be 30-60 seconds or even more. The client-side initiates the attack by forging a lot of SYN packets with different source IP addresses and sends them to the target IP address as fast as possible and thereby filling up the queue of half-open connections and thus preventing other clients from establishing legitimate with the server.
2328
</p>
2329
2330
<fig link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/synack.jpg" short="Three-way handshake"/>
2331
2332
<p>
2333
A SYN attack is when it only sends a SYN packet (header only contains SYN flag) and does not continue sending the last two packets to establish the connection. A SYN packet does not require a valid source IP address because it does not need a reply. So the connection will hang until it times out. Now if the attacker sends a lot of SYN packets with a bogus source IP address, the computer waits for the response, which never comes. Depending on the timeout settings in your system, this connection could stay open for 30-60 seconds (or longer). When the connection limit table is completely occupied and unable to communicate with anyone.
2334
</p>
2328
</p>
2335
2329
2336
<p>
2330
<p>
2337
This is where the rate limit becomes handy. It is possible to limit the number of SYN packets from a single source but using the <c>-m limit --limit 1/s</c>. This will limit the SYN packets to one per source and therefor restricting the SYN flood on our resources.
2331
This is where the rate limit becomes handy. It is possible to limit the number of accepted SYN packets from a single source but using the <c>-m limit --limit 1/s</c>. This will limit the SYN packets to one per source and therefor restricting the SYN flood on our resources.
2338
</p>
2332
</p>
2339
2333
2340
<p>
2334
<p>
Lines 2342-2352 Link Here
2342
</p>
2336
</p>
2343
2337
2344
<p>
2338
<p>
2345
When iptables is loaded in the kernel it has 5 hooks where you can place your rules. They are called INPUT, OUTPUT FORWARD, PREROUTING and POSTROUTING. These lists are called chains because they work by added a rules and checks the rules one at the time as they where added. If one rule deny a packet it will be dropped and does not continue down the chain.
2339
When <c>iptables</c> is loaded in the kernel it has 5 hooks where you can place your rules. They are called INPUT, OUTPUT FORWARD, PREROUTING and POSTROUTING. Each of these is called a chain and consists of a list of rules. Each rule says if the packet header looks like this, then here is what to do with the packet. If the rule does not match the packet the next rule in the chain is consulted.
2346
</p>
2340
</p>
2347
2341
2348
<p>
2342
<p>
2349
You can place rules directly to the 5 main chains or create chains and add them to as a rule to an existing chain. Lets see how this is done
2343
You can place rules directly in the 5 main chains or create new chains and add them to as a rule to an existing chain. <c>iptables</c> supports the following options.
2350
</p>
2344
</p>
2351
2345
2352
<table border="0">
2346
<table border="0">
Lines 2434-2440 Link Here
2434
</table>
2428
</table>
2435
2429
2436
<p>
2430
<p>
2437
First we will try to block all ICMP packages to our machine, just to get familiar with iptables.
2431
First we will try to block all ICMP packages to our machine, just to get familiar with <c>iptables</c>.
2438
</p>
2432
</p>
2439
2433
2440
<pre caption="Block all ICMP packages">
2434
<pre caption="Block all ICMP packages">
Lines 2442-2452 Link Here
2442
</pre>
2436
</pre>
2443
2437
2444
<p>
2438
<p>
2445
First we specify the chain it should be appended to. Next to specify the protocol and then the rule. The rule can be a ACCEPT, DROP, REJECT, LOG, QUEUE, MASQUERADE, a loaded module or a user defined chain. In this case we use DROP which will drop the packet without responding to the client.
2439
First we specify the chain it should be appended to next the protocol and then the target. The target can be the name of a user specified chain or one of the special targets ACCEPT, DROP, REJECT, LOG, QUEUE, MASQUERADE. In this case we use DROP which will drop the packet without responding to the client.
2446
</p>
2440
</p>
2447
2441
2448
<p>
2442
<p>
2449
Now try <c>ping localhost</c>. It will not be able to get any response since it is blocking the entire ICMP protocol incoming to our machine. It will not be able to ping other machines either since it is not allowed to get the ICMP packets returning from the host. Now flush the chain to get ICMP flowing again.
2443
Now try <c>ping localhost</c>. It will not be able to get any response since <c>iptables</c> will drop all incoming ICMP messages. It will not be able to ping other machines either since the ICMP reply packet will be dropped. Now flush the chain to get ICMP flowing again.
2450
</p>
2444
</p>
2451
2445
2452
<pre caption="Flush all rules">
2446
<pre caption="Flush all rules">
Lines 2454-2460 Link Here
2454
</pre>
2448
</pre>
2455
2449
2456
<p>
2450
<p>
2457
Now lets look at the stateful part in iptables. If we wanted to have a stateful inspection of packets incoming on eth0 we could enable it by issuing:
2451
Now lets look at the stateful packet filtering in <c>iptables</c>. If we wanted to have a stateful inspection of packets incoming on eth0 we could enable it by issuing:
2458
</p>
2452
</p>
2459
2453
2460
<pre caption="Accept packets that originate from an already established connection">
2454
<pre caption="Accept packets that originate from an already established connection">
Lines 2462-2468 Link Here
2462
</pre>
2456
</pre>
2463
2457
2464
<p>
2458
<p>
2465
This will accept any packet already established or related in the INPUT chain. And you could drop any packet that is not in the state table by issuing <c>iptables -A INPUT -i eth0 -m state --state INVALID -j DROP</c> just before. This enables the stateful part in iptables by loading the extension state. If you wanted connection from the outside to connect to you machine you could use the <c>--state NEW</c>. Iptables contain some modules for different purposes. Some of them are: 
2459
This will accept any packet from an already established connection or related in the INPUT chain. And you could drop any packet that is not in the state table by issuing <c>iptables -A INPUT -i eth0 -m state --state INVALID -j DROP</c> just before. This enables the stateful packet filtering in <c>iptables</c> by loading the extension state. If you wanted to allow others to connect to you machine you could use the <c>--state NEW</c>. Iptables contain some modules for different purposes. Some of them are: 
2466
</p>
2460
</p>
2467
2461
2468
<table border="0">
2462
<table border="0">
Lines 2490-2496 Link Here
2490
Lets try to create a user defined chain and apply it to one of the existing chains:
2484
Lets try to create a user defined chain and apply it to one of the existing chains:
2491
</p>
2485
</p>
2492
2486
2493
<pre caption="Creating a userdefined chain">
2487
<pre caption="Creating a user defined chain">
2494
<codenote>Create a new chain with one rule</codenote>
2488
<codenote>Create a new chain with one rule</codenote>
2495
# <i>iptables -X mychain</i>
2489
# <i>iptables -X mychain</i>
2496
# <i>iptables -N mychain</i>
2490
# <i>iptables -N mychain</i>
Lines 2515-2526 Link Here
2515
</p>
2509
</p>
2516
2510
2517
<ul>
2511
<ul>
2518
  <li>Connections to the firewall is only allowed through SSH (port 22)</li>
2512
  <li>Connections to the firewall are only allowed through SSH (port 22).</li>
2519
  <li>The local network should have access to HTTP, HTTPS and SSH (DNS should also be allowed)</li>
2513
  <li>The local network should have access to HTTP, HTTPS and SSH (DNS should also be allowed).</li>
2520
  <li>ICMP traffic can contain payload and should not be allowed. Of course we have to allow some ICMP traffic.</li>
2514
  <li>ICMP traffic can contain payload and should not be allowed. Of course we have to allow some ICMP traffic.</li>
2521
  <li>Port scan should be detected and logged</li>
2515
  <li>Port scans should be detected and logged.</li>
2522
  <li>SYN attack should be avoided</li>
2516
  <li>SYN attacks should be avoided.</li>
2523
  <li>All other traffic should be dropped and logged</li>
2517
  <li>All other traffic should be dropped and logged.</li>
2524
</ul>
2518
</ul>
2525
2519
2526
<pre caption="/etc/init.d/firewall">
2520
<pre caption="/etc/init.d/firewall">
Lines 2738-2752 Link Here
2738
</p>
2732
</p>
2739
2733
2740
<ol>
2734
<ol>
2741
  <li>Create your firewall policy before implementing it</li>
2735
  <li>Create your firewall policy before implementing it.</li>
2742
  <li>Keep it simple</li>
2736
  <li>Keep it simple.</li>
2743
  <li>Know how the protocol works (read the <uri link="http://www.ietf.org/">RFC (Request For Comments)</uri>)</li>
2737
  <li>Know how the protocol works (read the <uri link="http://www.ietf.org/">RFC (Request For Comments)</uri>).</li>
2744
  <li>Keep in mind that a firewall it just another piece of software running as root</li>
2738
  <li>Keep in mind that a firewall it just another piece of software running as root.</li>
2745
  <li>Test your firewall</li>
2739
  <li>Test your firewall.</li>
2746
</ol>
2740
</ol>
2747
2741
2748
<p>
2742
<p>
2749
If you think that iptables is hard to understand or takes to long to setup a decent firewall you could use <uri link="http://www.shorewall.net">Shorewall</uri>. It basically uses iptables to generate firewall rules, but concentrates on rules and not specific protocols.
2743
If you think that <c>iptables</c> is hard to understand or takes to long to setup a decent firewall you could use <uri link="http://www.shorewall.net">Shorewall</uri>. It basically uses <c>iptables</c> to generate firewall rules, but concentrates on rules and not specific protocols.
2750
</p>
2744
</p>
2751
2745
2752
</body>
2746
</body>
Lines 2757-2767 Link Here
2757
<body>
2751
<body>
2758
2752
2759
<p>
2753
<p>
2760
Squid is a very powerful proxy server and it can filter traffic based on: time, regular expression path/uri, source and destination IP addresses, domain, browser, authenticated username, mime-type and port number(protocol). I probably forgot some features, but it can be hard to cover the entire feature list.
2754
Squid is a very powerful proxy server and it can filter traffic based on: time, regular expressions on path/URI, source and destination IP addresses, domain, browser, authenticated username, MIME type and port number (protocol). I probably forgot some features, but it can be hard to cover the entire feature list.
2761
</p> 
2755
</p> 
2762
2756
2763
<p>
2757
<p>
2764
In the following example I have added a banner filter instead of a filter based on porn sites. The reason for this is that Gentoo.org should <c>not</c> be listed as some porn site. And I do not want to waste my time trying to find some good sites for you.
2758
In the following example I have added a banner filter instead of a filter based on porn sites. The reason for this is that Gentoo.org should <e>not</e> be listed as some porn site. And I do not want to waste my time trying to find some good sites for you.
2765
</p>
2759
</p>
2766
2760
2767
<p>
2761
<p>
Lines 2769-2778 Link Here
2769
</p>
2763
</p>
2770
2764
2771
<ul>
2765
<ul>
2772
  <li>Surfing (HTTP/HTTPS) is allowed during work hours (mon-fri 8-17 and sat 8-13) if they are here late they should work, not surf</li>
2766
  <li>Surfing (HTTP/HTTPS) is allowed during work hours (mon-fri 8-17 and sat 8-13) if they are here late they should work, not surf.</li>
2773
  <li>Download is not allowed (.exe, .com, .arj, .zip, .asf, .avi, .mpg, .mpeg etc.)</li>
2767
  <li>Download is not allowed (.exe, .com, .arj, .zip, .asf, .avi, .mpg, .mpeg etc).</li>
2774
  <li>We don't like banners so they are filtered and replaced with a transparent gif (this is where you get creative!)</li>
2768
  <li>We do not like banners so they are filtered and replaced with a transparent gif (this is where you get creative!).</li>
2775
  <li>Every other connection to and from the Internet is not allowed</li>
2769
  <li>All other connections to and from the Internet are not allowed.</li>
2776
</ul>
2770
</ul>
2777
2771
2778
<p>
2772
<p>
Lines 2913-2919 Link Here
2913
</pre>
2907
</pre>
2914
2908
2915
<p>
2909
<p>
2916
And the last part. We want this file to be displayed when it removes a banner. It is basically a half html file with a 4x4 transparent gif image.
2910
And as the last part we want this file to be displayed when a banner is removed. It is basically a half html file with a 4x4 transparent gif image.
2917
</p>
2911
</p>
2918
2912
2919
<pre caption="/etc/squid/errors/NOTE_ADS_FILTERED">
2913
<pre caption="/etc/squid/errors/NOTE_ADS_FILTERED">
Lines 2927-2952 Link Here
2927
</pre>
2921
</pre>
2928
2922
2929
<note>
2923
<note>
2930
Don't close the &lt;HTML&gt; &lt;BODY&gt; tags. This will be done by squid.
2924
Do not close the &lt;HTML&gt; &lt;BODY&gt; tags. This will be done by squid.
2931
</note>
2925
</note>
2932
2926
2933
<p>
2927
<p>
2934
As you can see, squid has a lot of possibilities and it is very effective in both filtering and proxying. It can even use alternative squid proxies to scale on very large networks. The configuration I have listed here is mostly suited for a small network with 1-20 users.
2928
As you can see, squid has a lot of possibilities and it is very effective at both filtering and proxying. It can even use alternative squid proxies to scale on very large networks. The configuration I have listed here is mostly suited for a small network with 1-20 users.
2935
</p>
2929
</p>
2936
2930
2937
<p>
2931
<p>
2938
But combining the packet filter (iptables) and the application gateway (squid) is probably the best solution, even if squid is located somewhere safe and nobody could access it from the outside. We still need to be concerned on attack from the inside.
2932
But combining the packet filter (<c>iptables</c>) and the application gateway (squid) is probably the best solution, even if squid is located somewhere safe and nobody can access it from the outside. We still need to be concerned by attacks from the inside.
2939
</p>
2933
</p>
2940
2934
2941
<p>
2935
<p>
2942
Now you have to add the proxy server into the settings of your clients browsers. The gateway will prevent the users from having any contact with the outside unless they use the proxy.
2936
Now you have to configure your clients browsers to use the proxy server. The gateway will prevent the users from having any contact with the outside unless they use the proxy.
2943
</p>
2937
</p>
2944
<note>
2938
<note>
2945
In Mozilla this is done in Edit->Preferences->Advanced->Proxies.
2939
In Mozilla this is done in Edit->Preferences->Advanced->Proxies.
2946
</note>
2940
</note>
2947
2941
2948
<p>
2942
<p>
2949
It can also be done transparently by using iptables to forward all traffic out to a squid proxy. This can be done by adding a forwarding/prerouting rule on the gateway:
2943
It can also be done transparently by using <c>iptables</c> to forward all outbound traffic to a squid proxy. This can be done by adding a forwarding/prerouting rule on the gateway:
2950
</p>
2944
</p>
2951
2945
2952
<pre caption="Enable portforwarding to our proxyserver">
2946
<pre caption="Enable portforwarding to our proxyserver">
Lines 2967-2979 Link Here
2967
</p>
2961
</p>
2968
2962
2969
<ol>
2963
<ol>
2970
  <li>A firewall can be a risk itself. A badly configured firewall is worse than not having one at all.</li>
2964
  <li>A firewall can be a risk in itself. A badly configured firewall is worse than not having one at all.</li>
2971
  <li>How to setup a basic gateway and a transparent proxy.</li>
2965
  <li>How to setup a basic gateway and a transparent proxy.</li>
2972
  <li>The key to a good firewall is to know the protocol you want do allow.</li>
2966
  <li>The key to a good firewall is to know the protocol you want do allow.</li>
2973
  <li>That IP traffic does not always contain legitimate data. For an example ICMP packets with payload.</li>
2967
  <li>That IP traffic does not always contain legitimate data ie. ICMP packets can contain payload.</li>
2974
  <li>How to prevent SYN attack.</li>
2968
  <li>How to prevent SYN attack.</li>
2975
  <li>Filtering HTTP traffic by removing offensive pictures and downloads of viruses.</li>
2969
  <li>Filtering HTTP traffic by removing offensive pictures and downloads of viruses.</li>
2976
  <li>Combining packet filters and application gateways gives a better control.</li>
2970
  <li>Combining packet filters and application gateways provides better control.</li>
2977
</ol>
2971
</ol>
2978
2972
2979
<p>
2973
<p>

Return to bug 29278