2002-09-29 23:42:38 +02:00
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2002-08-13 22:45:21 +02:00
|
|
|
|
<html>
|
|
|
|
|
<head>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<meta name="ProgId" content="FrontPage.Editor.Document">
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<meta http-equiv="Content-Type"
|
|
|
|
|
content="text/html; charset=windows-1252">
|
|
|
|
|
<title>Starting and Stopping Shorewall</title>
|
2002-08-13 22:45:21 +02:00
|
|
|
|
</head>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<body>
|
2002-08-13 22:45:21 +02:00
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0"
|
|
|
|
|
style="border-collapse: collapse;" bordercolor="#111111" width="100%"
|
|
|
|
|
id="AutoNumber1" bgcolor="#400169" height="90">
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<td width="100%">
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<h1 align="center"><font color="#ffffff">Starting/Stopping and Monitoring
|
|
|
|
|
the Firewall</font></h1>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</td>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</tr>
|
2003-01-14 18:18:42 +01:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
</tbody>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p> If you have a permanent internet connection such as DSL or Cable,
|
|
|
|
|
I recommend that you start the firewall automatically at boot.
|
|
|
|
|
Once you have installed "firewall" in your init.d directory, simply
|
|
|
|
|
type "chkconfig --add firewall". This will start the firewall
|
|
|
|
|
in run levels 2-5 and stop it in run levels 1 and 6. If you want
|
|
|
|
|
to configure your firewall differently from this default, you can
|
|
|
|
|
use the "--level" option in chkconfig (see "man chkconfig") or using
|
|
|
|
|
your favorite graphical run-level editor.</p>
|
2003-01-14 18:18:42 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<p><strong><u> <font color="#000099"> Important Notes:</font></u></strong><br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</p>
|
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<ol>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>Shorewall startup is disabled by default. Once you have
|
|
|
|
|
configured your firewall, you can enable startup by removing the file
|
|
|
|
|
/etc/shorewall/startup_disabled. Note: Users of the .deb package must
|
2003-02-28 03:12:52 +01:00
|
|
|
|
edit /etc/default/shorewall and set 'startup=1'.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</li>
|
|
|
|
|
<li>If you use dialup, you may want to start the firewall
|
|
|
|
|
in your /etc/ppp/ip-up.local script. I recommend just placing
|
|
|
|
|
"shorewall restart" in that script.</li>
|
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
</ol>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
</p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p> You can manually start and stop Shoreline Firewall using the "shorewall"
|
2003-02-28 03:12:52 +01:00
|
|
|
|
shell program: </p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall start - starts the firewall</li>
|
|
|
|
|
<li>shorewall stop - stops the firewall</li>
|
|
|
|
|
<li>shorewall restart - stops the firewall (if it's
|
|
|
|
|
running) and then starts it again</li>
|
|
|
|
|
<li>shorewall reset - reset the packet and byte counters
|
|
|
|
|
in the firewall</li>
|
|
|
|
|
<li>shorewall clear - remove all rules and chains
|
|
|
|
|
installed by Shoreline Firewall</li>
|
|
|
|
|
<li>shorewall refresh - refresh the rules involving the broadcast
|
2003-02-28 03:12:52 +01:00
|
|
|
|
addresses of firewall interfaces, <a
|
2003-02-25 20:24:41 +01:00
|
|
|
|
href="blacklisting_support.htm">the black list</a>, <a
|
|
|
|
|
href="traffic_shaping.htm">traffic control rules</a> and <a
|
|
|
|
|
href="ECN.html">ECN control rules</a>.</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
</ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
If you include the keyword <i>debug</i> as the first argument, then
|
2003-02-28 03:12:52 +01:00
|
|
|
|
a shell trace of the command is produced as in:<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2003-01-14 18:18:42 +01:00
|
|
|
|
<pre> <font color="#009900"><b>shorewall debug start 2> /tmp/trace</b></font><br></pre>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p>The above command would trace the 'start' command and place the trace
|
|
|
|
|
information in the file /tmp/trace<br>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>The <a href="#StateDiagram">Shorewall State Diagram</a> is shown at the
|
2003-02-28 03:12:52 +01:00
|
|
|
|
bottom of this page.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</p>
|
|
|
|
|
|
2003-01-31 22:50:51 +01:00
|
|
|
|
<p>The "shorewall" program may also be used to monitor the firewall.</p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall status - produce a verbose report about the
|
2003-02-28 03:12:52 +01:00
|
|
|
|
firewall (iptables -L -n -v)</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall show <i>chain</i> - produce a verbose report
|
|
|
|
|
about <i>chain </i>(iptables -L <i>chain</i> -n -v)</li>
|
|
|
|
|
<li>shorewall show nat - produce a verbose report about the
|
2003-02-28 03:12:52 +01:00
|
|
|
|
nat table (iptables -t nat -L -n -v)</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall show tos - produce a verbose report about the
|
2003-02-28 03:12:52 +01:00
|
|
|
|
mangle table (iptables -t mangle -L -n -v)</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall show log - display the last 20 packet log entries.</li>
|
|
|
|
|
<li>shorewall show connections - displays the IP connections
|
|
|
|
|
currently being tracked by the firewall.</li>
|
|
|
|
|
<li>shorewall
|
|
|
|
|
show
|
|
|
|
|
tc - displays
|
|
|
|
|
information about the traffic control/shaping configuration.</li>
|
|
|
|
|
<li>shorewall monitor [ delay ] - Continuously display the
|
|
|
|
|
firewall status, last 20 log entries and nat. When the log
|
|
|
|
|
entry display changes, an audible alarm is sounded.</li>
|
|
|
|
|
<li>shorewall hits - Produces several reports about the Shorewall
|
2003-02-28 03:12:52 +01:00
|
|
|
|
packet log messages in the current /var/log/messages file.</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall version - Displays the installed version
|
2003-02-28 03:12:52 +01:00
|
|
|
|
number.</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall check - Performs a <u>cursory</u> validation of the
|
2003-02-28 03:12:52 +01:00
|
|
|
|
zones, interfaces, hosts, rules and policy files.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<br>
|
|
|
|
|
<font size="4" color="#ff6666"><b>The "check" command is totally unsuppored
|
|
|
|
|
and does not parse and validate the generated iptables commands. Even
|
|
|
|
|
though the "check" command completes successfully, the configuration
|
|
|
|
|
may fail to start. Problem reports that complain about errors that the 'check'
|
2003-02-28 03:12:52 +01:00
|
|
|
|
command does not detect will not be accepted.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<br>
|
|
|
|
|
See the recommended way to make configuration changes described below.</b></font><br>
|
2003-02-28 03:12:52 +01:00
|
|
|
|
<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</li>
|
|
|
|
|
<li>shorewall try<i> configuration-directory</i> [<i> timeout</i>
|
|
|
|
|
] - Restart shorewall using the specified configuration and if an
|
|
|
|
|
error occurs or if the<i> timeout </i> option is given and the new
|
|
|
|
|
configuration has been up for that many seconds then shorewall is
|
|
|
|
|
restarted using the standard configuration.</li>
|
|
|
|
|
<li>shorewall deny, shorewall reject, shorewall accept and
|
|
|
|
|
shorewall save implement <a href="blacklisting_support.htm">dynamic
|
|
|
|
|
blacklisting</a>.</li>
|
|
|
|
|
<li>shorewall logwatch (added in version 1.3.2) - Monitors
|
|
|
|
|
the <a href="#Conf">LOGFILE </a>and produces an audible alarm when
|
|
|
|
|
new Shorewall messages are logged.</li>
|
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
</ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
Finally, the "shorewall" program may be used to dynamically alter
|
2003-02-28 03:12:52 +01:00
|
|
|
|
the contents of a zone.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-11-09 19:06:34 +01:00
|
|
|
|
<ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li>shorewall add <i>interface</i>[:<i>host]</i> <i>zone </i>-
|
|
|
|
|
Adds the specified interface (and host if included) to the specified
|
|
|
|
|
zone.</li>
|
|
|
|
|
<li>shorewall delete <i>interface</i>[:<i>host]</i> <i>zone </i>-
|
|
|
|
|
Deletes the specified interface (and host if included) from the specified
|
2003-02-28 03:12:52 +01:00
|
|
|
|
zone.</li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-11-09 19:06:34 +01:00
|
|
|
|
</ul>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2003-01-14 18:18:42 +01:00
|
|
|
|
<blockquote>Examples:<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<blockquote><font color="#009900"><b>shorewall add ipsec0:192.0.2.24 vpn1</b></font>
|
|
|
|
|
-- adds the address 192.0.2.24 from interface ipsec0 to the zone vpn1<br>
|
|
|
|
|
<font color="#009900"><b> shorewall delete ipsec0:192.0.2.24
|
|
|
|
|
vpn1</b></font> -- deletes the address 192.0.2.24 from interface ipsec0
|
2003-02-28 03:12:52 +01:00
|
|
|
|
from zone vpn1<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</blockquote>
|
|
|
|
|
</blockquote>
|
2003-02-20 00:21:55 +01:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p> The <b>shorewall start</b>, <b>shorewall restart, shorewall check, </b>and
|
2003-02-28 03:12:52 +01:00
|
|
|
|
<b>shorewall try </b>commands allow you to specify which <a
|
2003-03-07 00:41:31 +01:00
|
|
|
|
href="configuration_file_basics.htm#Configs"> Shorewall configuration</a>
|
2003-02-28 03:12:52 +01:00
|
|
|
|
to use:</p>
|
2003-01-31 22:50:51 +01:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-01-14 18:18:42 +01:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2003-02-28 03:12:52 +01:00
|
|
|
|
<p> shorewall [ -c <i>configuration-directory</i> ] {start|restart|check}<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
shorewall try <i>configuration-directory</i></p>
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p> If a <i>configuration-directory</i> is specified, each time that Shorewall
|
|
|
|
|
is going to use a file in /etc/shorewall it will first look in the
|
|
|
|
|
<i>configuration-directory</i> . If the file is present in the <i>configuration-directory</i>,
|
|
|
|
|
that file will be used; otherwise, the file in /etc/shorewall will be
|
2003-02-28 03:12:52 +01:00
|
|
|
|
used.</p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p> When changing the configuration of a production firewall, I recommend
|
|
|
|
|
the following:</p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<ul>
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>mkdir /etc/test</b></font></li>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>cd /etc/test</b></font></li>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><copy any files that you need to change from
|
2003-02-28 03:12:52 +01:00
|
|
|
|
/etc/shorewall to . and change them here></li>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>shorewall -c . check</b></font></li>
|
|
|
|
|
<li><correct any errors found by check and check again></li>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>/sbin/shorewall
|
|
|
|
|
try .</b></font></li>
|
|
|
|
|
|
2002-08-13 22:45:21 +02:00
|
|
|
|
</ul>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p> If the configuration starts but doesn't work, just "shorewall restart"
|
|
|
|
|
to restore the old configuration. If the new configuration fails
|
|
|
|
|
to start, the "try" command will automatically start the old one for
|
|
|
|
|
you.</p>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<p> When the new configuration works then just </p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2002-09-29 23:42:38 +02:00
|
|
|
|
<ul>
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>cp * /etc/shorewall</b></font></li>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>cd</b></font></li>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<li><font color="#009900"><b>rm -rf /etc/test</b></font></li>
|
|
|
|
|
|
2002-08-13 22:45:21 +02:00
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
2003-01-31 22:50:51 +01:00
|
|
|
|
<p><a name="StateDiagram"></a>The Shorewall State Diargram is depicted below.<br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</p>
|
|
|
|
|
|
2003-02-20 00:21:55 +01:00
|
|
|
|
<div align="center"><img src="images/State_Diagram.png"
|
2003-01-31 22:50:51 +01:00
|
|
|
|
alt="(State Diagram)" width="747" height="714" align="middle">
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<br>
|
|
|
|
|
</div>
|
|
|
|
|
|
2003-02-25 20:24:41 +01:00
|
|
|
|
<p><EFBFBD> <br>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
</p>
|
|
|
|
|
You will note that the commands that result in state transitions
|
|
|
|
|
use the word "firewall" rather than "shorewall". That is because the actual
|
|
|
|
|
transitions are done by /usr/lib/shorewall/firewall (/usr/share/shorewall/firewall
|
|
|
|
|
on Debian); /sbin/shorewall runs 'firewall" according to the following table:<br>
|
|
|
|
|
<br>
|
|
|
|
|
|
2003-01-31 22:50:51 +01:00
|
|
|
|
<table cellpadding="2" cellspacing="2" border="1">
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall start<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall start<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall stop<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall stop<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall restart<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall restart<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall add<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall add<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall delete<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall delete<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall refresh<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall refresh<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">shorewall try<br>
|
|
|
|
|
</td>
|
|
|
|
|
<td valign="top">firewall -c <new configuration> restart<br>
|
|
|
|
|
If unsuccessful then firewall start (standard configuration)<br>
|
|
|
|
|
If timeout then firewall restart (standard configuration)<br>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-01-31 22:50:51 +01:00
|
|
|
|
</table>
|
2003-03-07 00:41:31 +01:00
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<p><font size="2"> Updated 2/27/2003 - <a href="support.htm">Tom Eastep</a>
|
2003-02-28 03:12:52 +01:00
|
|
|
|
</font></p>
|
2002-08-13 22:45:21 +02:00
|
|
|
|
|
|
|
|
|
|
2003-03-07 00:41:31 +01:00
|
|
|
|
|
|
|
|
|
<p><font face="Trebuchet MS"><a href="copyright.htm"><font size="2">Copyright</font>
|
|
|
|
|
<20> <font size="2">2001, 2002, 2003 Thomas M. Eastep.</font></a></font><br>
|
|
|
|
|
</p>
|
|
|
|
|
<br>
|
2002-09-29 23:42:38 +02:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|