User Tools

Site Tools


build:firewall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
build:firewall [2007/01/19 10:50]
128.252.19.11
build:firewall [2009/08/03 16:18] (current)
167.206.189.6
Line 2: Line 2:
  
 We originally went with [[http://​pcxfirewall.sourceforge.net/​|PCX Firewall]] on our test/​development server, as James Pattie was most familiar with it. When we built the production servers, we decided to go with something more standard, so that others would be able to work with it later, if James isn't around. (And he wasn't around when we built the production servers.) So we decided to go with [[http://​www.shorewall.net/​|Shorewall]]. Shorewall also has the advantage that we don't need to provide the IP addresses of the system -- it determines them dynamically. So when we change IP addresses, we don't have to re-configure the firewall. We originally went with [[http://​pcxfirewall.sourceforge.net/​|PCX Firewall]] on our test/​development server, as James Pattie was most familiar with it. When we built the production servers, we decided to go with something more standard, so that others would be able to work with it later, if James isn't around. (And he wasn't around when we built the production servers.) So we decided to go with [[http://​www.shorewall.net/​|Shorewall]]. Shorewall also has the advantage that we don't need to provide the IP addresses of the system -- it determines them dynamically. So when we change IP addresses, we don't have to re-configure the firewall.
 +
 +We currently aren't running a firewall on bock. Solaris 10 ships with IPF, but it has suffered from throughput problems, so we're leaving it off.
  
 ===== Requirements ===== ===== Requirements =====
  
-Shorewall doesn'​t seem to have any requirements,​ except ​perhaps a working network stack.+Shorewall doesn'​t seem to have any requirements,​ except ​''​iptables'',​ ''​iproute'',​ and ''​libatm1''​. 
 +<code rootshell>​ 
 +apt-get install iproute iproute-doc libatm1 
 +</​code>​
  
 All we want from the firewall is basic host protection. (We don't do any routing, so we don't need to worry about packets going **through** the system.) We want to allow all outbound connections,​ and allow inbound connections to only the following ports: All we want from the firewall is basic host protection. (We don't do any routing, so we don't need to worry about packets going **through** the system.) We want to allow all outbound connections,​ and allow inbound connections to only the following ports:
  
   *  22 -- SSH   *  22 -- SSH
-  *  25 -- SMTP+  *  25 -- SMTP (Bud only) 
 +  *  53 -- DNS (Bud only)
   *  80 -- HTTP   *  80 -- HTTP
-  * 110 -- POP+  * 110 -- POP (Bud only)
   * 123 -- NTP (UDP)   * 123 -- NTP (UDP)
-  * 143 -- IMAP+  * 143 -- IMAP (Bud only)
   * 443 -- HTTPS   * 443 -- HTTPS
-  * 993 -- IMAPS +  * 993 -- IMAPS (Bud only) 
-  * 995 -- POPS +  * 995 -- POPS (Bud only)
-  * 10000 -- Webmin ​(HTTPS)+
  
 ===== Installation ===== ===== Installation =====
Line 26: Line 31:
 apt-get install shorewall shorewall-doc apt-get install shorewall shorewall-doc
 </​code>​ </​code>​
- 
 ===== Configuration ===== ===== Configuration =====
  
-In ''/​etc/​default/​shorewall'',​ set shorewall to run by changing ​this line: +In ''/​etc/​default/​shorewall'',​ set shorewall to run by changing ​the ''​startup'' ​line: 
-<file+<code rootshell
-startup=1 +sed -i -e '​s/​startup=0/​startup=1/' /​etc/​default/​shorewall 
-</file>+</code>
  
 Install default config files for systems with one interface: Install default config files for systems with one interface:
 <code rootshell>​ <code rootshell>​
-cd /tmp +cp -a /​usr/​share/​doc/​shorewall/​examples/​one-interface/​* /​etc/​shorewall/​ 
-tar xfz /​usr/​share/​doc/​shorewall-doc/examples/one-interface.tgz +cd /​etc/​shorewall/​ 
-cp one-interface/​* /​etc/​shorewall/​+gunzip *.gz
 </​code>​ </​code>​
  
-In ''/​etc/​shorewall/​shorewall.conf'',​ set some configuration options:+If the system has more than one interface, see the other directories of examples. 
 + 
 +In ''/​etc/​shorewall/​shorewall.conf'',​ set some configuration options. Change the following lines:
 <​file>​ <​file>​
 LOGFILE=/​var/​log/​shorewall.log LOGFILE=/​var/​log/​shorewall.log
 LOGRATE=10/​minute LOGRATE=10/​minute
 LOGBURST=5 LOGBURST=5
-IPTABLES=/​sbin/​iptables 
 </​file>​ </​file>​
  
 Edit ''/​etc/​shorewall/​rules''​ to add some rules to allow various ports inbound: Edit ''/​etc/​shorewall/​rules''​ to add some rules to allow various ports inbound:
 <​file>​ <​file>​
-ACCEPT net fw tcp 22 +ACCEPT net $FW tcp 22 
-ACCEPT net fw tcp 25 +ACCEPT net $FW tcp 25 
-ACCEPT net fw tcp 80 +ACCEPT net $FW tcp 53 
-ACCEPT net fw tcp 110 +ACCEPT net $FW udp 53 
-ACCEPT net fw udp 123 +ACCEPT net $FW tcp 80 
-ACCEPT net fw tcp 143 +ACCEPT net $FW tcp 110 
-ACCEPT net fw tcp 443 +ACCEPT net $FW udp 123 
-ACCEPT net fw tcp 993 +ACCEPT net $FW tcp 143 
-ACCEPT net fw tcp 995 +ACCEPT net $FW tcp 443 
-ACCEPT net fw tcp 10000+ACCEPT net $FW tcp 993 
 +ACCEPT net $FW tcp 995
 </​file>​ </​file>​
 +
 +If the system has more than one interface, duplicate the same rules for each interface unless there is a reason to not do that.  In that case, document the purpose and restrictions for each interface, and why the rules are different.
  
 ===== Startup ===== ===== Startup =====
Line 82: Line 90:
  
 ===== TODO ===== ===== TODO =====
 +
 +Can we restrict some ports to the local subnet?
  
 Determine if our port list is correct for what we need open. We might want to open up additional ports for LMTP, SMTP w/ SSL, and SMTP w/ forced STARTTLS. Perhaps Squid caching and Rsync as well. We might want to remove Webmin and some of the other ports. Determine if our port list is correct for what we need open. We might want to open up additional ports for LMTP, SMTP w/ SSL, and SMTP w/ forced STARTTLS. Perhaps Squid caching and Rsync as well. We might want to remove Webmin and some of the other ports.
Line 98: Line 108:
  
 ===== Comments ===== ===== Comments =====
- 
build/firewall.1169225458.txt.gz · Last modified: 2007/05/30 20:47 (external edit)