<style type="text/css">
/*
- :Author: David Goodger (goodger@python.org)
- :Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
- :Copyright: This stylesheet has been placed in the public domain.
-
- Default cascading style sheet for the HTML output of Docutils.
-
- See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
- customize this style sheet.
+ Author: Peter Parente
+ Date: 2008/01/22
+ Version: 1.0
+ Copyright: This stylesheet has been placed in the public domain - free to edit and use for all uses.
*/
- /* used to remove borders from tables and images */
- .borderless, table.borderless td, table.borderless th {
- border: 0 }
-
- table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
+ body {
+ font: 100% sans-serif;
+ background: #ffffff;
+ color: black;
+ margin: 2em;
+ padding: 0em 2em;
+ }
- .first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
+ p.topic-title {
+ font-weight: bold;
+ }
- .last, .with-subtitle {
- margin-bottom: 0 ! important }
+ table.docinfo {
+ text-align: left;
+ margin: 2em 0em;
+ }
- .hidden {
- display: none }
+ a[href] {
+ color: #436976;
+ background-color: transparent;
+ }
a.toc-backref {
- text-decoration: none ;
- color: black }
-
- blockquote.epigraph {
- margin: 2em 5em ; }
-
- dl.docutils dd {
- margin-bottom: 0.5em }
-
- /* Uncomment (and remove this text!) to get bold-faced definition list terms
- dl.docutils dt {
- font-weight: bold }
- */
-
- div.abstract {
- margin: 2em 5em }
-
- div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
- div.admonition, div.attention, div.caution, div.danger, div.error,
- div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
- div.admonition p.admonition-title, div.hint p.admonition-title,
- div.important p.admonition-title, div.note p.admonition-title,
- div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
- div.attention p.admonition-title, div.caution p.admonition-title,
- div.danger p.admonition-title, div.error p.admonition-title,
- div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
- /* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
- div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
- div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
- */
-
- div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
- div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
- div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
- div.footer, div.header {
- clear: both;
- font-size: smaller }
-
- div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
- div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
- div.sidebar {
- margin: 0 0 0.5em 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
- div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
- div.system-messages {
- margin: 5em }
-
- div.system-messages h1 {
- color: red }
-
- div.system-message {
- border: medium outset ;
- padding: 1em }
+ text-decoration: none;
+ }
+
+ h1 a[href] {
+ color: #003a6b;
+ text-decoration: none;
+ background-color: transparent;
+ }
+
+ a.strong {
+ font-weight: bold;
+ }
+
+ img {
+ margin: 0;
+ border: 0;
+ }
+
+ p {
+ margin: 0.5em 0 1em 0;
+ line-height: 1.5em;
+ }
+
+ p a:visited {
+ color: purple;
+ background-color: transparent;
+ }
+
+ p a:active {
+ color: red;
+ background-color: transparent;
+ }
+
+ a:hover {
+ text-decoration: none;
+ }
+
+ p img {
+ border: 0;
+ margin: 0;
+ }
- div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
- div.topic {
- margin: 2em }
-
- h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
- h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
+ p.rubric {
+ font-weight: bold;
+ font-style: italic;
+ }
h1.title {
- text-align: center }
+ color: #003a6b;
+ font-size: 250%;
+ margin-bottom: 0em;
+ }
h2.subtitle {
- text-align: center }
-
- hr.docutils {
- width: 75% }
+ color: #003a6b;
+ border-bottom: 0px;
+ }
+
+ h1, h2, h3, h4, h5, h6 {
+ color: #555;
+ background-color: transparent;
+ margin: 0em;
+ padding-top: 0.5em;
+ }
+
+ h1 {
+ font-size: 160%;
+ margin-bottom: 0.5em;
+ border-bottom: 2px solid #aaa;
+ }
+
+ h2 {
+ font-size: 140%;
+ margin-bottom: 0.5em;
+ border-bottom: 1px solid #aaa;
+ }
+
+ h3 {
+ font-size: 130%;
+ margin-bottom: 0.5em;
+ }
+
+ h4 {
+ font-size: 110%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ h5 {
+ font-size: 105%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ h6 {
+ font-size: 100%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ dt {
+ font-style: italic;
+ }
+
+ dd {
+ margin-bottom: 1.5em;
+ }
+
+ div.admonition, div.note, div.tip, div.caution, div.important {
+ margin: 2em 2em;
+ padding: 0em 1em;
+ border-top: 1px solid #aaa;
+ border-left: 1px solid #aaa;
+ border-bottom: 2px solid #555;
+ border-right: 2px solid #555;
+ }
+
+ div.important {
+ background: transparent url('../images/important.png') 10px 2px no-repeat;
+ }
+
+ div.caution {
+ background: transparent url('../images/caution.png') 10px 2px no-repeat;
+ }
+
+ div.note {
+ background: transparent url('../images/note.png') 10px 2px no-repeat;
+ }
+
+ div.tip {
+ background: transparent url('../images/tip.png') 10px 2px no-repeat;
+ }
+
+ div.admonition-example {
+ background: transparent url('../images/tip.png') 10px 2px no-repeat;
+ }
+
+ div.admonition-critical-example {
+ background: transparent url('../images/important.png') 10px 2px no-repeat;
+ }
+
+ p.admonition-title {
+ font-weight: bold;
+ border-bottom: 1px solid #aaa;
+ padding-left: 30px;
+ }
- img.align-left {
- clear: left }
-
- img.align-right {
- clear: right }
-
- ol.simple, ul.simple {
- margin-bottom: 1em }
-
- ol.arabic {
- list-style: decimal }
-
- ol.loweralpha {
- list-style: lower-alpha }
-
- ol.upperalpha {
- list-style: upper-alpha }
-
- ol.lowerroman {
- list-style: lower-roman }
-
- ol.upperroman {
- list-style: upper-roman }
-
- p.attribution {
- text-align: right ;
- margin-left: 50% }
+ table.docutils {
+ text-align: left;
+ border: 1px solid gray;
+ border-collapse: collapse;
+ width: 100%;
+ margin: 1.5em 0em;
+ }
- p.caption {
- font-style: italic }
+ table.docutils caption {
+ font-style: italic;
+ }
- p.credits {
- font-style: italic ;
- font-size: smaller }
+ table.docutils td, table.docutils th {
+ padding: 0.25em 0.5em;
+ }
- p.label {
- white-space: nowrap }
+ table.docutils th {
+ background-color: #dddddd;
+ }
- p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
+ div.sidebar {
+ width: 33%;
+ float: right;
+ margin: 0em 2em;
+ padding: 0em 1em;
+ border-top: 1px solid #aaa;
+ border-left: 1px solid #aaa;
+ border-bottom: 2px solid #555;
+ border-right: 2px solid #555;
+ }
p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
+ margin-bottom: 0em;
+ color: #003a6b;
+ border-bottom: 1px solid #aaa;
+ font-weight: bold;
+ }
p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
- p.topic-title {
- font-weight: bold }
-
- pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font-family: serif ;
- font-size: 100% }
-
- pre.literal-block, pre.doctest-block {
- margin-left: 2em ;
- margin-right: 2em }
-
- span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
- span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
- span.interpreted {
- font-family: sans-serif }
-
- span.option {
- white-space: nowrap }
-
- span.pre {
- white-space: pre }
-
- span.problematic {
- color: red }
-
- span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
- table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
- table.docinfo {
- margin: 2em 4em }
-
- table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
- table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
- table.docutils td, table.docutils th,
- table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
- table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
- h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
- h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
- ul.auto-toc {
- list-style-type: none }
+ margin-top: 0em;
+ font-style: italic;
+ color: #003a6b;
+ }
</style>
</head>
<tr class="field">
<th class="field-name">Version:</th>
- <td class="field-body">0.6</td>
+ <td class="field-body">0.7</td>
</tr>
</tbody>
</table>
</li>
<li>
- <a class="reference internal" href="#firewall" id="id69"
- name="id69">7 Firewall</a>
+ <a class="reference internal" href=
+ "#server-di-posta-postfix" id="id69" name=
+ "id69">7 Server di posta: Postfix</a>
+
+ <ul class="auto-toc">
+ <li>
+ <a class="reference internal" href="#imap-e-pop" id=
+ "id70" name="id70">7.1 Imap e
+ pop</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#web-client" id="id71" name=
+ "id71">7.1.1 Web client</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+
+ <li>
+ <a class="reference internal" href="#firewall" id="id72"
+ name="id72">8 Firewall</a>
<ul class="auto-toc">
<li><a class="reference internal" href="#links" id=
- "id70" name="id70">7.1 Links</a></li>
+ "id73" name="id73">8.1 Links</a></li>
<li><a class="reference internal" href="#ipfilter" id=
- "id71" name=
- "id71">7.2 Ipfilter</a></li>
+ "id74" name=
+ "id74">8.2 Ipfilter</a></li>
<li>
<a class="reference internal" href=
- "#progettazione-di-un-firewall" id="id72" name=
- "id72">7.3 Progettazione di un
+ "#progettazione-di-un-firewall" id="id75" name=
+ "id75">8.3 Progettazione di un
firewall</a>
<ul class="auto-toc">
<li><a class="reference internal" href=
- "#collocazione" id="id73" name=
- "id73">7.3.1 Collocazione</a></li>
+ "#collocazione" id="id76" name=
+ "id76">8.3.1 Collocazione</a></li>
<li><a class="reference internal" href=
- "#policy-di-default" id="id74" name=
- "id74">7.3.2 Policy di
+ "#policy-di-default" id="id77" name=
+ "id77">8.3.2 Policy di
default</a></li>
<li><a class="reference internal" href="#hardware"
- id="id75" name=
- "id75">7.3.3 Hardware</a></li>
+ id="id78" name=
+ "id78">8.3.3 Hardware</a></li>
</ul>
</li>
<li><a class="reference internal" href=
"#percorso-dei-pacchetti-tra-tabelle-e-catene" id=
- "id76" name="id76">7.4 Percorso dei
+ "id79" name="id79">8.4 Percorso dei
pacchetti tra tabelle e catene</a></li>
<li>
<a class="reference internal" href=
- "#concetti-di-base" id="id77" name=
- "id77">7.5 Concetti di base</a>
+ "#concetti-di-base" id="id80" name=
+ "id80">8.5 Concetti di base</a>
<ul class="auto-toc">
<li><a class="reference internal" href=
- "#tabelle-catene-regole" id="id78" name=
- "id78">7.5.1 Tabelle, catene,
+ "#tabelle-catene-regole" id="id81" name=
+ "id81">8.5.1 Tabelle, catene,
regole</a></li>
<li><a class="reference internal" href="#match" id=
- "id79" name=
- "id79">7.5.2 Match</a></li>
+ "id82" name=
+ "id82">8.5.2 Match</a></li>
<li><a class="reference internal" href="#targets"
- id="id80" name=
- "id80">7.5.3 Targets</a></li>
+ id="id83" name=
+ "id83">8.5.3 Targets</a></li>
</ul>
</li>
<li><a class="reference internal" href=
- "#tabella-filter" id="id81" name=
- "id81">7.6 Tabella Filter</a></li>
+ "#tabella-filter" id="id84" name=
+ "id84">8.6 Tabella Filter</a></li>
<li><a class="reference internal" href=
- "#flush-automatico-per-macchine-remote" id="id82" name=
- "id82">7.7 Flush automatico per
+ "#flush-automatico-per-macchine-remote" id="id85" name=
+ "id85">8.7 Flush automatico per
macchine remote</a></li>
<li><a class="reference internal" href=
- "#gestione-regole-rules" id="id83" name=
- "id83">7.8 Gestione regole
+ "#gestione-regole-rules" id="id86" name=
+ "id86">8.8 Gestione regole
(rules)</a></li>
+
+ <li>
+ <a class="reference internal" href=
+ "#salvataggio-regole" id="id87" name=
+ "id87">8.9 Salvataggio regole</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#iptables-save" id="id88" name=
+ "id88">8.9.1 Iptables-save</a></li>
+
+ <li><a class="reference internal" href=
+ "#iptables-restore" id="id89" name=
+ "id89">8.9.2 Iptables-restore</a></li>
+ </ul>
+ </li>
</ul>
</li>
- <li><a class="reference internal" href="#note" id="id84"
- name="id84">8 NOTE</a></li>
+ <li><a class="reference internal" href="#note" id="id90"
+ name="id90">9 NOTE</a></li>
</ul>
</div>
resolv.conf per conoscere l'ubicazione del DNS.</p>
<p>/etc/resolv.conf:</p>
- <pre class="literal-block">
-- ``nameserver``: indica il nameserver da utilizzare, indicato con l'indirizzo ip.
-- ``domain``: indica il nome di dominio della rete attuale, vedi voce sucessiva.
+ <blockquote>
+ <ul class="simple">
+ <li><tt class="docutils literal"><span class=
+ "pre">nameserver</span></tt>: indica il nameserver da
+ utilizzare, indicato con l'indirizzo ip.</li>
-- ``search``: nome di dominio usato dalla rete sul quale cercare gli hosts. Ad esempio se impostato su ``piffa.net`` pingando l'host ``bender`` viene automaticamente fatto un tentativo di ricerca per ``bender.piffa.net``.
-</pre>
+ <li><tt class="docutils literal"><span class=
+ "pre">domain</span></tt>: indica il nome di dominio
+ della rete attuale, vedi voce sucessiva.</li>
+
+ <li><tt class="docutils literal"><span class=
+ "pre">search</span></tt>: nome di dominio usato dalla
+ rete sul quale cercare gli hosts. Ad esempio se
+ impostato su <tt class="docutils literal"><span class=
+ "pre">piffa.net</span></tt> pingando l'host <tt class=
+ "docutils literal"><span class="pre">bender</span></tt>
+ viene automaticamente fatto un tentativo di ricerca per
+ <tt class="docutils literal"><span class=
+ "pre">bender.piffa.net</span></tt>.</li>
+ </ul>
+ </blockquote>
<p>Si veda anche la pagina man di resolv.conf.</p>
</div>
</div>
+ <div class="section" id="server-di-posta-postfix">
+ <h1><a class="toc-backref" href=
+ "#id69">7 Server di posta: Postfix</a></h1>
+
+ <p>Il server di posta che prenderemo in considerazione e'
+ Postfix, a seguire un estratto di un file do configurazione
+ <em>semplie</em> con l'abilizazione delle <em>Maildir</em>
+ nelle <tt class="docutils literal"><span class=
+ "pre">/home</span></tt> degli utenti per la consegna della
+ posta:</p>
+
+ <p><tt class="docutils literal"><span class=
+ "pre">/etc/postfix/main.cf</span></tt>:</p>
+ <pre class="literal-block">
+# ...segue dalla riga ~30
+myhostname = 162.piffa.net
+alias_maps = hash:/etc/aliases
+alias_database = hash:/etc/aliases
+myorigin = 162.piffa.net
+mydestination = 162.piffa.net, localhost
+# Se non avete un ip pubblico e statico, con un adeguato record PTR
+# dovrete usare un realy host per l'invio della posta
+relayhost = smtp.piffa.net
+mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
+
+# Per effettuare lo storaggio della posta nelle home directory degli utenti
+# in una Maildir invece che la Mailbox in /var/mail/utente
+# si disabiliti procmail
+#mailbox_command = procmail -a "$EXTENSION"
+
+# Storaggio della posta nella _cartella_ Maildir/ (si noti lo slash)
+# nella home dell'utente:
+home_mailbox = Maildir/
+mailbox_size_limit = 0
+recipient_delimiter = +
+inet_interfaces = all
+</pre>
+
+ <div class="section" id="imap-e-pop">
+ <h2><a class="toc-backref" href=
+ "#id70">7.1 Imap e pop</a></h2>
+
+ <p>Postfix e' un server SMTP, di conseguenza se volete che
+ i vostri utenti possano <em>scaricare</em> in locale la
+ posta generalemtne volete mettere a loro disposizione un
+ server <em>POP3</em> o ancora meglio <em>IMAP</em>. Oppure
+ entrambi.</p>
+
+ <dl class="docutils">
+ <dt>Pacchetti da installare</dt>
+
+ <dd>courier-imap courier-pop</dd>
+ </dl>
+
+ <p>i noti che IMAP necessita delle Maildir, non funziona
+ con le Mailbox in <tt class="docutils literal"><span class=
+ "pre">/var/mail/</span></tt> .</p>
+
+ <div class="section" id="web-client">
+ <h3><a class="toc-backref" href=
+ "#id71">7.1.1 Web client</a></h3>
+
+ <p>Per mettere a disposizione degli utenti un client web
+ per gestire la propia posta si installi il pacchetto:
+ <tt class="docutils literal"><span class=
+ "pre">squirrelmail</span></tt> . Ci sono tanti altri
+ client web disponibili: questo e' particolarmente
+ semplice. Naturalemte dovrete aver installato: <tt class=
+ "docutils literal"><span class="pre">php5</span>
+ <span class="pre">apache2</span></tt> .</p>
+
+ <p>L'interfaccia dovrebbe essere disponibile all'url:
+ <tt class="docutils literal"><span class=
+ "pre">http://localhost/squirrelmail</span></tt> . Se
+ cosi' non fosse assicuratevi che Apache abbia incluso il
+ file di configurazione di squirrelmail:</p>
+ <pre class="literal-block">
+cd /etc/apache2/conf.d/
+ln -s /etc/squirrelmail/apache.conf ./
+</pre>
+ </div>
+ </div>
+ </div>
+
<div class="section" id="firewall">
<h1><a class="toc-backref" href=
- "#id69">7 Firewall</a></h1>
+ "#id72">8 Firewall</a></h1>
<p>In Informatica, nell'ambito delle reti di computer, un
firewall (termine inglese dal significato originario di
<div class="section" id="links">
<h2><a class="toc-backref" href=
- "#id70">7.1 Links</a></h2>
+ "#id73">8.1 Links</a></h2>
<ul class="simple">
<li><a class="reference external" href=
<div class="section" id="ipfilter">
<h2><a class="toc-backref" href=
- "#id71">7.2 Ipfilter</a></h2>
+ "#id74">8.2 Ipfilter</a></h2>
<p>Link: <a class="reference external" href=
"http://iptables-tutorial.frozentux.net/iptables-tutorial.html#IPFILTERING">
<div class="section" id="progettazione-di-un-firewall">
<h2><a class="toc-backref" href=
- "#id72">7.3 Progettazione di un
+ "#id75">8.3 Progettazione di un
firewall</a></h2>
<p>Per implementare un firewall bisogna decidere un aio di
<div class="section" id="collocazione">
<h3><a class="toc-backref" href=
- "#id73">7.3.1 Collocazione</a></h3>
+ "#id76">8.3.1 Collocazione</a></h3>
<p>DMZ e MZ, internet, intranet, extranet. Frammentazione
della rete, decidere se diversi reparti di una azienda si
<div class="section" id="policy-di-default">
<h3><a class="toc-backref" href=
- "#id74">7.3.2 Policy di default</a></h3>
+ "#id77">8.3.2 Policy di default</a></h3>
<p>Drop o Accept: conseguenze per sicurezza, facilita' di
gestione.</p>
<div class="section" id="hardware">
<h3><a class="toc-backref" href=
- "#id75">7.3.3 Hardware</a></h3>
+ "#id78">8.3.3 Hardware</a></h3>
<p>Sostanzialmente potremmo distinquere due tipologie di
hardware:</p>
<div class="section" id=
"percorso-dei-pacchetti-tra-tabelle-e-catene">
<h2><a class="toc-backref" href=
- "#id76">7.4 Percorso dei pacchetti tra
+ "#id79">8.4 Percorso dei pacchetti tra
tabelle e catene</a></h2>
<p>link: <a class="reference external" href=
<div class="section" id="concetti-di-base">
<h2><a class="toc-backref" href=
- "#id77">7.5 Concetti di base</a></h2>
+ "#id80">8.5 Concetti di base</a></h2>
<div class="section" id="tabelle-catene-regole">
<h3><a class="toc-backref" href=
- "#id78">7.5.1 Tabelle, catene,
+ "#id81">8.5.1 Tabelle, catene,
regole</a></h3>
<p>Iptables lavora su 3 tabelle (tables) di default:</p>
<div class="section" id="match">
<h3><a class="toc-backref" href=
- "#id79">7.5.2 Match</a></h3>
+ "#id82">8.5.2 Match</a></h3>
<p>I Match di una regola (rule) servono a testare un
pacchetto per valutare se corrisponda a certe
<div class="section" id="targets">
<h3><a class="toc-backref" href=
- "#id80">7.5.3 Targets</a></h3>
+ "#id83">8.5.3 Targets</a></h3>
<p>Se un pacchetto soddisfa le condizioni del Match
<em>salta</em> (jump) su uno dei target possibili, in
<div class="section" id="tabella-filter">
<h2><a class="toc-backref" href=
- "#id81">7.6 Tabella Filter</a></h2>
+ "#id84">8.6 Tabella Filter</a></h2>
<p>E' quella implicita e predefinita (-t filter) Riguarda
le attività di filtraggio del traffico. Ha 3 catene
<div class="section" id=
"flush-automatico-per-macchine-remote">
<h2><a class="toc-backref" href=
- "#id82">7.7 Flush automatico per macchine
+ "#id85">8.7 Flush automatico per macchine
remote</a></h2>
<p>Se state provando una configurazione del firewall per
<div class="section" id="gestione-regole-rules">
<h2><a class="toc-backref" href=
- "#id83">7.8 Gestione regole
+ "#id86">8.8 Gestione regole
(rules)</a></h2>
<p>Il comando iptables viene usato per ogni attivitÃ
regole esistenti</dd>
</dl>
</div>
+
+ <div class="section" id="salvataggio-regole">
+ <h2><a class="toc-backref" href=
+ "#id87">8.9 Salvataggio regole</a></h2>
+
+ <p>Il comando <tt class="docutils literal"><span class=
+ "pre">iptables</span></tt> serve per interagire con il
+ framework <tt class="docutils literal"><span class=
+ "pre">Netfilter</span></tt> ch gestisce il firewall di
+ Linux al livello del kernel. Questo comporta, in modo
+ analogo a quando avvene col comando <tt class=
+ "docutils literal"><span class="pre">ifconfig</span></tt>,
+ che i cambiameti impostati siano in <em>tempo reale,
+ RAM</em>, non persistenti nel sistema: al boot sucessivo
+ del sistema tutto tornera' alle impostazioni di base (in
+ questo caso <em>nulle</em>, con policy di default settate
+ su <tt class="docutils literal"><span class=
+ "pre">ACCEPT</span></tt> per tutto).</p>
+
+ <p>Le varie invocazioni di iptables potrebbero essere
+ richiamate da degli scripts dedicati, ma fortunatamente e'
+ stata predisposta una apposita utility per gestire questi
+ scripts in modo da avere a disposizione un <em>formato
+ standard</em> per il salvataggio e il ripristino delle
+ regole del firewall.</p>
+
+ <p>Altro problema: decidere quando attivare / disattivare
+ queste regole. Utilizzare i <em>runlevels</em> non e' una
+ soluzione adeguata: le regole del firewall sono legate
+ all'attivita' delle schede di rete (e un host con diverse
+ schede di rete puo' attivarle a secondo delle esigenze di
+ routing, partenza di servizi es file_sharing per un
+ back-up...): il sistema operativo Debian permette di legare
+ l'esecuzione di comandi alla attivazione di una device di
+ rete (<tt class="docutils literal"><span class=
+ "pre">up</span></tt>), dopo la sua attivazione (<tt class=
+ "docutils literal"><span class="pre">post-up</span></tt>,
+ utile per devices che richiedono un certo tempo per
+ inizializzarsi: come un tunnel o una connessione punto a
+ punto), prima della sua attivazione (<tt class=
+ "docutils literal"><span class="pre">pre-up</span></tt>).
+ Allo stesso modo sono disponibili eventi analoghi per
+ accompagnare la disattivazione dei device di rete: si veda
+ la pagina man di <tt class="docutils literal"><span class=
+ "pre">interfaces</span></tt>.</p>
+
+ <p>Nel nostro caso avremo per una possibile scheda
+ <tt class="docutils literal"><span class=
+ "pre">eth0</span></tt>:</p>
+
+ <p><tt class="docutils literal"><span class=
+ "pre">/etc/network/interfaces</span></tt></p>
+ <pre class="literal-block">
+iface eth1 inet static
+ up /sbin/iptables-restore /root/firewall/basic_fw
+ # Seguno i soliti parametri della scheda di rete
+ address 10.10.208.21
+</pre>
+
+ <div class="section" id="iptables-save">
+ <h3><a class="toc-backref" href=
+ "#id88">8.9.1 Iptables-save</a></h3>
+
+ <p>Per salvare le regole di iptables attualmente presenti
+ nel kernel si usi il comando:</p>
+ <pre class="literal-block">
+# iptables-save >> /root/firewall/basic_fw
+</pre>
+
+ <p>Il contenuto del file dovrebbe essere
+ <em>comprensibile</em>: sostanzialmente sono regole di
+ iptables, senza il comando iptables ripetuto, suddivisi
+ per le varie tabelle. Potete comunque correggere
+ eventuali parametri con un edito di testo.</p>
+
+ <p>Se non avete un'idea migliore potreste voler tenere
+ gli script dei firewall in una cartella <tt class=
+ "docutils literal"><span class=
+ "pre">~/firewall</span></tt> nella home directory
+ dell'utente <tt class="docutils literal"><span class=
+ "pre">root</span></tt>.</p>
+ </div>
+
+ <div class="section" id="iptables-restore">
+ <h3><a class="toc-backref" href=
+ "#id89">8.9.2 Iptables-restore</a></h3>
+
+ <p>Per ripristinare un set di regole prcedentemente
+ salvate con <tt class="docutils literal"><span class=
+ "pre">iptables-save</span></tt> si utilizzi <tt class=
+ "docutils literal"><span class=
+ "pre">iptables-restore</span></tt>. Se questo deve essere
+ fatto in modalita' <em>non interattiva</em>, ad esempio
+ deve essere eseguito dal demone che si occupa di
+ inizializzare le schede di rete, oppure un <em>cron</em>
+ o altro, e' buona norma richiamare i percorsi completi
+ sia dei comandi che dei file:</p>
+ <pre class="literal-block">
+/sbin/iptables-restore /root/firewall/basic_fw
+</pre>
+ </div>
+ </div>
</div>
<div class="section" id="note">
<h1><a class="toc-backref" href=
- "#id84">8 NOTE</a></h1>
+ "#id90">9 NOTE</a></h1>
<ul class="simple">
<li>controllare apache</li>