<html lang="it">
<head>
<meta name="generator" content=
- "HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org">
+ "HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=iso-8859-1">
<meta name="generator" content=
operativo e della rete nel laboratorio 208 facente parte
della rete piffa.net .</p>
- <p>Qui riportati per comodita' degli studenti (e del
- docente che non sara' <strong>mai piu'</strong> costretto a
- ripeterli continuamente! ). Gli altri lettori potranno
- tenerli presenti per cercare di comprendere gli esempi nel
- testo. Ad esempio: quando leggerete <tt class=
- "docutils literal"><span class=
+ <p>Sono qui riportati i parametri della rete locale per
+ comodita' degli studenti, gli altri lettori possono
+ considerarli come riferimento per comprendere i valori
+ espressi nei vari file di configurazione. Ad esempio:
+ quando leggerete <tt class="docutils literal"><span class=
"pre">10.10.208.254:3128</span></tt> saprete che si tratta
del nostro <em>proxy http</em>, stara' quindi a voi
sostituire i dati con gli equivalenti <em>IP</em> della
<table border="1" class="docutils">
<colgroup>
- <col width="42%">
- <col width="58%">
+ <col width="45%">
+ <col width="55%">
</colgroup>
<tbody valign="top">
<td>10.10.208.254</td>
</tr>
-
- <tr>
- <td>proxy http</td>
-
- <td>10.10.208.254:3128</td>
- </tr>
</tbody>
</table>
- <p>Sul portatile di Andrea, corrispondente all'IP 254, gira
- un DHCP, proxy http e mirror di Debian ( <a class=
- "reference external" href=
- "http://debian.piffa.net">http://debian.piffa.net</a>). Se
- Andrea non e' in aula (o ancora peggio non c'e' il suo
- portatile Net) gli studenti dovranno darsi un indirizzo IP
- manualmente e disabilitare il proxy (che pero' e
- trasparente, quindi fate pure come se non ci fosse ;) . Ad
- oggi il <em>lab208</em> e' servito dal server Bender (254 o
- 248) che ha ripreso le sue vecchie funzioni.</p>
+ <p>Dal server locale degli studeti,
+ <strong>Bender</strong>, corrispondente all'IP <tt class=
+ "docutils literal"><span class=
+ "pre">10.10.208.248</span></tt>, vengono erogati i servizi
+ DHCP, DNS, gateway (con NAT), proxy http e mirror della
+ distribuzione Debian ( <a class="reference external" href=
+ "http://debian.piffa.net">http://debian.piffa.net</a>).
+ Altri servizi in esecuzione sul server:</p>
+
+ <ul class="simple">
+ <li>Rsync server e altri software di aggiornamento /
+ installazione di massa</li>
+
+ <li>Server imap / pop3 / webmail / smtp</li>
+
+ <li>Server ssh per i test degli studenti</li>
+
+ <li>File server Samba, NFS e controller di qualsiasi
+ altro FS distribuito</li>
+
+ <li>Print server per la gestione delle stampanti</li>
+
+ <li>DNS server</li>
+
+ <li>Mirror locale delle *.iso dei sistemi operativi e dei
+ vari software usati durante le lezioni</li>
+
+ <li>Spazi web con PHP, MySQL, Postgresql (altri DB o
+ framework vengono attivati a seconda dei corsi
+ attivi)</li>
+ </ul>
+
+ <p>Durante il corso delle lezioni e' opportuno che le
+ macchine degli studenti si appoggino al server Bender
+ (ottetto finale <tt class="docutils literal"><span class=
+ "pre">248</span></tt>), nel caso questo non fosse
+ raggiungibile (ad esempio per permettere impostazioni di
+ DHCP / routing diverse) sara' comunque disponibile il
+ <tt class="docutils literal"><span class=
+ "pre">10.10.208.254</span></tt> come gateway | DNS per la
+ rete <tt class="docutils literal"><span class=
+ "pre">10.10.208.10</span></tt>.</p>
+
+ <p><strong>Non e' piu' possibile</strong> raggiungere
+ Bender tramite l'IP pubblico <tt class=
+ "docutils literal"><span class=
+ "pre">212.22.136.248</span></tt> o <em>qualsiasi altro
+ ip</em> della classe <tt class=
+ "docutils literal"><span class="pre">C</span> <span class=
+ "pre">212.22.136.0/24</span></tt> precedentemente
+ disponibile.</p>
+
+ <p>Il computer del docente con il server VNC e' sempre
+ configurato con l'ottetto finale: <tt class=
+ "docutils literal"><span class="pre">177</span></tt> della
+ rete utilizzata durante le lezioni (quindi generalmente la
+ VNC sara' disponibile sul <tt class=
+ "docutils literal"><span class=
+ "pre">10.10.208.177:1</span></tt>.</p>
+
+ <p>Gli studenti sono pregati di non impedire l'accesso SSH
+ alla propria macchina dal computer del docente, e non
+ modificare la password dell'utente <tt class=
+ "docutils literal"><span class="pre">root</span></tt> del
+ sistema operativo <em>pre-istallato</em> (ad es:
+ <em>Diurno</em>).</p>
<div class="section" id="interfaces">
<h3><a class="toc-backref" href=
iface lo inet loopback
# La prima scheda di rete (se si chiama eth0)
-# (network, broadcast and gateway sono optional)
iface etho inet static
# esempio con dhcp:
# iface etho inet dhcp
broadcast 10.10.208.255
gateway 10.10.208.254
-# Quali interfacci devono partire automaticamente:
+# Quali interfaccie devono partire automaticamente:
auto lo eth0
</pre>
<p>I DNS vanno indicati nel file <tt class=
"docutils literal"><span class=
"pre">/etc/resolv.conf</span></tt> , la cui sintassi e'
- spiegata al punto 4.6 .</p>
+ spiegata al punto 4.6 . Come DNS si <em>deve</em> usare
+ il server Bender, alcuni parametri dei software di
+ installazione, risoluzione dei mirror, vengono
+ opportunamente modificatia da questo DNS.</p>
</div>
</div>
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
-# Some more alias to avoid making mistakes:
+# Abilitare i seguenti alias per impostare la conferma per cancellare file
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
<li><a class="reference external" href=
"http://www.caliban.org/bash/">Working more productively
with bash 2.x/3.x</a></li>
+
+ <li>UNIX / Linux Shell Scripting Tutorial: <a class=
+ "reference external" href=
+ "http://steve-parker.org/sh/sh.shtml">http://steve-parker.org/sh/sh.shtml</a></li>
</ul>
</div>
impostazioni per renderlo piu' comodo.</p>
<p>Assicurarsi che sia installata nel sistema la versione
- completa dell'editor <tt class=
- "docutils literal"><span class="pre">vim</span></tt>
- installando il pacchetto <tt class=
+ completa dell'editor installando il pacchetto <tt class=
"docutils literal"><span class="pre">vim</span></tt>:</p>
<pre class="literal-block">
- # apt-get install vim
-
-e modificare il file di configurazione generale ``/etc/vim/vimrc`` ::
-
- " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
- " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
- " you can find below. If you wish to change any of those settings, you should
- " do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
- " everytime an upgrade of the vim packages is performed. It is recommended to
- " make changes after sourcing debian.vim since it alters the value of the
- " 'compatible' option.
-
- " This line should not be removed as it ensures that various options are
- " properly set to work with the Vim-related packages available in Debian.
- runtime! debian.vim
-
- " Uncomment the next line to make Vim more Vi-compatible
- " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
- " options, so any other options should be set AFTER setting 'compatible'.
- "set compatible
-
- " Vim5 and later versions support syntax highlighting. Uncommenting the next
- " line enables syntax highlighting by default.
- syntax on
-
- " If using a dark background within the editing area and syntax highlighting
- " turn on this option as well.
- set background=dark
-
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
-
- if has("autocmd")
- au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
- \| exe "normal! g'\"" | endif
- endif
-
- " Uncomment the following to have Vim load indentation rules and plugins
- " according to the detected filetype.
- " This is not recommanded if you often copy and paste into vim,
- " as it messes all the indentation.
- if has("autocmd")
- filetype plugin indent on
- endif
-
- " This goes for comments folding: use co to expnad and zc to compress,
- " zi to toggle on/off
- set fdm=expr
- set fde=getline(v:lnum)=~'^\\s*#'?1:getline(prevnonblank(v:lnum))=~'^\\s*#'?1:getline(nextnonblank(v:lnum))=~'^\\s*#'?1:0
-
- " The following are commented out as they cause vim to behave a lot
- " differently from regular Vi. They are highly recommended though.
- set showcmd " Show (partial) command in status line.
- "set showmatch " Show matching brackets.
- # Ignorecase is quite userfull
- set ignorecase " Do case insensitive matching
- "set smartcase " Do smart case matching
- "set incsearch " Incremental search
- set autowrite " Automatically save before commands like :next and :make
- "set hidden " Hide buffers when they are abandoned
- "set mouse=a " Enable mouse usage (all modes) in terminals
-
- " Source a global configuration file if available
- " XXX Deprecated, please move your changes here in /etc/vim/vimrc
- if filereadable("/etc/vim/vimrc.local")
- source /etc/vim/vimrc.local
- endif
+# apt-get install vim
+</pre>
+
+ <p>Modificare poi il file di configurazione generale
+ <tt class="docutils literal"><span class=
+ "pre">/etc/vim/vimrc</span></tt></p>
+ <pre class="literal-block">
+" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
+" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
+" you can find below. If you wish to change any of those settings, you should
+" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
+" everytime an upgrade of the vim packages is performed. It is recommended to
+" make changes after sourcing debian.vim since it alters the value of the
+" 'compatible' option.
+
+" This line should not be removed as it ensures that various options are
+" properly set to work with the Vim-related packages available in Debian.
+runtime! debian.vim
+
+" Uncomment the next line to make Vim more Vi-compatible
+" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
+" options, so any other options should be set AFTER setting 'compatible'.
+"set compatible
+
+" Vim5 and later versions support syntax highlighting. Uncommenting the next
+" line enables syntax highlighting by default.
+syntax on
+
+" If using a dark background within the editing area and syntax highlighting
+" turn on this option as well.
+set background=dark
+
+" Uncomment the following to have Vim jump to the last position when
+" reopening a file
+
+if has("autocmd")
+ au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
+ \| exe "normal! g'\"" | endif
+endif
+
+" Uncomment the following to have Vim load indentation rules and plugins
+" according to the detected filetype.
+" This is not recommanded if you often copy and paste into vim,
+" as it messes all the indentation.
+if has("autocmd")
+ filetype plugin indent on
+endif
+
+" This goes for comments folding: use co to expnad and zc to compress,
+" zi to toggle on/off
+set fdm=expr
+set fde=getline(v:lnum)=~'^\\s*#'?1:getline(prevnonblank(v:lnum))=~'^\\s*#'?1:getline(nextnonblank(v:lnum))=~'^\\s*#'?1:0
+
+" The following are commented out as they cause vim to behave a lot
+" differently from regular Vi. They are highly recommended though.
+set showcmd " Show (partial) command in status line.
+"set showmatch " Show matching brackets.
+# Ignorecase is quite userfull
+set ignorecase " Do case insensitive matching
+"set smartcase " Do smart case matching
+"set incsearch " Incremental search
+set autowrite " Automatically save before commands like :next and :make
+"set hidden " Hide buffers when they are abandoned
+"set mouse=a " Enable mouse usage (all modes) in terminals
+
+" Source a global configuration file if available
+" XXX Deprecated, please move your changes here in /etc/vim/vimrc
+if filereadable("/etc/vim/vimrc.local")
+ source /etc/vim/vimrc.local
+endif
</pre>
<p>I principianti faranno bene ad esercitarsi con
<tt class="docutils literal"><span class=
"pre">vimtutor</span> <span class="pre">it</span></tt>.</p>
+
+ <p>Altri link per VIM:</p>
+
+ <ul class="simple">
+ <li>Vim Introduction and Tutorial: <a class=
+ "reference external" href=
+ "http://blog.interlinked.org/tutorials/vim_tutorial.html">
+ http://blog.interlinked.org/tutorials/vim_tutorial.html</a></li>
+
+ <li><a class="reference external" href=
+ "http://blog.smr.co.in/category/vim/">http://blog.smr.co.in/category/vim/</a></li>
+
+ <li><a class="reference external" href=
+ "http://vimdoc.sourceforge.net/">http://vimdoc.sourceforge.net/</a></li>
+ </ul>
</div>
<div class="section" id="vnc">
<pre class="literal-block">
su root
cd /bin
-wget http://debian.piffa.net/guarda.sh
+wget http://bender/guarda.sh
chmod +x guarda.sh
exit
</pre>
+ <p>Per eseguire lo script digitare semplicemente <tt class=
+ "docutils literal"><span class="pre">guarda.sh</span></tt>,
+ oppure creare un link / collegamento sul Desktop allo
+ script <tt class="docutils literal"><span class=
+ "pre">/bin/guarda.sh</span></tt>.</p>
+
+ <p>Le impostazioni del server VNC sono:</p>
+
+ <table border="1" class="docutils">
+ <colgroup>
+ <col width="55%">
+ <col width="45%">
+ </colgroup>
+
+ <thead valign="bottom">
+ <tr>
+ <th class="head">Parametro</th>
+
+ <th class="head">Valore</th>
+ </tr>
+ </thead>
+
+ <tbody valign="top">
+ <tr>
+ <td>IP</td>
+
+ <td>10.10.208.177:1</td>
+ </tr>
+
+ <tr>
+ <td>Server grafico</td>
+
+ <td>:1</td>
+ </tr>
+
+ <tr>
+ <td>password</td>
+
+ <td>password</td>
+ </tr>
+ </tbody>
+ </table>
+
<p>Si noti che non e' possibile lanciare un applicativo sul
server grafico di un utente da una shell in cui si sta
lavorando come altro utente, anche se root. E' quindi
pacchetto <tt class="docutils literal"><span class=
"pre">kde</span></tt>. Esiste un equivalente
<tt class="docutils literal"><span class=
- "pre">gnome-core</span> <span class=
- "pre">gnome</span></tt> per chi preferisce gnome, nel
- caso si potrebbe installare il log-in manager
- <tt class="docutils literal"><span class=
+ "pre">gnome-core</span></tt> per chi preferisce
+ Gnome, nel caso si potrebbe installare il log-in
+ manager <tt class="docutils literal"><span class=
"pre">gdm</span></tt> al posto di <tt class=
"docutils literal"><span class=
"pre">kdm</span></tt>.</td>
<p>Questo file contiene le opzioni di apt, come ad
esempio il proxy:</p>
<pre class="literal-block">
-Acquire::http::Proxy "http://10.10.208.254:3128";
+Acquire::http::Proxy "http://10.10.208.248:3128";
</pre>
<p>Si tenga conto che se si imposta un proxy per apt sul
proprio portatile e tornati a casa propria si vuole
- scaricare nuovi pacchetti si dovra' disabilitare il
- proxy.</p>
+ scaricare nuovi pacchetti si dovra' disabilitare il proxy
+ commentando la riga con ";" (''punto-e-virgola''):</p>
+
+ <div class="system-message">
+ <p class="system-message-title">System Message:
+ WARNING/2 (<tt class="docutils">servizi.txt</tt>, line
+ 326)</p>Literal block expected; none found.
+ </div>
+
+ <p>E' consigliabile impostare il proxy per apt anche in
+ presenza di un proxy-http <em>trasparente</em></p>
</div>
</div>
</div>
<p>Squid e' un proxy cache http (ma anche FTP e https)
robusto e strutturato, puo' essere usato sia in reti
- relativamente piccole grazie alla semplicita' di
- configurazione che in scenari piu' complessi grazie alla
- possibilita' di gestirne in modo granulare le risorse. Si
- partira' dalle configurazioni piu' semplici per la semplice
- <em>condivisione della navigazione</em> internet, per poi
- poter configurare la gestione degli accessi, il filtraggio
- dei contenuti (Squid e' una applicazione che si muove nel 4'
- livello del modello TCP/IP a differenza di un
- <em>ipfilter</em> limitato al 2') nel l bilanciamento del
- carico tra piu' hosts.</p>
+ relativamente semplici che in scenari piu' complessi grazie
+ alla possibilita' di gestirne in modo granulare le risorse.
+ Si partira' dalle configurazioni piu' semplici per la
+ semplice <em>condivisione della navigazione</em> internet,
+ per poi poter configurare la gestione degli accessi, il
+ filtraggio dei contenuti (Squid e' una applicazione che si
+ muove nel 4' livello del modello TCP/IP a differenza di un
+ <em>ipfilter</em> limitato al 2'), nel bilanciamento del
+ carico tra piu' server proxy.</p>
<dl class="docutils">
<dt>Inoltre Squid svolge la funzione di
<em>anonymizer</em>:</dt>
- <dd>nasconde i client http alla rete internet: risulta solo
- il server proxy nei log dei server web frequentati dagli
- utenti di Squid.</dd>
+ <dd>nasconde i client http alla rete internet: e' solo il
+ server proxy a risultare nei log dei server web frequentati
+ dagli utenti di Squid. Glu utenti non sono percepiti ed
+ esposti all'esterno.</dd>
</dl>
<p>Cosa a volte sottovalutata, Squid permette la navigazione
web a una rete basata su <em>indirizzi IP privati</em> (es
una 192.168.0.0/24). E se la rete privata deve <em>solo
- navigare</em> in internet, non serve un <em>NAT</em> od
- altro, basta il solo Squid. Per altro non servira' neanche un
- servizio DNS dato che <em>sara' il solo Squid a risolvere i
- nomi di dominio</em> per i suoi client http.</p>
+ navigare</em> in internet, non serve dover introdurre nella
+ rete un <em>NAT</em> (si veda la sezione sui firewall) per
+ condividere la connessione, basta il solo Squid. Per altro
+ non servira' neanche un servizio DNS utilizzabile dai clients
+ dato che <em>sara' il solo Squid a risolvere i nomi di
+ dominio</em> per i suoi client http.</p>
<p>Squid ascolta di default sulla porta 3128, per impostare
<em>apt</em> per utilizzarlo si aggiunga ad <tt class=
<h3><a class="toc-backref" href=
"#id118">9.10.3 Brute force</a></h3>
- <dl class="docutils">
- <dt>Per limitare attacchi di tipo brute force su
- SSH::</dt>
+ <p>Per limitare attacchi di tipo brute force su SSH:</p>
+ <pre class="literal-block">
+iptables -A INPUT -i ppp0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 3000 --hitcount 4 --name DEFAULT --rsource -j DROP
- <dd>
- <p class="first">iptables -A INPUT -i ppp0 -p tcp -m
- tcp --dport 22 -m state --state NEW -m recent
- --update --seconds 3000 --hitcount 4 --name DEFAULT
- --rsource -j DROP</p>
-
- <p class="last">iptables -A INPUT -i ppp0 -p tcp -m
- tcp --dport 22 -m state --state NEW -m recent --set
- --name DEFAULT --rsource</p>
- </dd>
- </dl>
+iptables -A INPUT -i ppp0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource
+</pre>
</div>
</div>
</div>