From 4b7193460b7dcef8557ab106a09d4706b905b6a2 Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 6 Jan 2004 22:30:10 +0000 Subject: [PATCH] More standards work git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1062 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-docs/standalone.xml | 299 +++++++++---------------------- Shorewall-docs/two-interface.xml | 217 ++++++---------------- 2 files changed, 143 insertions(+), 373 deletions(-) diff --git a/Shorewall-docs/standalone.xml b/Shorewall-docs/standalone.xml index d51e2d043..9d9bde8b2 100644 --- a/Shorewall-docs/standalone.xml +++ b/Shorewall-docs/standalone.xml @@ -15,12 +15,10 @@ - 2003-11-15 + 2004-01-06 - 2002 - - 2003 + 2002-2004 Thomas M. Eastep @@ -111,9 +109,10 @@
PPTP/ADSL - If you - have an ADSL Modem and you use PPTP to communicate with a server in that - modem, you must make the changes + + + If you have an ADSL Modem and you use PPTP to communicate with a + server in that modem, you must make the changes recommended here in addition to those described in the steps below. ADSL with PPTP is most commonly found in Europe, notably in Austria. @@ -122,11 +121,13 @@
Shorewall Concepts - The - configuration files for Shorewall are contained in the directory - /etc/shorewall -- for simple setups, you only need to deal with a few of - these as described in this guide. After you have installed - Shorewall, download the + + The configuration files for Shorewall are contained in the directory + /etc/shorewall -- for simple + setups, you only need to deal with a few of these as described in this + guide. After you have installed Shorewall, + download the one-interface sample, un-tar it (tar -zxvf one-interface.tgz) and and copy the files to /etc/shorewall (they will replace files with the same names that @@ -160,7 +161,7 @@ - Shorewall zones are defined in /etc/shorewall/zones. + Shorewall zones are defined in /etc/shorewall/zones. Shorewall also recognizes the firewall system as its own zone - by default, the firewall itself is known as fw. @@ -171,84 +172,33 @@ You express your default policy for connections from one zone to - another zone in the /etc/shorewall/policy + another zone in the /etc/shorewall/policy file. You define exceptions to those default policies in the /etc/shorewall/rules file. + url="Documentation.htm#Rules">/etc/shorewall/rules + file. For each connection request entering the firewall, the request is - first checked against the /etc/shorewall/rules file. If no rule in that - file matches the connection request then the first policy in - /etc/shorewall/policy that matches the request is applied. If that policy - is REJECT or DROP the request is first checked against the rules in - /etc/shorewall/common if that file exists; otherwise the rules in - /etc/shorewall/common.def are checked. + first checked against the /etc/shorewall/rules + file. If no rule in that file matches the connection request then the + first policy in /etc/shorewall/policy that matches + the request is applied. If that policy is REJECT or DROP the request is + first checked against the rules in /etc/shorewall/common if that file + exists; otherwise the rules in /etc/shorewall/common.def + are checked. - The /etc/shorewall/policy file included with the one-interface - sample has the following policies: + The /etc/shorewall/policy file included with + the one-interface sample has the following policies: - - one-interface sample /etc/shorewall/policy - - - - - SOURCE ZONE - - DESTINATION ZONE - - POLICY - - LOG LEVEL - - LIMIT:BURST - - - - - - fw - - net - - ACCEPT - - - - - - - - net - - all - - DROP - - info - - - - - - all - - all - - REJECT - - info - - - - - -
+ #SOURCE ZONE DESTINATION ZONE POLICY LOG LEVEL LIMIT:BURST +fw net ACCEPT +net all DROP info +all all REJECT info The above policy will: @@ -268,8 +218,8 @@ - At this point, edit your /etc/shorewall/policy and make any changes - that you wish. + At this point, edit your /etc/shorewall/policy + and make any changes that you wish.
@@ -287,12 +237,14 @@ ppp0. If you connect using ISDN, your external interface will be ippp0. - The - Shorewall one-interface sample configuration assumes that the external - interface is eth0. If your configuration - is different, you will have to modify the sample /etc/shorewall/interfaces - file accordingly. While you are there, you may wish to review the list of - options that are specified for the interface. Some hints: + + + The Shorewall one-interface sample configuration assumes that the + external interface is eth0. If your + configuration is different, you will have to modify the sample + /etc/shorewall/interfaces file accordingly. While you are there, you may + wish to review the list of options that are specified for the interface. + Some hints: If your external interface is ppp0 @@ -309,9 +261,9 @@ If you specify norfc1918 for your external interface, you will want to check the Shorewall - Errata periodically for updates to the /etc/shorewall/rfc1918 - file. Alternatively, you can strip down - your /etc/shorewall/rfc1918 files as I do. + Errata periodically for updates to the /etc/shorewall/rfc1918 + file. Alternatively, you can strip + down your /etc/shorewall/rfc1918 file as I do.
@@ -332,70 +284,31 @@ Translation to rewrite packet headers when forwarding to/from the internet.
- Before - starting Shorewall, you should look at the IP address of your external - interface and if it is one of the above ranges, you should remove the - norfc1918 option from the entry in - /etc/shorewall/interfaces. + + + Before starting Shorewall, you should look at the IP address of your + external interface and if it is one of the above ranges, you should remove + the norfc1918 option from the entry in + /etc/shorewall/interfaces.
Enabling other Connections If you wish to enable connections from the internet to your - firewall, the general format is: + firewall, the general format of a rule in /etc/shorewall/rules + is: - - /etc/shorewall/rules - - - - - ACTION - - SOURCE - - DESTINATION - - PROTOCOL - - PORT - - SOURCE PORT - - ORIGINAL ADDRESS - - - - - - ACCEPT - - net - - fw - - <protocol> - - <port> - - - - - - - -
+ #ACTION SOURCE DESTINATION PROTO DEST PORT(S) +ACCEPT net fw <protocol> <port> You want to run a Web Server and a POP3 Server on your firewall system: - /etc/shorewall/rulesACTIONSOURCEDESTINATIONPROTOCOLPORTSOURCE PORTORIGINAL ADDRESSACCEPTnetfwtcp80ACCEPTnetfwtcp110
+ #ACTION SOURCE DESTINATION PROTO DEST PORT(S) +ACCEPT net fw tcp 80 +ACCEPT net fw tcp 110
If you don't know what port and protocol a particular @@ -406,87 +319,52 @@ it uses clear text (even for login!). If you want shell access to your firewall from the internet, use SSH: - - /etc/shorewall/rules - - - - - ACTION - - SOURCE - - DESTINATION - - PROTOCOL - - PORT - - SOURCE PORT - - ORIGINAL ADDRESS - - - - - - ACCEPT - - net - - fw - - tcp - - 22 - - - - - - - -
+ #ACTION SOURCE DESTINATION PROTO DEST PORT(S) +ACCEPT net fw tcp 22 - At this - point, edit /etc/shorewall/rules to add other connections as desired. + + + At this point, edit /etc/shorewall/rules to add other connections as + desired.
Starting and Stopping Your Firewall - The - installation procedure configures your - system to start Shorewall at system boot but beginning with Shorewall - version 1.3.9 startup is disabled so that your system won't try to - start Shorewall before configuration is complete. Once you have completed - configuration of your firewall, you can enable Shorewall startup by - removing the file /etc/shorewall/startup_disabled. + + + The installation procedure + configures your system to start Shorewall at system boot but beginning + with Shorewall version 1.3.9 startup is disabled so that your system + won't try to start Shorewall before configuration is complete. Once + you have completed configuration of your firewall, you can enable + Shorewall startup by removing the file /etc/shorewall/startup_disabled. Users of the .deb package must edit - /etc/default/shorewall and set startup=1. + /etc/default/shorewall and set startup=1. - The firewall is started using the shorewall start - command and stopped using shorewall stop. When the firewall - is stopped, routing is enabled on those hosts that have an entry in /etc/shorewall/routestopped. - A running firewall may be restarted using the shorewall restart - command. If you want to totally remove any trace of Shorewall from your - Netfilter configuration, use shorewall clear. + The firewall is started using the shorewall start + command and stopped using shorewall stop. + When the firewall is stopped, routing is enabled on those hosts that have + an entry in /etc/shorewall/routestopped. + A running firewall may be restarted using the shorewall + restart command. If you want to totally remove any trace + of Shorewall from your Netfilter configuration, use shorewall + clear. If you are connected to your firewall from the internet, do not - issue a shorewall stop command unless you have added an - entry for the IP address that you are connected from to /etc/shorewall/routestopped. - Also, I don't recommend using shorewall restart; it - is better to create an shorewall stop command unless + you have added an entry for the IP address that you are connected from + to /etc/shorewall/routestopped. + Also, I don't recommend using shorewall restart; + it is better to create an alternate configuration - and test it using the shorewall - try command. + and test it using the shorewall + try command.
@@ -502,8 +380,9 @@ Revision History - 1.22003-12-30TEAdd - tip about /etc/shorewall/rfc1918 updates.1.12003-11-15TEInitial + 1.52003-01-05TEStandards + Changes1.42003-12-30TEAdd + tip about /etc/shorewall/rfc1918 updates.1.32003-11-15TEInitial Docbook Conversion \ No newline at end of file diff --git a/Shorewall-docs/two-interface.xml b/Shorewall-docs/two-interface.xml index 35faedc9d..b4d8a63cb 100644 --- a/Shorewall-docs/two-interface.xml +++ b/Shorewall-docs/two-interface.xml @@ -12,7 +12,7 @@ Eastep - 2003-12-31 + 2003-01-06 2002 @@ -106,13 +106,11 @@ installed by the presence of an ip program on your firewall system. As root, you can use the which command to check for this program: - -[root@gateway root]# which ip + [root@gateway root]# which ip /sbin/ip -[root@gateway root]# - I recommend that you first read through the guide to - familiarize yourself with what's involved then go back through it - again making your configuration changes. +[root@gateway root]# I recommend that you first read through + the guide to familiarize yourself with what's involved then go back + through it again making your configuration changes.
@@ -195,32 +193,16 @@ The /etc/shorewall/policy file included with the two-interface sample has the following policies: - Source ZoneDestination ZonePolicyLog LevelLimit:BurstlocnetACCEPTnetallDROPinfoallallREJECTinfo - In the two-interface sample, the line below is included but commented out. - If you want your firewall system to have full access to servers on the - internet, uncomment that line. Source ZoneDestination ZonePolicyLog LevelLimit:BurstfwnetACCEPT - The above policy will: Allow all connection - requests from your local network to the internetDrop + #SOURCE DEST POLICY LOG LEVEL LIMIT:BURST +loc net ACCEPT +net all DROP info +all all REJECT info In the two-interface + sample, the line below is included but commented out. If you want your + firewall system to have full access to servers on the internet, uncomment + that line. #SOURCE DEST POLICY LOG LEVEL LIMIT:BURST +fw net ACCEPT The above policy will: + Allow all connection requests from your + local network to the internetDrop (ignore) all connection requests from the internet to your firewall or local networkOptionally accept all connection requests from the firewall to the internet (if you uncomment @@ -310,11 +292,10 @@ network (the Internal Interface on your firewall plus your other computers). RFC 1918 reserves several Private IP address ranges for this - purpose: -10.0.0.0 - 10.255.255.255 + purpose: 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 -192.168.0.0 - 192.168.255.255 - +192.168.0.0 - 192.168.255.255 Before starting Shorewall, you should look at the IP address of your external interface and if it is one of the above ranges, you should remove @@ -460,38 +441,18 @@ The general form of a simple port forwarding rule in /etc/shorewall/rules is: - ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(s)ORIGINAL DESTDNATnetloc:<server local ip address> [:<server - port>]<protocol><port> + #ACTION SOURCE DEST PROTO DEST PORT(S) +DNAT net loc:<server local ip address>[:<server port>] <protocol> <port> Web ServerYou run a Web Server on computer 2 and you want to forward incoming TCP port 80 - to that system: ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTDNATnetloc:10.10.10.2tcp80 + to that system: #ACTION SOURCE DEST PROTO DEST PORT(S) +DNAT net loc:10.10.10.2 tcp 80 FTP ServerYou run an FTP Server on computer 1 so you want to forward - incoming TCP port 21 to that system: ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTDNATnetloc:10.10.10.1tcp21 - For FTP, you will also need to have FTP + incoming TCP port 21 to that system: + #ACTION SOURCE DEST PROTO DEST PORT(S) +DNAT net loc:10.10.10.1 tcp 21 For + FTP, you will also need to have FTP connection tracking and NAT support in your kernel. For vendor-supplied kernels, this means that the ip_conntrack_ftp and ip_nat_ftp modules must be @@ -508,15 +469,8 @@ url="FAQ.htm#faq2">Shorewall FAQ #2.Many ISPs block incoming connection requests to port 80. If you have problems connecting to your web server, try the following rule - and try connecting to port 5000.ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTDNATnetloc:10.10.10.2:80tcp5000 + and try connecting to port 5000.#ACTION SOURCE DEST PROTO DEST PORT(S) +DNAT net loc:10.10.10.2:80 tcp 5000 At this point, modify /etc/shorewall/rules @@ -556,111 +510,48 @@ UDP and TCP) from the local network to the firewall; you do that by adding the following rules in /etc/shorewall/rules. - ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTlocfwtcp53ACCEPTlocfwudp53 + #ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT loc fw tcp 53 +ACCEPT loc fw udp 53
Other Connections The two-interface sample includes the following rules: - ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTfwnettcp53ACCEPTfwnetudp53 - Those rules allow DNS access from your firewall and may - be removed if you uncommented the line in /etc/shorewall/policy + #ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT fw net tcp 53 +ACCEPT fw net udp 53Those + rules allow DNS access from your firewall and may be + removed if you uncommented the line in /etc/shorewall/policy allowing all connections from the firewall to the internet. - The sample also includes: ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTlocfwtcp22 - That rule allows you to run an SSH server on your - firewall and connect to that server from your local systems. + The sample also includes: #ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT loc fw tcp 22 That + rule allows you to run an SSH server on your firewall + and connect to that server from your local systems. If you wish to enable other connections between your firewall and - other systems, the general format is: ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPT<source - zone><destination - zone><protocol><port> + other systems, the general format is: #ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT fw <destination zone> <protocol> <port> Web Server on FirewallYou want to run a Web - Server on your firewall system: ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTnetfwtcp80#Allow - web access from the InternetACCEPTlocfwtcp80#Allow web access from the local network - Those two rules would of course be in addition to the rules listed above - under You can configure a Caching Name - Server on your firewall. If you don't - know what port and protocol a particular application uses, look #ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT net fw tcp 80 +ACCEPT loc fw tcp 80 Those + two rules would of course be in addition to the rules listed above under + You can configure a Caching Name Server + on your firewall. If you don't know + what port and protocol a particular application uses, look here. I don't recommend enabling telnet to/from the internet because it uses clear text (even for login!). If you want shell access to your firewall - from the internet, use SSH:ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTnetfwtcp22 + from the internet, use SSH:#ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT net fw tcp 22 Bering users will want to add the following two rules to be compatible with - Jacques's Shorewall configuration. ACTIONSOURCEDESTPROTODEST PORT(S)CLIENT PORT(S)ORIGINAL DESTACCEPTlocfwudp53#Allow - DNS Cache to workACCEPTlocfwtcp80#Allow weblet to work + Jacques's Shorewall configuration.#ACTION SOURCE DEST PROTO DEST PORT(S) +ACCEPT loc fw udp 53 #Allow DNS Cache to work +ACCEPT loc fw tcp 80 #Allow Weblet to work Now edit your /etc/shorewall/rules