<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>:: syscallme :: &#187; Experience</title>
	<atom:link href="http://syscallme.2bopen.org/category/linux/experience/feed/" rel="self" type="application/rss+xml" />
	<link>http://syscallme.2bopen.org</link>
	<description>segfault of my memory leak</description>
	<lastBuildDate>Mon, 26 Jul 2010 10:18:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>VNC via HTTP con Guacamole: vediamolo su Ubuntu!</title>
		<link>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/</link>
		<comments>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 10:16:56 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Medium]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[guacamole]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=170</guid>
		<description><![CDATA[Come promesso scrivo qualche riga su un&#8217;applicazione che ho provato qualche mese fa e mi ha stupito veramente veramente tanto: Guacamole. No ragazzi, non parlo della (buonissima peraltro) salsa messicana! Guacamole è un viewer  VNC scritto in HTML5 e Javascript, che fa uso di piccolo proxy, server side scritto in Java. Per questo avrete necessità [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://syscallme.2bopen.org/wp-content/uploads/2010/07/guacamole.png"><img class="alignleft size-medium wp-image-174" title="guacamole" src="http://syscallme.2bopen.org/wp-content/uploads/2010/07/guacamole-300x172.png" alt="" width="300" height="172" /></a>Come promesso scrivo qualche riga su un&#8217;applicazione che ho provato qualche mese fa e mi ha stupito veramente veramente tanto: <a href="http://guacamole.sourceforge.net/" target="_blank"><strong>Guacamole</strong></a>. No ragazzi, non parlo della (buonissima peraltro) salsa messicana!</p>
<p>Guacamole è un viewer  VNC scritto in HTML5 e Javascript, che fa uso di piccolo proxy, <em>server side</em> scritto in Java. Per questo avrete necessità di deployarla all&#8217;interno di un qualsiasi <em>servlet container</em>. Io ho sempre utilizzato <a href="http://tomcat.apache.org/">Apache Tomcat</a>.</p>
<p>Utilizzandola avrete la possibilità di accedere al server sul quale è installata da un comunissimo browser compliant con gli standard HTML5; da lì, avrete il &#8220;possesso&#8221; completo della vostra macchina, come se foste in console e&#8230;beh,  al diavolo il proxy HTTP che vi blocca le connessioni SSH (tanto per fare un piccolo riferimento al mio <a href="http://syscallme.2bopen.org/2010/07/21/corkscrew-tunneling-ssh-attraverso-un-proxy-http-https/" target="_blank">post precedente</a>)!</p>
<p>Cmq, mi sembra superfluo continuare le spiegazioni (anche perchè non c&#8217;è molto altro da dire). Io proporrei di vederlo all&#8217;opera&#8230;voi che dite?</p>
<p><span id="more-170"></span></p>
<h3>Il contesto</h3>
<p>Due righe per spiegare dove e come proveremo Guacamole. Anzitutto l&#8217;OS: trattasi di una fantastica <a href="http://www.ubuntu.com" target="_blank">GNU/Linux Ubuntu Lucid Lynx 10.04 LTS</a>; direi il capolavoro di <a href="http://www.canonical.com/" target="_blank">Canonical</a>. Quindi il servlet container scelto che, come detto, è Apache Tomcat in versione 6.0.24. In ultimo la versione della jdk: una 1.60_20 per piattaforma 64bit. Ok ora sappiamo tutto. Andiamo a provare Guacamole!</p>
<h3>Installare Guacamole su Ubuntu 10.04</h3>
<p>Anzitutto ci occorrerà installare un VNC server. Guacamole, come detto, utilizza un proxettino che si metterà in contatto con il questo VNC server e otterrà la view della vostra console che poi verrà ri-renderizzata in HTML5 e Javascript.</p>
<p>Io come VNC server ho utilizzato <a href="http://www.karlrunge.com/x11vnc/" target="_blank">X11VNC</a>. Perchè è semplice da installare (basta un <em>apt-get install</em>); perchè il deamon lo gestisci via xinetd (che comunque installeremo) e a me questa cosa piace; ma soprattutto perchè è consigliato dagli stessi creatori di Guacamole! Vediamo come installarlo:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># apt-get install x11vnc xinetd</span></div></div>
<p>e configuriamo xinetd per gestire X11VNC: creiamo il file /etc/xinetd.d/x11vnc che contenga:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service x11vnc<br />
<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
port        = <span style="color: #000000;">5900</span><br />
only_from   = localhost<br />
<span style="color: #7a0874; font-weight: bold;">type</span>        = UNLISTED<br />
socket_type = stream<br />
protocol    = tcp<br />
<span style="color: #7a0874; font-weight: bold;">wait</span>        = no<br />
user        = root<br />
server      = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>x11vnc<br />
server_args = <span style="color: #660033;">-inetd</span> <span style="color: #660033;">-display</span> :<span style="color: #000000;">0</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>x11vnc.log <span style="color: #660033;">-24to32</span> <span style="color: #660033;">-scr</span> always <span style="color: #660033;">-xkb</span><br />
disable     = no<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Delle stringhe inserite qua sopra, la più rilevante è quella relativa ai server_args. Su Ubuntu questa è la configurazione ottimale, tuttavia ho già verificato che su altre distro c&#8217;è qualcosa da modificare (tipo Debian Lenny&#8230;). Ovviamente le modifiche dipendono direttamente da come viene configurato e gestito l&#8217;X server dalle varie distro. Diciamo che anche nella situazione peggiore, una googlata e un po&#8217; di dimestichezza con l&#8217;X server dovrebbe risolvervi il problema.</p>
<p>Notate inoltre che il server VNC sarà in listening solo su localhost (istruzione &#8220;only_from&#8221;). Ovviamente, dato che il traffico VNC serve solo a guacamole che, nel nostro caso perlomeno, risiederà sulla stessa macchina server, non occorre esporre troppo il servizio.</p>
<p>Diciamo che le altre voci dovrebbero essere semplici da capire. Come semplice da capire è che il server VNC andrà in listening sulla porta 5900 e utilizzeremo il display :0.</p>
<p>In ogni modo ora X11VNC e xinetd sono installati e configurati. Un piccolo restart</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># /etc/init.d/xinetd restart</span></div></div>
<p>e siamo apposto. Ora occupiamoci di Guacamole.</p>
<p>Chi non è nuovo di questo blog, sa che quando voglio installare un&#8217;applicativo che andrà in run da utente non privilegiato, io anzitutto creo un utente apposito e sfrutto la sua $HOME per installare l&#8217;applicazione che dovrà gestire. Apache Tomcat è un classico software che gira da utente non privilegiato. Di conseguenza creo l&#8217;utente &#8220;tomcat&#8221; che lo gestirà</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># groupadd tomcat</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># useradd -g tomcat -d /home/tomcat -m -s /bin/bash tomcat</span></div></div>
<p>e divento utente tomcat.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># su - tomcat</span><br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$</div></div>
<p>Tutto quello che accadrà da ora in poi sarà completamente &#8220;responsabilità&#8221; del nuovo utente <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Siamo pronti per procurarci (prima di tutto) il software che ci serve. Quindi, prima di continuare la vostra lettura, assicurative di scaricare:</p>
<ul>
<li>la JDK a questo indirizzo: http://java.sun.com/javase/downloads/widget/jdk6.jsp</li>
<li>Apache Tomcat a questo: http://tomcat.apache.org/download-60.cgi</li>
<li>Guacamole sulla sua pagina Sourceforge: http://sourceforge.net/projects/guacamole/</li>
</ul>
<p>Mettiamo tutto in una directory di proprietà dell&#8217;utente &#8220;tomcat&#8221; che chiameremo &#8220;pkg&#8221; e diamo i giusti permessi.</p>
<p>Come prima cosa installiamo la JDK e mettiamola nel $PATH dell&#8217;utente tomcat. Anzitutto diamo al .bin appena scaricato i permessi di eseguibilità</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x jdk-6u20-linux-x64.bin</div></div>
<p>e quindi runniamo l&#8217;eseguibile</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ .<span style="color: #000000; font-weight: bold;">/</span>jdk-6u20-linux-x64.bin</div></div>
<p>Creiamo un link simbolico per la dir della jdk. Questo ci darà due vantaggi:</p>
<ul>
<li>semplificare la path</li>
<li>effettuare tutti i settings relativi alla messa in PATH della JavaVM utilizzando un percorso che <strong>non cambierà mai</strong> a prescindere le versioni della JDK che cambierete nel tempo.</li>
</ul>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> .<span style="color: #000000; font-weight: bold;">/</span>jdk1.6.0_22 java</div></div>
<p>Quindi modifichiamo il .bashrc dell&#8217;utente inserendo queste due righe:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #ff0000;">&quot;/home/tomcat/java&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$JAVA_HOME</span>/bin:<span style="color: #007800;">$PATH</span>&quot;</span></div></div>
<p>e ricarichiamo le impostazioni utente</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ . .bashrc</div></div>
<p>Se ora diamo un colpetto di <em>which</em> dovremo vedere che java viene correttamente identificato</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">which</span> java<br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java</div></div>
<p>A questo punto passiamo a Tomcat. Spacchettiamo il .tar.gz che abbiamo scaricato (ricordo che stiamo provando con la versione 6.0.24) e spostiamolo nella home dell&#8217;utente.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf apache-tomcat-6.0.24.tar.gz<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">mv</span> apache-tomcat6.0.24 ..</div></div>
<p>Ora, sempre nella dir ~/pkg spacchettiamo anche Guacamole:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf guacamole-<span style="color: #000000;">0.26</span>.tar.gz</div></div>
<p>All&#8217;interno della directory spacchettata troverete i seguenti files:</p>
<ul>
<li><strong>guacamole.war</strong>: è il compilato dell&#8217;applicazione che deployeremo più tardi all&#8217;interno di Tomcat</li>
<li><strong>guacamole.xml</strong>: l&#8217;xml del contesto. Poche modifiche ed è già bello e pronto</li>
<li><strong>guacamole-users.xml</strong>: è il file xml che definisce l&#8217;autenticazione HTTP per accedere a guacamole. Anche questo provvederemo a modificarlo</li>
<li><strong>guacamole-src.tar</strong>: per chiunque ne senta il bisogno&#8230;ecco il sorgente!</li>
<li><strong>LICENSE.txt</strong>: la tua copia della licenza con cui è rilasciato Guacamole. Che è la GPL3.</li>
</ul>
<p>Cominciamo l&#8217;installazione. Anzitutto copiamo il file guacamole.war all&#8217;interno della folder &#8220;webapps&#8221; del vostro tomcat.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole-<span style="color: #000000;">0.26</span> $ <span style="color: #c20cb9; font-weight: bold;">cp</span> guacamole.war <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>webapps</div></div>
<p>Quindi copiamo il file guacamole-users.xml nella folder di conf di tomcat. Se aprite questo file, inoltre, vi accorgerete che la password è settata a &#8220;changeme&#8221;. Beh lo dice la parola stessa&#8230;modificatela!</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole-<span style="color: #000000;">0.26</span> $ <span style="color: #c20cb9; font-weight: bold;">cp</span> guacamole-users.xml <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf</div></div>
<p>Ora tocca al file di contesto. Apriamolo e modifichiamo la docBase del Context, specificando la path assoluta di dove si trova il nostro file .war. In poche parole sostituiamo questa riga qui:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&amp;</span>lt;Context <span style="color: #007800;">antiJARLocking</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;/guacamole&quot;</span> <span style="color: #007800;">docBase</span>=<span style="color: #ff0000;">&quot;/var/lib/guacamole/guacamole.war&quot;</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;</div></div>
<p>con questa qui</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&amp;</span>lt;Context <span style="color: #007800;">antiJARLocking</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;/guacamole&quot;</span> <span style="color: #007800;">docBase</span>=<span style="color: #ff0000;">&quot;/home/tomcat/apache-tomcat6.0.24/webapps/guacamole.war&quot;</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;</div></div>
<p>Richiudetelo e spostatelo nella folder Catalina/localhost da creare all&#8217;interno della directory &#8220;conf&#8221;. Così</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>Catalina<span style="color: #000000; font-weight: bold;">/</span>localhost<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">cp</span> pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole.xml apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>Catalina<span style="color: #000000; font-weight: bold;">/</span>localhost</div></div>
<p>Ok signori. Abbiamo finito. Startiamo tomcat</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #7a0874; font-weight: bold;">cd</span> apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>bin<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>bin $ .<span style="color: #000000; font-weight: bold;">/</span>catalina.sh start</div></div>
<p>e visitiamo la paginetta http://localhost:8080/guacamole. Inseriamo user e password specificati nel file guacamole-users.xml e&#8230; UALA&#8217;! Il VNC via HTTP è servito!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;T=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;t=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Corkscrew: tunneling ssh attraverso un proxy HTTP/HTTPS</title>
		<link>http://syscallme.2bopen.org/2010/07/21/corkscrew-tunneling-ssh-attraverso-un-proxy-http-https/</link>
		<comments>http://syscallme.2bopen.org/2010/07/21/corkscrew-tunneling-ssh-attraverso-un-proxy-http-https/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 13:29:20 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[corkscrew]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=152</guid>
		<description><![CDATA[E&#8217; effettivamente molto tempo che non scrivo più un post tecnico, un how-to, una guida o qualcosa che ci somigli. Lo ametto, un po&#8217; queste pagine mi mancavano. Mi sono chiesto cosa raccontarvi, ce ne sarebbero in realtà di cose, ma cerco sempre di trovare argomenti che siano sì interessanti, ma anche &#8220;sfiziosi&#8221;, che raccolgano [...]]]></description>
			<content:encoded><![CDATA[<p>E&#8217; effettivamente molto tempo che non scrivo più un post tecnico, un how-to, una guida o qualcosa che ci somigli. Lo ametto, un po&#8217; queste pagine mi mancavano. Mi sono chiesto cosa raccontarvi, ce ne sarebbero in realtà di cose, ma cerco sempre di trovare argomenti che siano sì interessanti, ma anche &#8220;sfiziosi&#8221;, che raccolgano le attenzioni di un pubblico vasto, che rispondano ad esigenze specifiche.</p>
<p>E allora ho pensato: perchè non raccontare come garantirsi una connettività ssh anche quando sembra impossibile?</p>
<p>Lo scopo di questo post è dare le indicazioni necessarie per permettere alla propria Linux-box di raggiungere in ssh qualsiasi server sparso nel pianeta, anche nella situazione più scomoda del mondo. Quando, cioè, la nostra connettività è sottomessa ad un cattivissimo proxy che ci lascia libere solo le porte HTTP e HTTPS in uscita. Per farlo eseguiremo un tunneling ssh attraverso il nostro maledettissimo proxy, e sfrutteremo un softwarino open piccolo piccolo ma potente potente: <a href="http://www.agroman.net/corkscrew/" target="_blank"><strong>Corkscrew</strong></a>.</p>
<p><span id="more-152"></span></p>
<h3>Un po&#8217; di teoria (semplificata)</h3>
<p>Probabilmente sappiamo tutti cos&#8217;è un proxy e come funziona. Se qualcuno  avesse dei dubbi, può dare un&#8217;occhiata alla <a href="http://it.wikipedia.org/wiki/Proxy" target="_blank">pagina  relativa su Wikipedia</a>. Molto spesso, essere dietro ad un proxy HTTP, vuol dire dover rinunciare a tutti i flussi comunicativi che non siano, appunto, flussi HTTP o HTTPS. Il che si traduce in una semplice affermazione: <em> </em></p>
<blockquote><p><em>qualsiasi tentantivo di connessione verso l&#8217;esterno diretto verso porte diverse dall&#8217;80 (HTTP) e dalla 443 (HTTPS) risulteranno bloccati dal proxy</em>.</p></blockquote>
<p>Come sappiamo, quando provo a loggarmi in ssh su un server remoto, sto provando ad istanziare una connessione sulla porta 22 di questo server. Ovviamente il proxy HTTP non mi farà passare. Come risolvere questo problema?</p>
<p>Diciamo che la soluzione che mi sono divertito a trovare non è proprio &#8220;a basso impatto&#8221;!! Nello specifico si tratta di utilizzare (e quindi di base di avere a disposizione&#8230;) un &#8220;server ponte&#8221;, sul quale settare SSH in listening sulla 443.</p>
<p>La 443 è la porta dell&#8217;HTTPS. L&#8217;HTTPS è consentito generalmente da un classico proxy HTTP. Di conseguenza, istanziando una connessione ssh sul nostro &#8220;server ponte&#8221;, stiamo materialmente chiedendo al nostro proxy di far passare un flusso dati destinato ad una porta che lui considera abilitata.</p>
<p>Questo è il nostro ambiente, questo è quello che spiegheremo di seguito.</p>
<h3>Due parole su Corkscrew</h3>
<p>Corkscrew è, banalmente e semplicemente, un software che permette la realizzazione di tunnels ssh attraverso proxies HTTP. La sua home page è questa: http://www.agroman.net/corkscrew. Se utilizzate Debian o Ubuntu (server o desktop non fa differenza) ve lo trovate già pacchettizzato. Altrimenti dovrete attrezzarvi e compilarlo, ma non è certo un lavorone. Nel nostro caso utilizzeremo come &#8220;distribuzione-esempio&#8221; Ubuntu Lucid Lynx 10.04 LTS.</p>
<p>La configurazione di Corkscrew è veramente semplice e consta di un file <em>config</em> che va posizionato all&#8217;interno della cartella <em>.ssh</em> che ogni utente linux dovrebbe avere nella sua $HOME.</p>
<h3>Iniziamo a lavorare</h3>
<h4>Configuriamo il server ponte</h4>
<p>Cominciamo dal nostro &#8220;server ponte&#8221; Qui dovremmo mettere SSH in ascolto sulla 443. Non lo togliamo, però, dalla porta 22 perchè può sempre tornare utile!</p>
<p>Per fare ciò è sufficiente aprire il file /etc/sshd/sshd_config ed aggiungere la seguente stringa:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Port <span style="color: #000000;">443</span></div></div>
<p>sotto la dichiarazione (uguale peraltro) relativa alla porta 22. Restartate SSH</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-server:~<span style="color: #666666; font-style: italic;"># /etc/init.d/ssh restart</span><br />
<span style="color: #000000; font-weight: bold;">*</span> Restarting OpenBSD Secure Shell server sshd<br />
...done.</div></div>
<p>e il gioco è fatto. Con un piccolo netstat vedremo che SSH è correttamente in LISTENING sulla porta 443.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@ubuntu-server:~# netstat -natp<br />
Active Internet connections (servers and established)<br />
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name<br />
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      16680/sshd<br />
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      10661/exim4<br />
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      16680/sshd<br />
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      11369/mysqld<br />
tcp6       0      0 :::80                   :::*                    LISTEN      3895/apache2<br />
tcp6       0      0 :::22                   :::*                    LISTEN      16680/sshd<br />
tcp6       0      0 :::443                  :::*                    LISTEN      16680/sshd</div></div>
<p>Come potete vedere nella terza riga, SSH aspetta la nostra connessione sulla porta 443. Perfetto! Ora procediamo a configurare il client.</p>
<h4>Configuriamo il nostro client</h4>
<p>Sul nostro client, anzitutto, scarichiamo corkscrew. Può bastare un colpetto di apt-get&#8230;</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-client:~<span style="color: #666666; font-style: italic;"># apt-get install corkscrew</span></div></div>
<p>Una volta concluso download ed installazione del pacchetto entriamo nella nostra directory .ssh</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-client:~<span style="color: #666666; font-style: italic;"># cd .ssh</span></div></div>
<p>e qui creiamo il nostro file &#8220;config&#8221;</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-client:~<span style="color: #000000; font-weight: bold;">/</span>.ssh <span style="color: #666666; font-style: italic;"># vi config</span></div></div>
<p>che conterrà due righe due</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Host my.serverponte.com<br />
ProxyCommand corkscrew my.proxy.local <span style="color: #000000;">8080</span> <span style="color: #000000; font-weight: bold;">%</span>h <span style="color: #000000;">443</span></div></div>
<p>Ovviamente sostituite &#8220;my.proxy.local&#8221; con l&#8217;indirizzo o il FQDN del vostro proxy e 8080 con la porta sulla quale esso è in listening. Una volta fatto ciò il gioco è fatto. Dalla vostra shell digitate</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-client:~<span style="color: #666666; font-style: italic;"># ssh root@my.serverponte.com</span></div></div>
<p>Una volta che siete lì&#8230;siete dappertutto!!!</p>
<h4>E se il mio proxy necessita di credenziali???</h4>
<p>A volte può accadere che sia necessario inserire delle credenziali per accedere al proxy. In quel caso è necessario scrivere quelle credenziali in un authfile. Creiamolo:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-client:~<span style="color: #666666; font-style: italic;"># vi ~/.ssh/authfile</span></div></div>
<p>e scriviamo all&#8217;interno le nostre credenziali, prima la username, poi la password separate da un &#8220;:&#8221;. In questo modo</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">username:password</div></div>
<p>Per farlo leggere al file config è necessario aggiungere alla seconda riga del <em>config </em>la path (anche relativa) dell&#8217;authfile. Il <em>config</em> diventerà quindi:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Host my.serverponte.com<br />
ProxyCommand corkscrew my.proxy.local <span style="color: #000000;">8080</span> <span style="color: #000000; font-weight: bold;">%</span>h <span style="color: #000000;">443</span> authfile</div></div>
<p>Nel nostro caso, dato che l&#8217;<em>authfile </em>si trova esattamente allo stesso livello del file <em>config</em> può bastare inserire solo il nome del file.</p>
<p>Ok anche qui il gioco è fatto. Un colpetto di ssh sul serverponte e siete fuori!</p>
<h3>ATTENZIONE!!!</h3>
<p>Attenzione:  tutte le indicazioni date sopra potrebbero non essere valide (quindi non funzionare!) se il vostro è un proxy NTLM. In quel caso dovrete utilizzare corkscrew in combinazione con NTLMAPS. Ma questa è un&#8217;altra storia&#8230;che forse scriverò! <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Enjoy!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;title=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;title=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;title=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;T=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;title=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F21%2Fcorkscrew-tunneling-ssh-attraverso-un-proxy-http-https%2F&amp;t=Corkscrew%3A+tunneling+ssh+attraverso+un+proxy+HTTP%2FHTTPS" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2010/07/21/corkscrew-tunneling-ssh-attraverso-un-proxy-http-https/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Installare Php 5.3.x in CentOs5</title>
		<link>http://syscallme.2bopen.org/2009/12/07/installare-php-5-3-x-in-centos5/</link>
		<comments>http://syscallme.2bopen.org/2009/12/07/installare-php-5-3-x-in-centos5/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 12:37:16 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[CentOs]]></category>
		<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=135</guid>
		<description><![CDATA[RedHat non da supporto per nessuna versione PHP più alta della 5.1.6 e oggettivamente, mettersi a compilare non è proprio il massimo della vita, considerando anche che poi, una volta finita la compilazione, ci troveremmo con tutte le dipendenze broken. Di conseguenza CentOs (che segue pedissequamente i rilasci degli rpm-src RHEL), anche nella sua latest [...]]]></description>
			<content:encoded><![CDATA[<p>RedHat non da supporto per nessuna versione PHP più alta della 5.1.6 e oggettivamente, mettersi a compilare non è proprio il massimo della vita, considerando anche che poi, una volta finita la compilazione, ci troveremmo con tutte le dipendenze <em>broken</em>.</p>
<p>Di conseguenza CentOs (che segue pedissequamente i rilasci degli rpm-src RHEL), anche nella sua latest 5.4, ti propone PHP 5.1.6 come versione standard. Il che ti può creare problemi se hai una applicazione che utilizza versioni più elevate (cosa molto comune se hai sviluppato qualcosa con Zend Framework).</p>
<p>Al chè ho pensato potesse essere utile scrivere due righe di guida per capire come aggiornare il sistema CentOs a versioni più recenti della 5.1.6.</p>
<p><span id="more-135"></span></p>
<p>Per installare una versione più &#8220;alta&#8221; di PHP potete utilizzare l&#8217;<a href="http://blog.famillecollet.com/post/2005/10/02/8-telechargement-installation-et-yum" target="_blank">RPM Repository gestito e mantenuto da Remi</a>.</p>
<p>Innanzitutto scaricatevi e installate gli rpm di riferimento in questo modo:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span>.noarch.rpm<br />
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>enterprise<span style="color: #000000; font-weight: bold;">/</span>remi-release-<span style="color: #000000;">5</span>.rpm<br />
rpm <span style="color: #660033;">-Uvh</span> remi-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm epel-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm</div></div>
<p>Ora i repos sono installati sul vostro sistema ma non sono abilitati. Non c&#8217;è bisogno di farlo, potete gestirli direttamente da linea di comando. Ora aggiorniamo la nostra release di PHP.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">yum <span style="color: #660033;">--enablerepo</span>=remi update php</div></div>
<p>se non avete ancora installato PHP al posto della parolina &#8220;update&#8221; scrivete &#8220;install&#8221;.<br />
Ok il gioco è fatto, controllate la nuova versione in questo modo:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>jessica ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># php -v</span><br />
PHP 5.3.1 <span style="color: #7a0874; font-weight: bold;">&#40;</span>cli<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>built: Nov <span style="color: #000000;">20</span> <span style="color: #000000;">2009</span> <span style="color: #000000;">17</span>:<span style="color: #000000;">51</span>:<span style="color: #000000;">14</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <br />
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1997</span>-<span style="color: #000000;">2009</span> The PHP Group<br />
Zend Engine v2.3.0, Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1998</span>-<span style="color: #000000;">2009</span> Zend Technologies</div></div>
<p>Ok. Fatto! Enjoy <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;title=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;title=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;title=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;T=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;title=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Installare+Php+5.3.x+in+CentOs5+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F12%2F07%2Finstallare-php-5-3-x-in-centos5%2F&amp;t=Installare+Php+5.3.x+in+CentOs5" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2009/12/07/installare-php-5-3-x-in-centos5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bind9 in chroot su Centos 5.4</title>
		<link>http://syscallme.2bopen.org/2009/10/25/bind9-in-chroot-su-centos-54/</link>
		<comments>http://syscallme.2bopen.org/2009/10/25/bind9-in-chroot-su-centos-54/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 11:14:25 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Experience]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Medium]]></category>
		<category><![CDATA[Bind9]]></category>
		<category><![CDATA[CentOs]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Sicurezza]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=58</guid>
		<description><![CDATA[Sono in serie positiva, altro giro altra corsa, altro post altro how-to. In queste (poche) righe che seguono, vedremo come installare e configurare un dominio sul popolare DNS Server Bind9 ospitato su una Centos 5.4 (latest release ad oggi) in chroot mode. L&#8217;environment scelto, come detto, è una Centos, ma (a parte i posizionamenti dei [...]]]></description>
			<content:encoded><![CDATA[<p>Sono in serie positiva, altro giro altra corsa, altro post altro how-to. In queste (poche) righe che seguono, vedremo come installare e configurare un dominio sul popolare DNS Server <a href="http://www.bind9.net/" target="_blank">Bind9</a> ospitato su una Centos 5.4 (latest release ad oggi) in <strong><a href="http://it.wikipedia.org/wiki/Chroot" target="_blank">chroot</a> mode</strong>.</p>
<p>L&#8217;environment scelto, come detto, è una Centos, ma (a parte i posizionamenti dei files e delle directory che può cambiare, la configurazione di Bind9 è piuttosto generica e quindi, la guida, può essere &#8220;traslata&#8221; facilmente anche su sistemi &#8220;debian-based&#8221;.</p>
<p><span id="more-58"></span><br />
Non è questo il luogo dove illustreremo le peculiarità e i vantaggi in termini di sicurezza che stanno dietro alla scelta di installare e configurare in modo che sia startato dal sistema in chroot. Googlando un po&#8217; troverete molte guide e manuali che vi possono spiegare tutto ciò.</p>
<p>Come primo passo installeremo i pacchetti necessari utilizzando yum</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #7a0874; font-weight: bold;">bind</span> bind-chroot bind-libs bind-utils caching-nameserver</div></div>
<p>Ad installazione conclusa spostiamoci nella directory /var/named/chroot/etc e cominciamo le configurazioni</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>named<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>etc<br />
rndc-confgen <span style="color: #000000; font-weight: bold;">&gt;</span> rndc.key<br />
<span style="color: #c20cb9; font-weight: bold;">chown</span> root:named rndc.key</div></div>
<p>Controllate che il file <strong>rndc.key</strong> appaia così:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Start of rndc.conf</span><br />
key <span style="color: #ff0000;">&quot;rndckey&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
algorithm hmac-md5;<br />
secret <span style="color: #ff0000;">&quot;n0nV8Jd1nbAby8m3yJMmUw==&quot;</span>;<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span>;</div></div>
<p>Non vi occorre nient&#8217;altro, quindi potete anche rimuovere le altre righe che troverete nel file.<br />
Date un&#8217;occhiata all&#8217;interno di /etc: dovreste avere un symlink all&#8217;rndc.key. E&#8217; importante che questo symlink esista e dovrebbe essere correttamente creato da yum durante la fase di spacchettamento dell&#8217;rpm. Se, tuttavia, così non fosse preoccupatevi di crearlo, perchè poi il demone <strong>named</strong> si aspetta di trovarlo lì&#8230;è bene che non lo deludiate.</p>
<p>Ora configuriamo il file named.conf</p>
<div class="codecolorer-container php blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// qui includiamo l'rndc.key con un bel copia-incolla</span><br />
<a href="http://www.php.net/key"><span style="color: #990000;">key</span></a> <span style="color: #0000ff;">&quot;rndckey&quot;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; algorithm hmac<span style="color: #339933;">-</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; secret <span style="color: #0000ff;">&quot;n0nV8Jd1nbAby8m3yJMmUw==&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// assumiamo che il nostro dns server abbia l'ip 192.168.13.75 </span><br />
<span style="color: #666666; font-style: italic;">// e serva la subnet 192.168.13.0/24. Ovviamente customizzate in </span><br />
<span style="color: #666666; font-style: italic;">// base alle vostre esigenze</span><br />
controls <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; inet 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1 allow <span style="color: #009900;">&#123;</span> 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> keys <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;rndckey&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; inet 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>75 allow <span style="color: #009900;">&#123;</span> 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>0<span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> keys <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;rndckey&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
options <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; directory <span style="color: #0000ff;">&quot;/var/named&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; pid<span style="color: #339933;">-</span><a href="http://www.php.net/file"><span style="color: #990000;">file</span></a> <span style="color: #0000ff;">&quot;/var/run/named/named.pid&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; recursion yes<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; allow<span style="color: #339933;">-</span>recursion <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>0<span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// inserite i vostri dns server. </span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Io ho messo quelli di OpenDns</span><br />
&nbsp; &nbsp; forwarders <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 208<span style="color: #339933;">.</span>67<span style="color: #339933;">.</span>222<span style="color: #339933;">.</span>222<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 208<span style="color: #339933;">.</span>67<span style="color: #339933;">.</span>220<span style="color: #339933;">.</span>220<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; listen<span style="color: #339933;">-</span>on <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>75<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/*<br />
&nbsp; &nbsp; &nbsp;* Se avete un firewall fra voi e i nameservers &nbsp;<br />
&nbsp; &nbsp; &nbsp;* che dovete contattare potreste aver bisogno <br />
&nbsp; &nbsp; &nbsp;* di scommentare la direttiva query-source che <br />
&nbsp; &nbsp; &nbsp;* trovate qui sotto. &nbsp;Versioni precedenti di Bind <br />
&nbsp; &nbsp; &nbsp;* facevano sempre query attraverso la porta 53, <br />
&nbsp; &nbsp; &nbsp;* ma da BIND 8.1 viene utilizzata una porta<br />
&nbsp; &nbsp; &nbsp;* non privilegiata (sopra la 1024) di default.<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp;query<span style="color: #339933;">-</span>source address <span style="color: #339933;">*</span> port <span style="color: #cc66cc;">53</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// questa istruzione è per non rendere pubblica </span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// la versione di bind utilizzata</span><br />
&nbsp; &nbsp; version <span style="color: #0000ff;">&quot;REFUSED&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; allow<span style="color: #339933;">-</span>query <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>0<span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
server 192<span style="color: #339933;">.</span>168<span style="color: #339933;">.</span>13<span style="color: #339933;">.</span>75 <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; keys <span style="color: #009900;">&#123;</span> rndckey<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
zone <span style="color: #0000ff;">&quot;.&quot;</span> IN <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; type hint<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/file"><span style="color: #990000;">file</span></a> <span style="color: #0000ff;">&quot;named.ca&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Questa è la zona del nostro dominio</span><br />
zone <span style="color: #0000ff;">&quot;example.com&quot;</span> IN <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; type master<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/file"><span style="color: #990000;">file</span></a> <span style="color: #0000ff;">&quot;data/example.com.zone&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; allow<span style="color: #339933;">-</span>update <span style="color: #009900;">&#123;</span> none<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// per abilitare il master/slave scommenta sotto</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// allow-transfer { 192.168.13.76; };</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></div>
<p>Ok: ora configuriamo la nostra zona. Per farlo creiamo il file /var/named/chroot/var/named/data/example.com.zone. Sarà qualcosa che appare più o meno così:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">$ttl</span> <span style="color: #000000;">38400</span><br />
example.com. &nbsp; &nbsp;IN &nbsp; &nbsp;SOA &nbsp; &nbsp; ns.example.com. admin.example.com. <span style="color: #7a0874; font-weight: bold;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">2009102402</span> &nbsp; &nbsp;; Serial<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">10800</span> &nbsp; &nbsp; &nbsp; &nbsp; ; Refresh after <span style="color: #000000;">3</span> hours<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3600</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; Retry after <span style="color: #000000;">1</span> hour<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">604800</span> &nbsp; &nbsp; &nbsp; &nbsp;; Expire after <span style="color: #000000;">1</span> week<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">86400</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; ; Minimum TTL of <span style="color: #000000;">1</span> day<br />
<br />
example.com. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IN &nbsp; &nbsp; &nbsp;NS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ns.example.com.<br />
ns.example.com. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IN &nbsp; &nbsp; &nbsp;A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.13.75<br />
dns.example.com. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IN &nbsp; &nbsp; &nbsp;A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.13.75<br />
server1.example.com. &nbsp; &nbsp; &nbsp;IN &nbsp; &nbsp; &nbsp;A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.13.31<br />
server2.example.com. &nbsp; &nbsp; &nbsp;IN &nbsp; &nbsp; &nbsp;A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.13.38<br />
www.example.com. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IN &nbsp; &nbsp; &nbsp;CNAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;example.com.</div></div>
<p>Ovviamente la parte in fondo customizzatela a secondo dei record che volete propagare.<br />
Ok abbiamo finito. Come avete visto è veramente semplice. Ora startiamo named e assicuriamoci che parta al boot</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service named start<br />
chkconfig named on</div></div>
<p>E ora controlliamo che tutto sia startato correttamente dando un colpetto di &#8220;rndc status&#8221;</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># rndc status</span><br />
number of zones: <span style="color: #000000;">1</span><br />
debug level: <span style="color: #000000;">0</span><br />
xfers running: <span style="color: #000000;">0</span><br />
xfers deferred: <span style="color: #000000;">0</span><br />
soa queries <span style="color: #000000; font-weight: bold;">in</span> progress: <span style="color: #000000;">0</span><br />
query logging is OFF<br />
recursive clients: <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1000</span><br />
tcp clients: <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">100</span><br />
server is up and running</div></div>
<p>Ok è tutto &#8220;folks!&#8221;. Per essere sicuri che tutto funziona fate qualche query con nslookup o con dig, sia dal server dns che dagli altri server.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;title=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;title=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;title=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;T=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;title=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Bind9+in+chroot+su+Centos+5.4+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F25%2Fbind9-in-chroot-su-centos-54%2F&amp;t=Bind9+in+chroot+su+Centos+5.4" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2009/10/25/bind9-in-chroot-su-centos-54/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semplice Autenticazione HTTP via Ldap</title>
		<link>http://syscallme.2bopen.org/2009/10/22/semplice-autenticazione-http-via-ldap/</link>
		<comments>http://syscallme.2bopen.org/2009/10/22/semplice-autenticazione-http-via-ldap/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 10:51:01 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Simple]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=57</guid>
		<description><![CDATA[Un brevissimo articolo, tanto per rispolverare il blog che prende polvere da un po&#8217;, e anche per scrivere una banalità che però alla fine mi dimentico sempre e perdo molto più tempo a ricercarne l&#8217;how-to che ad implementarla. E ciò e male. In ogni modo l&#8217;obiettivo di questo piccolo post/piccolissimo how-to è quello di dare [...]]]></description>
			<content:encoded><![CDATA[<p>Un brevissimo articolo, tanto per rispolverare il blog che prende polvere da un po&#8217;, e anche per scrivere una banalità che però alla fine mi dimentico sempre e perdo molto più tempo a ricercarne l&#8217;how-to che ad implementarla. E ciò e male.</p>
<p>In ogni modo l&#8217;obiettivo di questo piccolo post/piccolissimo how-to è quello di dare le indicazioni corrette per implementare una autenticazione HTTP via <a href="http://it.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol" target="_blank">ldap</a> su delle vostre pagine web.</p>
<p>Il contesto è semplice: avete una pubblicazione web (un sito, delle info, una attività di un vostro sviluppo che vi occorre online ma che non deve essere accessibile da tutti e indicizzabile da google neanche per sbaglio). E oltre a questo, avete anche un server OpenLdap che potete sfruttare per le autenticazioni.</p>
<p>Vediamo come si fa</p>
<p><span id="more-57"></span></p>
<p>Una autenticazione classica HTTP richiede solitamente la creazione di un file di password (che generalmente viene creato attraverso l&#8217;utilizzo del binario <a href="http://httpd.apache.org/docs/2.0/programs/htpasswd.html" target="_blank"><strong>htpasswd</strong></a> di <a href="http://httpd.apache.org/" target="_blank">Apache</a>). All&#8217;interno di esso, Apache, si preoccupa di creare una associazione uno ad uno tra il nome utente scelto e la cifratura della password scelta. Sarà lo stesso Apache ad interpretare poi quel file per consentire o meno l&#8217;autenticazione, quando se lo troverà nella configurazione del suo virtualhost o nell&#8217;<a href="http://httpd.apache.org/docs/2.2/howto/htaccess.html" target="_blank">.htaccess</a> del proprio contenuto web.</p>
<p>Demandare l&#8217;autenticazione ad Ldap sicuramente è una soluzione molto più pratica (l&#8217;utente ha già una coppia di credenziali e usa sempre quella per loggarsi a qualsiasi cosa) ma si fa i conti con una piccola differenza logica rispetto allo scenario descritto sopra. Nel file di accesso creato con htpasswd, c&#8217;è una associazione uno ad uno scritta più o meno così:</p>
<p>miousername:hashdellamiapassword</p>
<p>In questo modo, con &#8220;una sola fava&#8221; si vanno a prendere &#8220;due piccioni&#8221;, perchè ad Apache dai due tipi di informazioni: quali sono gli username abilitati ad accedere all&#8217;area riservata e quale è la loro password.</p>
<p>Mentre se demandi su ldap l&#8217;autenticazione HTTP, hai il problema di dire ad Apache quali sono gli utenti che ne debbono giovare.</p>
<p>Ok andiamo al dunque. Per implementare una HTTP Basic Authentication via Ldap in Apache, è sufficiente aggiungere il seguente blocco di configurazione all&#8217;interno di una direttiva del proprio virtualhost, oppure (più semplicemente) all&#8217;interno del proprio file .htaccess.</p>
<div class="codecolorer-container apache blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #adadad; font-style: italic;"># LDAP Authentication</span><br />
<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;My Restricted Area&quot;</span><br />
<span style="color: #00007f;">AuthType</span> Basic<br />
<span style="color: #00007f;">AuthBasicProvider</span> ldap<br />
<span style="color: #00007f;">AuthzLDAPAuthoritative</span> <span style="color: #0000ff;">on</span><br />
<span style="color: #00007f;">AuthLDAPURL</span> ldap://my.ldap.com:<span style="color: #ff0000;">389</span>/dc=mydomain,dc=com?uid<br />
<span style="color: #00007f;">AuthLDAPBindDN</span> <span style="color: #7f007f;">&quot;cn=My ReadOnly Account,ou=dept,dc=mydomain,dc=com&quot;</span><br />
<span style="color: #00007f;">AuthLDAPBindPassword</span> password<br />
<span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">user</span></div></div>
<p>Commentiamo stringa per stringa.</p>
<p><strong>AuthName</strong>: Label per la vostra area riservata. Qui potete scrivere veramente quello che vi pare!<br />
<strong>AuthType</strong>: il tipo di autenticazione scelta. La nostra è Basic.<br />
<strong>AuthBasicProvider</strong>: rappresenta il provider dal quale vogliamo ottenere una autenticazione &#8220;basic&#8221;. Nel nostro caso è, appunto, ldap.<br />
<strong>AuthzLDAPAuthoritative</strong>: è un sistema di fallback. Se è settato su &#8220;off&#8221; il sistema prova in cascata altri sistemi di autenticazione se fallisce quello su ldap. Nel nostro caso, non essendoci altri sistemi di autenticazione, lo abbiamo settato su &#8220;on&#8221;.<br />
<strong>AuthLDAPURL</strong>: è la stringa di connessione. Non basta passargli solo l&#8217;indirizzo del server, ma è necessario dargli anche (dopo lo /) la path dell&#8217;alberatura ldap dalla quale volete che Apache permetta l&#8217;autenticazione. Nel nostro caso siamo stati molto generici: tutte le utenze sotto la radice vengono prese in considerazione. Dopo il punto interrogativo è necessario aggiungere quale è l&#8217;attributo ldap per il quale fare la ricerca. Nel nostro caso è &#8220;uid&#8221;, cioè lo userid dell&#8217;utente.<br />
<strong>AuthLDAPBinDN</strong>: non è un parametro obbligatorio. Dipende da come è stato configurato il vostro ldap. Se il vostro Ldap non è accessibile in sola lettura da utente &#8220;anonymous&#8221; è necessario specificare quale è l&#8217;utente che ha accesso al server ldap. Se vi trovate in quest&#8217;ultimo caso è necessario specificare anche la password (<strong>AuthLDAPBindPassword</strong>).</p>
<p>In ultimo diciamo al nostro apache che è obbligatorio un utente valido (<strong>require valid-user</strong>) per permettere l&#8217;accesso.</p>
<p>Questa configurazione è il primo livello di complessità: manca un file che gestisce la profilazione sugli accessi (in questo modo, infatti, tutti gli utenti di ldap possono loggarsi con successo), manca un sistema di fallback, eccetera. Però spesso è la cosa più utile che ci serve <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;title=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;title=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;title=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;T=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;title=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Semplice+Autenticazione+HTTP+via+Ldap+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F10%2F22%2Fsemplice-autenticazione-http-via-ldap%2F&amp;t=Semplice+Autenticazione+HTTP+via+Ldap" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2009/10/22/semplice-autenticazione-http-via-ldap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installare Glassfish su Ubuntu Server 8.10</title>
		<link>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/</link>
		<comments>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 10:25:28 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=54</guid>
		<description><![CDATA[Tanto peregrinare e torno qua, su queste pagine, dopo 7 mesi che sembrano anni per le cose che cambiano e sono cambiate. Oggi parliamo di come installare Glassfish su Ubuntu. Glassfish è l&#8217;Application Server OpenSource di Sun (da poco acquisita Oracle&#8230;con tutto quello che si potrebbe dire al riguardo e che non dirò), un prodotto [...]]]></description>
			<content:encoded><![CDATA[<p>Tanto peregrinare e torno qua, su queste pagine, dopo 7 mesi che sembrano anni per le cose che cambiano e sono cambiate. Oggi parliamo di come installare <a href="https://glassfish.dev.java.net/" target="_blank"><strong>Glassfish</strong></a> su Ubuntu.</p>
<p><strong>Glassfish </strong>è l&#8217;Application Server OpenSource di Sun (da poco acquisita Oracle&#8230;con tutto quello che si potrebbe dire al riguardo e che non dirò), un prodotto che esiste ormai da più di due anni e ha raggiunto un discreto grado di maturazione, pur mancando ancora di quella &#8220;integrazione&#8221;, di quell&#8217;essere &#8220;suite&#8221; che ormai (sotto il controllo-spinta di RedHat) JBoss riesce maggiormente ad assicurare. Non è certamente questa la sede per avere maggiori indicazioni tecniche al riguardo, per questo potete chiedere a Google.</p>
<p>Noi cerchiamo solo di capire come effettuare una installazione del prodotto su un sistema operativo Ubuntu (per il test è stata utilizzata la versione server 8.10) pulita e con un sistema di start/stop automatico al boot.</p>
<p><span id="more-54"></span></p>
<h4>Java</h4>
<p>Prima di tutto sarà necessario installare la JDK Sun sulla nostra macchina. Per farlo, su un sistema debian-based come Ubuntu, è possibile aggiungere o semplicemente abilitare (solitamente già sono presenti, vanno solo decommentate) queste sorgenti al file sources.list che gestisce l&#8217;apt.</p>
<div class="codecolorer-container apt_sources blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="apt_sources codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">deb</span> <span style="color: #009900;">http://us.archive.ubuntu.com/ubuntu/</span> <span style="color: #b1b100;">intrepid</span> <span style="color: #b16000;">universe</span> <span style="color: #b16000;">multiverse</span><br />
<span style="color: #00007f;">deb-src</span> <span style="color: #009900;">http://us.archive.ubuntu.com/ubuntu/</span> <span style="color: #b1b100;">intrepid</span> <span style="color: #b16000;">universe</span> <span style="color: #b16000;">multiverse</span></div></div>
<p>La nostra scelta cade sul pacchetto <strong>sun-java6-jdk</strong> contenente la versione 1.6.x del prodotto. A secondo del livello di upgrade di Intrepid, cambierà la minor release della JDK. Al momento in cui scrivo, l&#8217;ultima disponibile è la 1.6.0_10.</p>
<p>Tornando a noi: una volta abilitati i repositories, con un colpetto di apt (magie di debian), scarichiamo, installiamo e abilitiamo la JDK. Ovviamente da utente root.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># apt-get install sun-java6-jdk</span></div></div>
<p>Accettiamo tutte le dipendenze e lasciamo fare lo sporco lavoro al nostro sistema operativo. Alla fine basterà dare un colpetto di <strong>java -version</strong> da command line per avere qualcosa tipo:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">java version <span style="color: #ff0000;">&quot;1.6.0_10&quot;</span><br />
Java<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> SE Runtime Environment <span style="color: #7a0874; font-weight: bold;">&#40;</span>build 1.6.0_10-b33<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Java HotSpot<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> Client VM <span style="color: #7a0874; font-weight: bold;">&#40;</span>build <span style="color: #000000;">11.0</span>-b15, mixed mode, sharing<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>Frasi che ci informano che tutto è andato a buon fine.</p>
<h4>GlassFish</h4>
<p>Ok, ora concentriamoci sull&#8217;installazione dell&#8217;AS vero e proprio. Scarichiamone il jar dell&#8217;ultima versione stable dal <a href="https://glassfish.dev.java.net/">sito ufficiale</a>.  Al momento è la 2.1 b60e. Diciamo che un wget dovrebbe fare sufficientemente al caso nostro:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># wget http://java.net/download/javaee5/v2.1_branch/promoted/Linux/glassfish-installer-v2.1-b60e-linux.jar</span></div></div>
<p>e ora scompattiamola in questo modo</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># java -jar -mx256M glassfish-installer-v2.1-b60e-linux.jar</span></div></div>
<p>Una volta accettata la licenza e scompattati i files, nella directory dove stiamo lavorando avremo una dir chiamata glassfish contenente tutti i files che ci occorrono per continuare.</p>
<p>E&#8217; importante, a questo punto, individuare una directory dove far lavorare glassfish. Io tendenzialmente sono uso non utilizzare /opt per installare software di terze parti, ma preferisco sempre ragionare utilizzando l&#8217;associazione mentale &#8220;1 software &gt;&gt; 1 utente/gruppo &gt;&gt; 1 home directory&#8221;.<br />
Volendo utilizzare questa strada procediamo con la creazione del gruppo e dell&#8217;utenza, copiamo la dir di glassfish all&#8217;interno della home directory del nuovo utente e cominciamo a lavorare direttamente da lì, dimenticandoci (il più possibile) l&#8217;utenza di root.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># groupadd glassfish</span><br />
<span style="color: #666666; font-style: italic;"># useradd -g glassfish -d /home/glassfish -m -s /bin/bash glassfish</span><br />
<span style="color: #666666; font-style: italic;"># mv glassfish /home/glassfish</span><br />
<span style="color: #666666; font-style: italic;"># chown -R glassfish:glassfish /home/glassfish/glassfish</span><br />
<span style="color: #666666; font-style: italic;"># su - glassfish</span></div></div>
<p>Credo sia praticamente inutile (e quindi utilissimo&#8230;) che io aggiunga che questa fase può essere tranquillamente saltata, tralasciando quella che è solo una mia abitudine. Ognuno ha i suoi standard. Ciò che, però è più importante, è evitare che l&#8217;application server &#8220;salga&#8221; da utente root. Ecco questo io lo eviterei come la peste.</p>
<p>A questo punto (con l&#8217;ultimo comando dato nel precedente blocco di codice) siamo utente &#8220;glassfish&#8221; e come tale operiamo all&#8217;interno della nostra home directory come preferiamo. Sfruttiamo <a href="http://ant.apache.org/">ant</a> contenuto in bundle a glassfish per lanciare il setup, ma prima di farlo ricordiamoci di dare all&#8217;eseguibile di ant i permessi di eseguibilità di cui è sprovvisto in default.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> glassfish<br />
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ant<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ant<br />
$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ant<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ant <span style="color: #660033;">-f</span> setup.xml</div></div>
<p>Il build durerà qualche secondo, e alla fine si completerà con successo (se così non fosse ricontrollate i passi precedenti perchè c&#8217;è qualcosa che non va&#8230;).</p>
<p>Ora facciamo una finezza con un po&#8217; di forza bruta: per permetterci di aggiornare l&#8217;AS <strong>senza</strong> toccare ciò che deployeremo all&#8217;interno del <strong>default domain</strong> di glassfish, mi esternalizzo la directory relativa e con un symlink la lego comunque all&#8217;AS.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>doman1 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<br />
$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domain1 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>doman1</div></div>
<p>In questo modo ogni qualvolta voglio procedere ad un upgrade, non vado a toccare il contenuto del domain1 e con un nuovo symlink post-upgrade non perdo l&#8217;applicazione.</p>
<p>Ok ora possiamo startare l&#8217;AS:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>asadmin start-domain</div></div>
<p>Al termine dell&#8217;esecuzione aprite il browser e digitate http://indirizzo_server:8080. Vedrete la pagina di default di glassfish.</p>
<p style="text-align: center;"><a href="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-8.png" rel="lightbox"><img class="aligncenter size-medium wp-image-115" title="GlassFish on 8080 port" src="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-8-300x200.png" alt="GlassFish on 8080 port" width="300" height="200" /></a></p>
<p>Il prossimo passo è modificare la password di amministrazione per accedere al pannello di controllo il porta 4848; ricordiamoci che la password deve avere perlomeno 8 caratteri di lunghezza. Anche in questa occasione usiamo il potentissimo binario asadmin.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>asadmin change-admin-password <span style="color: #660033;">--user</span> admin<br />
Please enter the old admin password<span style="color: #000000; font-weight: bold;">&amp;</span>gt; adminadmin<br />
Please enter the new admin password<span style="color: #000000; font-weight: bold;">&amp;</span>gt; newpassword<br />
Please enter the new admin password again<span style="color: #000000; font-weight: bold;">&amp;</span>gt; newpassword<br />
Updated .asadminpass <span style="color: #c20cb9; font-weight: bold;">file</span> with new password.<br />
Command change-admin-password executed successfully.</div></div>
<p>Considerate che nel &#8220;code&#8221; qui sopra ho scritto in chiaro le password (sia quella vecchia che quella nuova): nella realtà esse sono nascoste, come se cambiaste password ad un qualsiasi utente unix.</p>
<p>Ok, anche questa è fatta: andiamo su http://indirizzo_server:4848 e proviamo a loggarci con le nuove credenziali admin/newpassword. Avremo così accesso al pannello di controllo di glassfish.</p>
<p style="text-align: center;"><a href="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-10.png" rel="lightbox"><img class="aligncenter size-medium wp-image-116" title="GlassFish Administration (port 4848)" src="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-10-300x259.png" alt="GlassFish Administration (port 4848)" width="300" height="259" /></a></p>
<p>Fatto ciò il nostro esperimento potrebbe definirsi concluso. Ma c&#8217;è una cosa che ancora possiamo fare per completare meglio la nostra installazione: creare un init-script per fare in modo che l&#8217;AS parta al boot.</p>
<h4>Init Script</h4>
<p>L&#8217;init script che segue è relativo all&#8217;installazione che io ho fatto nella guida. Ovviamente è ampiamente suscettibile di customizzazione e soprattutto miglioramenti. Ma funziona e non è poco <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Ringrazio Cay Horstmann (http://weblogs.java.net/blog/cayhorstmann/archive/2006/07/installing_glas.html) per il template dello script e per la guida ufficiale in lingua inglese alla quale mi sono &#8220;liberamente ispirato&#8221; per scrivere la mia.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#! /bin/bash</span><br />
<span style="color: #666666; font-style: italic;">### BEGIN INIT INFO</span><br />
<span style="color: #666666; font-style: italic;"># Provides: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;glassfish</span><br />
<span style="color: #666666; font-style: italic;"># Required-Start: &nbsp; &nbsp;$local_fs $remote_fs</span><br />
<span style="color: #666666; font-style: italic;"># Required-Stop: &nbsp; &nbsp; $local_fs $remote_fs</span><br />
<span style="color: #666666; font-style: italic;"># Default-Start: &nbsp; &nbsp; 2 3 4 5</span><br />
<span style="color: #666666; font-style: italic;"># Default-Stop: &nbsp; &nbsp; &nbsp;S 0 1 6</span><br />
<span style="color: #666666; font-style: italic;"># Short-Description: glassfish initscript</span><br />
<span style="color: #666666; font-style: italic;"># Description: &nbsp; &nbsp; &nbsp; A simple initscript for the glassfish app server</span><br />
<span style="color: #666666; font-style: italic;">### END INIT INFO</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># Author: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cay S. Horstmann (http://horstmann.com)</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<br />
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span><br />
<br />
<span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>bin<br />
<span style="color: #007800;">DESC</span>=<span style="color: #ff0000;">&quot;Java EE5 App Server&quot;</span><br />
<span style="color: #007800;">NAME</span>=glassfish<br />
<span style="color: #007800;">ASADMIN</span>=asadmin<br />
<span style="color: #007800;">PIDFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$NAME</span>.pid<br />
<span style="color: #007800;">SCRIPTNAME</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$NAME</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Gracefully exit if the package has been removed.</span><br />
<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">$DAEMON</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Read config file if it is present.</span><br />
<span style="color: #666666; font-style: italic;">#if [ -r /etc/default/$NAME ]</span><br />
<span style="color: #666666; font-style: italic;">#then</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; . /etc/default/$NAME</span><br />
<span style="color: #666666; font-style: italic;">#fi</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Function that starts the daemon/service.</span><br />
d_start<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
<span style="color: #007800;">$ASADMIN</span> start-domain \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; already running&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Function that stops the daemon/service.</span><br />
d_stop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
<span style="color: #007800;">$ASADMIN</span> stop-domain \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; not running&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
start<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Starting <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_start<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Stopping <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_stop<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
reload<span style="color: #000000; font-weight: bold;">|</span>restart<span style="color: #000000; font-weight: bold;">|</span>force-reload<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Restarting <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_stop<br />
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">10</span><br />
d_start<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #007800;">$SCRIPTNAME</span> {start|stop|restart|force-reload}&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></div>
<p>Per aggiungere il nuovo init script all&#8217;interno dei runlevel di ubuntu è sufficiente scrivere da root</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">update-rc.d glassfish defaults</div></div>
<p>Ora è davvero tutto. Enjoy with glassfish!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;T=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Installare+Glassfish+su+Ubuntu+Server+8.10+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;t=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
