<?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>Vita di un sys-admin &#187; linux</title>
	<atom:link href="http://blog.angelofailla.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.angelofailla.com</link>
	<description>Storie, esperienze e pensieri da Dublino.</description>
	<lastBuildDate>Sun, 14 Aug 2011 22:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Lavorando ad un nuovo embedded&#8230;</title>
		<link>http://blog.angelofailla.com/2007/12/05/lavorando-ad-un-nuovo-embedded/</link>
		<comments>http://blog.angelofailla.com/2007/12/05/lavorando-ad-un-nuovo-embedded/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 08:31:26 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[labview]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[splashy]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/2007/12/05/lavorando-ad-un-nuovo-embedded/</guid>
		<description><![CDATA[Esattamente lo stesso mese di qualche anno fa, 2005, (vedere il post a riguardo su questo blog), realizzai un sistema embedded basato su Linux per un cliente. La richiesta del committente era la realizzazione di un sistema che fosse collegato ad un PLC, a sua volta collegato a macchine di taglio lamiera, per la ricezione [...]]]></description>
			<content:encoded><![CDATA[<p>Esattamente lo stesso mese di qualche anno fa, 2005, (<a href="/2005/11/10/pubblicato-il-gentoo-embedded-developer-howto/">vedere il post a riguardo su questo blog</a>), realizzai un sistema embedded basato su Linux per un cliente.</p>
<p>La richiesta del committente era la realizzazione di un sistema che fosse collegato ad un PLC, a sua volta collegato a macchine di taglio lamiera, per la ricezione di dati e allarmi dalla macchina di taglio, e la successiva scrittura di questi dati su un RDBMS centralizzato.</p>
<p>Il sistema embedded era munito di LCD con risoluzione 640&#215;480 e touchscreen per l&#8217;interazione.</p>
<p>All&#8217;avvio il sistema doveva aprire un browser (javascript capable) che doveva puntare ad una webapplication scritta da un&#8217;altra azienda, che serviva per pilotare le macchine.</p>
<p>Realizzai qualcosa in un mesetto:</p>
<ul>
<li>l&#8217;embedded in se&#8217;: kernel + file system layout minimale + busybox + dropbear (ssh) + xorg + opera 9 (versione minimal): circa 100mb facendo un lavoro certosino di taglio di file inutili. Il dom dell&#8217;embedded era di 128MB</li>
<li>un daemon scritto in C che leggeva la seriale, parsava i dati (mi sono divertito con gli operatori bit a bit, grazie al K&amp;R, per estrapolare gli allarmi dai char letti sulla seriale), ed utilizzava unixODBC per scriverli sul server MS SQL Server (?!?!**##%%$) della applicazione web fatta dall&#8217;altra azienda</li>
</ul>
<p>Ne&#8217; risulto&#8217; un bel lavoro.<br />
Dall&#8217;inizio avevo cercato di evitare Xorg e di usare qualcosa tipo links2 in modalita&#8217; framebuffer, ma l&#8217;applicativo web di terze parti faceva uso massivo di Javascript&#8230;<br />
Poi provai con Dillo, ma anche li il supporto Javascript era penoso.<br />
Poi provai con Firefox, funzionava ma chiedeva troppo tempo al boot&#8230;<br />
Poi sono approdato a Opera9! Opera e&#8217; davvero un bel browser, molto personalizzabile, forse piu&#8217; facilmente di Firefox perche&#8217; basta editare il file opera.ini.<br />
Date un occhio a <a href="http://del.icio.us/pallotron/opera">http://del.icio.us/pallotron/opera</a>.</p>
<p>Opera9 aveva gia&#8217; una funzionalita&#8217; di kiosk mode interna, senza bisogno di installare addon come nel caso di Firefox.</p>
<p>Questo lavoro produsse la pubblicazione di un <a href="http://www.pallotron.net/docs/howtos/gentoo_embedded/it/html_it/">howto da me scritto</a> che illustrava come usare il portage di Gentoo Linux per realizzare sistemi embedded. E&#8217; ancora un valido documento. Ho visto che molta gente approda ad esso cercando con Google. Ne realizzai anche una versione English.In questi giorni mi sono trovato nella situazione di dover realizzare un altro embedded. Nel frattempo la mia considerazione di <a href="http://www.gentoo.org">Gentoo</a> e&#8217; andata scemando. Per una serie motivi che se volete possiamo discutere.BTW mi sono messo all&#8217;opera per vedere che strumenti offre <a href="http://www.debian.org">Debian</a> per realizzare lo stesso lavoro.Premetto che sia l&#8217;embedded precedente che quello odierno sono basati su cpu x86 compatibili. No ARM.</p>
<p>Quindi per realizzare un sistema usabile e funzionante non si deve fare cross-compiling delle applicazione per la CPU target.</p>
<p>Debian mi ha permesso di essere molto piu&#8217; spedito nella creazione di questo nuovo embedded. Ho utilizzato debootstrap, dando comandi simili a questi:</p>
<p><code>main # mkdir -p /opt/lenny-root<br />
main # debootstrap lenny /opt/lenny-root http://ftp.debian.org/debian/<br />
[ ... attendere prego ... ]</code></p>
<p>Alla fine del processo otterrette un sistema debian standard minimal (in questo caso la relase lenny) nella directory prescelta.</p>
<p>A questo punto mountare /proc, copiare /etc/hosts e chrottarsi:</p>
<p><code>main # mount proc /opt/lenny-root/proc -t proc<br />
main # cp /etc/hosts /opt/lenny-root/etc/hosts<br />
main # chroot /opt/lenny-root /bin/bash</code></p>
<p>A partire da questo punto ho installato il software necessario al cliente usando apt.<br />
Ho installato Firefox, Xorg, dropbear, Splashy, ed un RPM della National Instruments fornitomi dal cliente che installa un envoirnment chiamato <a href="http://www.ni.com/labview/">Labview</a> che include anche un plugin di Firefox.</p>
<p>E&#8217; un ambiente molto utilizzato da 20 anni in automazione industriale:</p>
<blockquote><p>For more than 20 years, NI LabVIEW graphical development has revolutionized the development of scalable test, measurement, and control applications. Regardless of experience, engineers and scientists can rapidly and cost-effectively interface with measurement and control hardware, analyze data, share results, and distribute systems.</p></blockquote>
<p>Il cliente ha gia&#8217; scritto applicazione LabVIEW, il terminale embedded deve puntare all&#8217;applicazione di monitoring della infrastruttura automatizzata.</p>
<p>Il cliente voleva anche che il processo di boot non mostrasse tutte le scritte tipiche del boot dei kernel UNIX. Ma qualcosa di grafico con una barra di scorrimento, qualcosa alla Ubuntu/Windows.</p>
<p>L&#8217;ho realizzata con <a href="http://splashy.alioth.debian.org/wiki/">Splashy.</a><br />
E&#8217; stato sufficiente installarlo, leggere la documentazione, realizzare delle bmp con pochi colori come questa, con le immagini da usare, configurare qualche file di xml per definire colori della barra ed i comportamenti.</p>
<p>Mentre che c&#8217;ero ho anche utilizzato lilo in modalita&#8217; grafica con immagine bmp e menu&#8217; di scelta dove l&#8217;utente al boot puo&#8217; scegliere se partire con lo splash, senza splash (per vedere i messaggi del kernel), oppure in una modalita&#8217; &#8220;configurazione&#8221;.</p>
<p>La modalita&#8217; &#8220;configurazione&#8221; viene usata per configurare l&#8217;apparecchio.<br />
In pratica a dopo il boot, e dopo aver effettuato il login uno script in .bashrc legge la command line del kernel leggendo /proc/cmdline ed eventualmente esegue uno script bash che fa domande sulla configurazione e poi scrive i file che deve scrivere&#8230;</p>
<p>Il filesystem dell&#8217;embedded e&#8217; cosi&#8217; organizzato:</p>
<ul>
<li>/ in read only</li>
<li>/usr compressa con squashfs</li>
<li>una partizione /rw di pochi mega in read write</li>
</ul>
<p>In totale tutto sta in 164MB. OK non proprio dimensioni embedded, ma in realta&#8217; questo non e&#8217; proprio un embedded nel vero termine della parola&#8230; e&#8217; piu&#8217; un dispositivo da affiancare ad una macchina di taglio, e poi dovendo anche avere Xorg&#8230; Considerato che il dom che ho a disposizione e&#8217; di 256MB direi che vado tranquillo, ma sono convinto che con un po&#8217; di lavoro certosino fatto di strace, ldd, e altri tool posso minimizzare di molto!<br />
Ed ora pappatevi un video che ho girato l&#8217;altra notte mentre ci lavoravo, in questo video il sistema impiega ben 4&#8217;30&#8243; dall&#8217;accensione elettrica al caricamento di una pagina di test con un plugin Labview. Ma nel momento in cui scrivo sono riuscito a ridurre il tempo di caricamento a soli 2&#8217;20&#8243;&#8230; purtroppo l&#8217;embedded che ho e&#8217; solo 166mhz&#8230; 129MB di ram&#8230; e si sa firefox non e&#8217; che sia leggerissimo&#8230; beh casomai il cliente optera&#8217; per ferragglia piu&#8217; prestante.</p>
<p><embed src="http://blog.angelofailla.com/flowplayer/FlowPlayer.swf?config=%7Bembedded%3Atrue%2CbaseURL%3A%27http%3A%2F%2Fwww%2Evitadiunsysadmin%2Enet%2Fflowplayer%27%2CinitialScale%3A%27fit%27%2CplayList%3A%5B%7BoverlayId%3A%27play%27%7D%2C%7Burl%3A%27http%3A%2F%2Fwww%2Evitadiunsysadmin%2Enet%2Fvideos%2Fembedded%2Eflv%27%7D%5D%7D" scale="noscale" bgcolor="111111" type="application/x-shockwave-flash" allowscriptaccess="always" allownetworking="all" pluginspage="http://www.macromedia.com/go/getflashplayer" height="350" width="468"></embed></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=606&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2007%2F12%2F05%2Flavorando-ad-un-nuovo-embedded%2F&amp;title=Lavorando%20ad%20un%20nuovo%20embedded%26%238230%3B" id="wpa2a_2"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2007/12/05/lavorando-ad-un-nuovo-embedded/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Complimenti Debian. Si salvi chi puo&#8217;!</title>
		<link>http://blog.angelofailla.com/2008/05/14/complimenti-debian-si-salvi-chi-puo/</link>
		<comments>http://blog.angelofailla.com/2008/05/14/complimenti-debian-si-salvi-chi-puo/#comments</comments>
		<pubDate>Wed, 14 May 2008 09:57:54 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Comunicazioni]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lamentazioni]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[merda]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=804&#038;langswitch_lang=en</guid>
		<description><![CDATA[MANNAGGIA A DEBIAN! &#8216;Sta volta hanno fatto una cazzata! Avete server Debian installati dal 2006 in poi? AGGIORNATE IMMEDIATAMENTE OPENSSL E RICREATE TUTTE LE VOSTRE CA, CERTIFICATI PEM, CHIAVI SSH DI CLIENT E SERVER. Leggete qui: http://www.debian.org/security/2008/dsa-1571 Ed anche qui: http://wiki.debian.org/SSLkeys (c&#8217;e&#8217; un tool che dovrebbe aiutarvi a capire quali server SSH sono vulnerabili e [...]]]></description>
			<content:encoded><![CDATA[<p>MANNAGGIA A <a href="http://www.debian.org">DEBIAN</a>! &#8216;Sta volta hanno fatto una cazzata!</p>
<p>Avete server Debian installati dal 2006 in poi? <strong>AGGIORNATE IMMEDIATAMENTE OPENSSL E RICREATE TUTTE LE VOSTRE CA, CERTIFICATI PEM, CHIAVI SSH DI CLIENT E SERVER.</strong></p>
<p>Leggete qui:</p>
<p><a href="http://www.debian.org/security/2008/dsa-1571">http://www.debian.org/security/2008/dsa-1571</a></p>
<p>Ed anche qui:</p>
<p><a href="http://wiki.debian.org/SSLkeys">http://wiki.debian.org/SSLkeys</a> (c&#8217;e&#8217; un tool che <strong>dovrebbe</strong> aiutarvi a capire quali server SSH sono vulnerabili e quali no&#8230; anche se non e&#8217; detto che non possa generare falsi positivi/negativi).</p>
<p style="padding-left: 30px;">&#8220;&#8221;Luciano Bello discovered that the random number generator in Debian&#8217;s openssl<br />
package is predictable. This is caused by an incorrect Debian-specific change<br />
to the openssl package (CVE-2008-0166). As a result, cryptographic key<br />
material may be guessable.&#8221;"</p>
<p style="padding-left: 30px;">&#8220;Well, it looks like it&#8217;s more toward the minutes or seconds range, because dowkd.pl contains a simple list of around 260,000 fingerprints for these vulnerable keys&#8230; that is, if you&#8217;re vulnerable, I can look your SSH server&#8217;s host key fingerprint up in a rather small database to find your private key.Yikes.&#8221;</p>
<p style="padding-left: 30px;">&#8220;It was a modification from the debian package maintainers that has cause the issue. In short they disabled the random portion of encryption process, also known as the iv, salt, seed. Which means basically means all the keys are predictable, because the randomness has been removed. This in turn creates weak keys, and a target for brute force and man in the middle attacks. The bug is limited to Debian systems, and its clones, since it was introduced by the Debian maintainers.&#8221;</p>
<p>Modificare il codice di un pacchetto critico come OpenSSL, frutto di lunghi studi matematici sulla crittografia e fare sta cazzata. Complimenti!!!!</p>
<p>Pare che la patch malsana risalga al 2 Maggio 2006. Ben 2 anni. Vi rendete conto di quanti server in tutto il mondo possono essere vulnerabili?!!!?!</p>
<p>Ci aspettano ore di davanti ai computer per aggiornare caterve di macchine. COMPLIMENTI!</p>
<p><strong>Update:</strong></p>
<p>Per sshd basta usare questi comandi:</p>
<pre># apt-get update
# apt-get install libssl-dev openssl
# rm /etc/ssh/ssh_host*
# dpkg-reconfigure openssh-server</pre>
<p>Ovviamente la fingerprint del vostro server ssh cambiera&#8217;.</p>
<p><strong>Update2:</strong></p>
<p>Ovviamente  se usate certificati SSH RSA per accedere ai server senza password (o anche con la password) dovete ricrearli con ssh-keygen ed aggiornare authorized_keys su ogni macchina a cui avete accesso. CHE PALLE!</p>
<p>Ovviamente tutti i consigli solo se il vostro server e&#8217; stato isntallato dopo il 2006 o la vostra chiave RSA e&#8217; stata creata dopo il 2006.</p>
<p><strong>Update 3</strong>:</p>
<p><a href="http://xkcd.com/424/"><img class="alignnone size-full wp-image-805" title="security_holes" src="http://blog.angelofailla.com/wp-content/uploads/2008/05/security_holes.png" alt="" width="493" height="527" /></a></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=804&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2008%2F05%2F14%2Fcomplimenti-debian-si-salvi-chi-puo%2F&amp;title=Complimenti%20Debian.%20Si%20salvi%20chi%20puo%26%238217%3B%21" id="wpa2a_4"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2008/05/14/complimenti-debian-si-salvi-chi-puo/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Monitoring SSL certificate expiration with Nagios</title>
		<link>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/</link>
		<comments>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 10:49:42 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[expiration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=873</guid>
		<description><![CDATA[Hi Lads, This is a post for nerds so I&#8217;m writing it in English. If you don&#8217;t understand English or technical stuff please close this page I&#8217;m at work and I&#8217;ve just finished to write a Nagios script to monitor expiration date of a SSL certificate. I wanna share it with you. To have the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Lads,</p>
<p>This is a post for nerds so I&#8217;m writing it in English. If you don&#8217;t understand English or technical stuff please close this page <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
I&#8217;m at work and I&#8217;ve just finished to write a Nagios script to monitor expiration date of a SSL certificate.</p>
<p>I wanna share it with you.</p>
<p>To have the script working properly you just need to install OpenSSL and let the <span>openssl</span><br />
command be in your PATH environment.</p>
<p>This is the usage:</p>
<pre>
Usage:
check_ssl_cert.sh hostname port [warningdays]
</pre>
<p>Warning days default value is 30 days.</p>
<p>Some examples:</p>
<pre>[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443
OK: Certificate is valid for 289 days expires on May  2 17:02:55 2009 GMT

[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443 400
CRITICAL: Certificate will expire in 289 days on May  2 17:02:55 2009 GMT</pre>
<p>Download the script <a href="http://blog.angelofailla.com/wp-content/uploads/2008/07/check_ssl_cert.sh">here</a> and enjoy it.</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=873&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2008%2F07%2F17%2Fmonitoring-ssl-certificate-expiration-with-nagios%2F&amp;title=Monitoring%20SSL%20certificate%20expiration%20with%20Nagios" id="wpa2a_6"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2008/07/17/monitoring-ssl-certificate-expiration-with-nagios/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Esempio pratico per limitare la banda in upload in Linux.</title>
		<link>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/</link>
		<comments>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 10:18:57 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[qos]]></category>
		<category><![CDATA[tc]]></category>
		<category><![CDATA[tcng]]></category>
		<category><![CDATA[traffic control]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1502</guid>
		<description><![CDATA[Ogni tanto in questo blog vanno messe un po&#8217; di robe tecniche altrimenti la mia geekness se ne va a farsi benedire e la gente smette di dirmi che sono nerd. Ultimamente ho messo su una scatoletta linux che funziona da media server per la XBOX (usando ushare) e da server samba/ssh/http. SSH e HTTP [...]]]></description>
			<content:encoded><![CDATA[<p>Ogni tanto in questo blog vanno messe un po&#8217; di robe tecniche altrimenti la mia geekness se ne va a farsi benedire e la gente smette di dirmi che sono nerd.</p>
<p>Ultimamente ho messo su una scatoletta linux che funziona da media server per la XBOX (usando ushare) e da server samba/ssh/http.</p>
<p>SSH e HTTP sono esposti su internet e li uso per trasferire files.</p>
<p>Alcuni amici hanno accesso solo che abusano della clemenza e scaricano file in maniera un po&#8217; troppo eccessiva <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cosicche&#8217; oggi ho messo mani a TC (traffic control) per configurare un tetto massimo di 20kbps in upload. <a href="http://linux.die.net/man/8/tc">TC e&#8217; una CLI</a> che permette di gestire il traffic shaping in Linux ma la sua sintassi e&#8217; troppo arcana&#8230; cosicche&#8217; un gruppo di giovini ha creato <a href="http://tcng.sourceforge.net/">tcng (TC new generation).</a></p>
<p>Cosicche&#8217; me ne sono uscito con queste poche righe di file di testo da eseguire a boot time:</p>
<pre>
root@linutop:/etc# cat /etc/rc.local
#!/bin/sh
tc qdisc del root dev eth0
tcng -q /etc/tcng > /tmp/tc
sh /tmp/tc
rm /tmp/tc

root@linutop:/etc# cat /etc/tcng
#define INTERFACE  eth0
#define IP 192.168.50.252

dev INTERFACE {
    egress { 

        class ( < $http> ) if ip_src == IP &#038;&#038; tcp_sport == PORT_HTTP ;
        class ( < $other> )  if 1 ;

        htb () {
            class ( rate 100Mbps, ceil 100Mbps) {
                $http  = class ( rate 100kbps, ceil 200kbps ) { sfq; } ;
                $other = class ( rate 128kbps, ceil 100Mbps) { sfq; } ;
            }
        }
    }
}
</pre>
<p>Enjoy, vi ho dato lo spunto per iniziare.<br />
Letture interessanti:</p>
<p>* <a href="http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html"> http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html</a></p>
<p>* <a href="http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html">http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html</a></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1502&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2009%2F07%2F12%2Fesempio-pratico-per-limitare-la-banda-in-upload-in-linux%2F&amp;title=Esempio%20pratico%20per%20limitare%20la%20banda%20in%20upload%20in%20Linux." id="wpa2a_8"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2009/07/12/esempio-pratico-per-limitare-la-banda-in-upload-in-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>O2sms &#8211; mandare sms dalla console</title>
		<link>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/</link>
		<comments>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 18:32:38 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[o2sms]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1641&#038;langswitch_lang=en</guid>
		<description><![CDATA[Tutti noi abbiamo mandato almeno una volta un SMS dal sito del nostro operatore telefonico irlandese. Ok, e&#8217; comodo, non si spendono soldi, ma ci si deve sorbire pubblicita&#8217;, e in piu&#8217; l&#8217;interfaccia non e&#8217; proprio immediata&#8230; girovagando per la rete ho trovato questo progetto chiamato 02sms. Mi sento il Salvatore Aranzulla degli Irlandiani. Ricordate? Questo [...]]]></description>
			<content:encoded><![CDATA[<p>Tutti noi abbiamo mandato almeno una volta un SMS dal sito del nostro operatore telefonico irlandese. Ok, e&#8217; comodo, non si spendono soldi, ma ci si deve sorbire pubblicita&#8217;, e in piu&#8217; l&#8217;interfaccia non e&#8217; proprio immediata&#8230; girovagando per la rete ho trovato questo progetto chiamato <a href="http://o2sms.sourceforge.net/">02sms</a>.</p>
<p>Mi sento il Salvatore Aranzulla degli Irlandiani. <a href="/?s=aranzulla">Ricordate?</a></p>
<p>Questo non e&#8217; altro che un progetto scritto in <a href="http://www.perl.org/">Perl</a> che usa <a href="http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm">WWW::Mechanize</a> per esporre una comoda interfaccia verso tutti gli operatori di telefonia irlandesi (O2, Vodafone, 3, meteor, etc). Oltre al modulo vero e proprio c&#8217;e&#8217; anche una comoda utility command line per mandare sms dalla vostra console. Se avete una distribuzione debian e derivati potete installare cosi&#8217;:</p>
<pre># echo "deb http://apt.mackers.com/ unstable contrib" >> /etc/apt/sources.list
# curl http://www.mackers.com/about/gnupg.key.asc | apt-key add -
# apt-get update
# apt-get install o2sms</pre>
<p>Dopodiche potete creare il file di configurazione nella vostra home:</p>
<pre>pallotron@saridda ~ $ cat ~/.o2sms/config
username 086123456
password SECRET
carrier o2
alias mamma +353861234567
alias papa +353861234568
alias amici +353861234569 +353861234563</pre>
<p>A quel punto potete usare il comando come se fosse il comando mail mandanto in pipe l&#8217;output di echo o cat o quello che volete voi:</p>
<pre>pallotron@saridda ~ $ echo ciao | o2sms mamma
[ recipient : io (+353861234567) ]
[ logging in to 086123456@o2.ie ... ]
[ login successful ]
[ message sent to +353861234567, 247 remaining this month ]</pre>
<p>Per gli amanti del mouse ci sono anche widget per gnome e kde. Varie funzioni sono disponibili per ulteriori info guardate il sito e la documentazione.</p>
<p>Spread the word.</p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1641&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F01%2F02%2Fo2sms-mandare-sms-dalla-console%2F&amp;title=O2sms%20%26%238211%3B%20mandare%20sms%20dalla%20console" id="wpa2a_10"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/01/02/o2sms-mandare-sms-dalla-console/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Streammare musica da casa ovunque siate via ssh tunnel</title>
		<link>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/</link>
		<comments>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 10:06:57 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[daap]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Musica]]></category>
		<category><![CDATA[ssh tunnel]]></category>
		<category><![CDATA[stream]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=1906</guid>
		<description><![CDATA[A lavoro ho da poco migrato tutte le mie robe su un portatile nuovo. Mi sono accorto che l&#8217;80% dello spazio sul portatile era occupato da mp3 e musica varia, cosi&#8217; ho deciso di non mettere mai piu&#8217; musica nel suo hard disk, spreco di spazio inutile visto che viviamo nel mondo della connettivita&#8217; ormai dappertutto. [...]]]></description>
			<content:encoded><![CDATA[<p>A lavoro ho da poco migrato tutte le mie robe su un portatile nuovo. Mi sono accorto che l&#8217;80% dello spazio sul portatile era occupato da mp3 e musica varia, cosi&#8217; ho deciso di non mettere mai piu&#8217; musica nel suo hard disk, spreco di spazio inutile visto che viviamo nel mondo della connettivita&#8217; ormai dappertutto.</p>
<p>Cosi&#8217; mi sono detto, ho un bel mac mini a casa col wake-on-lan funzionante, zeppo di musica, questa ridondanza non ha senso, usiamo l&#8217;internet per streammare la musica dal computer di casa mentre sono a lavoro!</p>
<p>Mi sono documentato un po&#8217; e ho visto che in Linux si puo&#8217; installare un tool chiamato mt-daapd (<a href="http://www.fireflymediaserver.org/">http://www.fireflymediaserver.org</a>), ora conosciuto come FireFly media server; questo tool implementa il protocollo DAAP (<a href="http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol">http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol</a>), Digital Audio Access Protocol: e&#8217; un protocollo proprietario usato da Apple nel suo iTunes per streammare audio/video in una rete locale. Questo vuol dire che i media player che parlano DAAP (iTunes ed Amarok per esempio) sono in grado di fare l&#8217;autodiscovery di host daap-enabled nella rete locale in cui vi trovate perche&#8217; DAAP funziona in broadcast.</p>
<p>Per mettere su tutto questo ambaradam in Debian/Ubuntu basta installare il too:</p>
<pre>$ sudo aptitude install mt-daapd libid3tag0 avahi-utils</pre>
<p>Avahi-utils vi servira&#8217; solo se volete ascoltare la musica fuori da casa, altrimenti mt-daapd e&#8217; gia&#8217; ok se il vostro intento e&#8217; streammare musica da un altro host della vostra rete casalinga e niente piu&#8217;.</p>
<p>A questo punto configurate il daemon editando /etc/mt-daapd.conf. Io ho solo cambiato questa linea:</p>
<pre>mp3_dir = /home/pallotron/Music/</pre>
<p>Per puntare alla directory della mia home dove sta tutta la musica. Ma voi date un occhio al file per capire cosa altro potete cambiare a seconda delle vostre esigenze.</p>
<p>Avviate il daemon e fate in modo che parta al boot:</p>
<pre>
<div id="_mcePaste">$ sudo  /etc/init.d/mt-daapd start
$ sudo update-rc.d mt-daapd defaults</div>
</pre>
<p>A questo punto il vostro server ascoltera&#8217; sulla porta 3689:</p>
<pre>root@pallomac:~# netstat -tunap | grep LISTEN | grep mt-daapd
tcp        0      0 0.0.0.0:3689            0.0.0.0:*               LISTEN      18584/mt-daapd</pre>
<p>Questo tool ha una interfaccia web che potete usare per vari scopi: creare playlist, definire nuove directory dove trovare la musica, configurare il tool (password, etc). Basta puntare il proprio browser su <a href="http://localhost:6689/">http://localhost:6689/</a> o cambiare localhost con l&#8217;ip/hostname del vostro computer casalingo.</p>
<p>Ok, una volta che questo e&#8217; fatto viene il bello, un requisito importante e&#8217; che voi siate in grado di accedere al vostro host casalingo usando ssh, il vostro router casalingo deve essere configurato per redirigere la porta SSH (tcp/22) all&#8217;ip del vostro computer casalingo. Io a casa assegno due IP fissi ai mac address delle due interfaccie del computer (ethernet e wifi) tramite il DHCP server del router.</p>
<p>A questo punto dal vostro computer in ufficio o dovunque voi siate usate un bel ssh tunnel:</p>
<pre>$ ssh vostrouser@ip_pubblico_di_casa -L :6689:localhost:3689</pre>
<p>O se preferite potete configurare ~/.ssh/config per aggiungere qualcosa tipo:</p>
<pre>Host IP_CASA
   Username VOSTROUSER
   LocalForward *:3689  localhost:3689</pre>
<p>A questo punto potete connettere il vostro player preferito a localhost:3689 et voila&#8217;, potete vedere tutta la musica sul vostro computer a casa e iniziare ad ascoltare <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ho verificato che banshee ancora non supporta DAAP, mentre rhythmbox supporat DAAP ma senza autodiscovery, cioe&#8217; inserendo a mano la URL del server&#8230; mentre amarok e iTunes supportano l&#8217;autodisvovery.</p>
<p>L&#8217;autodiscovery funzionera&#8217; automaticamente se vi trovate a casa ma se vi trovate fuori dovete utilizzare questo comando Avahi (<a href="http://en.wikipedia.org/wiki/Avahi_(software)">http://en.wikipedia.org/wiki/Avahi_(software)</a>):</p>
<pre>$ avahi-publish-address -v -s "my daap share" _daap._tcp. 6689 &amp;</pre>
<p>Avahi e&#8217; una cosa che devo ancora approfondire meglio, potete verificare che il vostro computer sta esportando correttamente lo share usando il comando:</p>
<pre>$ avahi-browse _daap._tcp</pre>
<p>Dovreste vedere il nome del vostro share apparire.</p>
<p><strong>Se intendete esportare la musica ai vostri colleghi vi avviso che probabilmente questo e&#8217; contro le regole aziendali. Quindi meglio non usare AVAHI <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </strong></p>
<p>Buon ascolto!</p>
<p><strong>Edit</strong></p>
<p>Ho trovato un po&#8217; di info a queste URL:</p>
<p><a href="http://wiki.fireflymediaserver.org/SSH_Tunnel">http://wiki.fireflymediaserver.org/SSH_Tunnel</a></p>
<p><a href="http://wiki.fireflymediaserver.org/RemoteAccess">http://wiki.fireflymediaserver.org/RemoteAccess</a></p>
<p>Pare sia meglio usare una porta diversa da 3689 nel comando ssh, perche&#8217; pare banshee provi a bindare la 3689, io ho scelto 6689&#8230; Di conseguenza cambiare anche il comando avahi per usare la porta 6689&#8230; e pare anche che dovete utilizzare l&#8217;IP del vostro laptop a lavoro e non localhost, cosi&#8217; i comandi diventano:</p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></p>
<pre>$ ssh vostrouser@ip_pubblico_di_casa -L *:6689:localhost:3689</pre>
<p>oppure nel vostro ~/.ssh/config:</p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></p>
<pre>Host IP_CASA
   Username VOSTROUSER
   LocalForward *:6689  localhost:3689</pre>
<p>E poi lanciare avahi cosi&#8217;:</p>
<pre>$ avahi-publish-address -v -s "my daap share" _daap._tcp. 6689 &amp;</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"><strong>Edit2</strong></span></pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">Potete aggiungere le opzioni -N e -f al comando ssh per evitare di mantenere una shell aperta tutto il tempo, ma poi vi dovete ricordare di killare il processo ssh connesso al vostro server casalingo:</span></pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">$ ssh vostrouser@ip_pubblico_di_casa -N -g -L *:6689:localhost:3689</pre>
<p></span></pre>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=1906&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F08%2F09%2Fstreammare-musica-da-casa-ovunque-siate-via-ssh-tunnel%2F&amp;title=Streammare%20musica%20da%20casa%20ovunque%20siate%20via%20ssh%20tunnel" id="wpa2a_12"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/08/09/streammare-musica-da-casa-ovunque-siate-via-ssh-tunnel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting up WordPress Multisite on Debian 5.0 (lenny)</title>
		<link>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/</link>
		<comments>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 18:09:35 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[English posts]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[multisite]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp3]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=2095</guid>
		<description><![CDATA[This post explains how to install WordPress 3.x on a Debian lenny and to set up a multisite installation on your Debian server. All the blogs will log into the same file /var/log/apache2/access.log; the first column will be the blog host and port (see the LogFormat configured below). This chapter is based on information collected [...]]]></description>
			<content:encoded><![CDATA[<p>This post explains how to install WordPress 3.x on a Debian lenny and to set up a multisite installation on your Debian server.</p>
<p>All the blogs will log into the same file <code>/var/log/apache2/access.log</code>; the first column will be the blog host and port (see the LogFormat configured below).</p>
<p>This chapter is based on information collected at http://codex.wordpress.org/Create_A_Network and in <code>/usr/share/doc/wordpress/README.Debian</code>.</p>
<p>All WordPress blogs will use the same shared PHP code in <code>/usr/share/wordpress</code>.</p>
<p><strong>Assumptions</strong></p>
<ul>
<li>Main website will be http://domain.com</li>
<li>Blogs will be under http://${blogname}.domain.com</li>
</ul>
<p>File uploaded into the main blog (www.domain.com) will be stored in <code>/srv/www/wp-uploads/domain.com/%year/%month/</code></p>
<p>Files uploaded into the <code>*.domain.com</code> blogs will be stored in <code>/usr/share/wordpress/wp-content/blogs.dir/${blog_id}/files/%year/%month/</code>, where <code>${blog_id}</code> is the numeric id of the blog, as managed by the Multisite feature.</p>
<p><strong>Configuration of Debian lenny-backports repository and installation</strong></p>
<p>WordPress 3.x is not in lenny so we have to use the backport repository.<br />
Excute this as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;deb http://backports.debian.org/debian-backports lenny-backports main&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&lt;&lt;</span>EOF <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>preferences
Package: <span style="color: #000000; font-weight: bold;">*</span>
Pin: release <span style="color: #007800;">a</span>=lenny-backports
Pin-Priority: <span style="color: #000000;">200</span>
EOF
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-t</span> lenny-backports <span style="color: #c20cb9; font-weight: bold;">install</span> wordpress</pre></div></div>

<p><strong>Installation of non free swf plugin</strong></p>
<p>As stated in <code>/usr/share/doc/wordpress/README.Debian</code> WordPress originally comes with a Flash-based tool that allows to upload files. However, that tool violates the Debian Policy, as stated in the<br />
bug #591195. That is why this tool is not shipped with the Debian package anymore. If you want to enable this feature, you need to install the Flash file yourself with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-includes<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>swfupload<span style="color: #000000; font-weight: bold;">/</span>swfupload.swf http:<span style="color: #000000; font-weight: bold;">//</span>core.svn.wordpress.org<span style="color: #000000; font-weight: bold;">/</span>branches<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3.0</span><span style="color: #000000; font-weight: bold;">/</span>wp-includes<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>swfupload<span style="color: #000000; font-weight: bold;">/</span>swfupload.swf</pre></div></div>

<p><strong>Configure your DNS server</strong></p>
<p>Add the following records in your zone (I suppose you know how to deal with your DNS zone):</p>

<div class="wp_syntax"><div class="code"><pre class="bind" style="font-family:monospace;">; wp multisite
$ORIGIN        IN A       ${IP}
www            IN A       ${IP}
*.domain.com.  IN CNAME   www</pre></div></div>

<p><strong>Apache configuration</strong></p>
<p>Configure the <code>vhost_combined</code> log format in <code>/etc/apache2/apache2.conf</code> modifying the default one:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">LogFormat</span> <span style="color: #7f007f;">&quot;%{Host}i:%p %h %l %u %t <span style="color: #000099; font-weight: bold;">\&quot;</span>%r<span style="color: #000099; font-weight: bold;">\&quot;</span> %&gt;s %O <span style="color: #000099; font-weight: bold;">\&quot;</span>%{Referer}i<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%{User-Agent}i<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> vhost_combined</pre></div></div>

<p>Configure apache in <code>/etc/apache2/sites-available/wordpress-multisite</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
<span style="color: #00007f;">UseCanonicalName</span>    <span style="color: #0000ff;">Off</span>
&nbsp;
<span style="color: #00007f;">ServerAlias</span> *.domain.com domain.com
<span style="color: #00007f;">ServerName</span> www.domain.com
<span style="color: #00007f;">DocumentRoot</span> /srv/www/domain.com/
&nbsp;
<span style="color: #00007f;">Options</span> <span style="color: #0000ff;">All</span>
<span style="color: #00007f;">ServerAdmin</span> you@domain.com
&nbsp;
<span style="color: #adadad; font-style: italic;"># Store uploads of www.domain.com in /srv/www/wp-uploads/$0</span>
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteRule</span> ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Directory</span> /&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
&lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;
&nbsp;
<span style="color: #00007f;">CustomLog</span> /var/log/apache2/access.log vhost_combined
&nbsp;
<span style="color: #adadad; font-style: italic;"># this is needed when activating multisite, WP needs to to a </span>
<span style="color: #adadad; font-style: italic;"># fopen(&quot;http://randomname.domain.com&quot;) to verify</span>
<span style="color: #adadad; font-style: italic;"># that apache is correctly configured</span>
<span style="color: #00007f;">php_admin_flag</span> allow_url_fopen <span style="color: #0000ff;">on</span>
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p>Configure <code>/etc/wordpress/htaccess</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">IfModule</span> mod_rewrite.c&gt;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteBase</span> /
<span style="color: #00007f;">RewriteRule</span> ^index\.php$ - [L]
<span style="color: #adadad; font-style: italic;">## uploaded files</span>
<span style="color: #00007f;">RewriteRule</span> ^files/(.+) wp-<span style="color: #0000ff;">includes</span>/ms-files.php?file=$1 [L]
<span style="color: #adadad; font-style: italic;">## real files dealt directly</span>
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -f [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -d
<span style="color: #00007f;">RewriteRule</span> ^ - [L]
<span style="color: #adadad; font-style: italic;">## other go through index.php</span>
<span style="color: #00007f;">RewriteRule</span> . index.php [L]
&lt;/<span style="color: #000000; font-weight:bold;">IfModule</span>&gt;</pre></div></div>

<p>Enable the config executing this as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2ensite wordpress-multisite
a2enmod rewrite <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> a2enmod vhost_alias
<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>apache2 restart</pre></div></div>

<p><strong>Setting some permissions</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># required to allow the main site to upload content</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># required to allow subdomains site to upload content</span>
<span style="color: #c20cb9; font-weight: bold;">chgrp</span> www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>blogs.dir<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> g+<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>blogs.dir<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># required in order to be able to install/update themes/plugins </span>
<span style="color: #666666; font-style: italic;"># from the webgui (only on the main site)</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>wp-admin<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><strong>Creating main site</strong></p>
<p>At this stage we can create the main site using this bash script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>wordpress<span style="color: #000000; font-weight: bold;">/</span>examples<span style="color: #000000; font-weight: bold;">/</span>setup-mysql <span style="color: #660033;">-n</span> main domain.com</pre></div></div>

<p>This script creates the DB &#038; tables and it also creates a file called <code>/etc/wordpress/config-domain.com.php</code>.</p>
<p>You should end up with the following files:</p>
<ul>
<li><code>/etc/wordpress/config-domain.com.php</code>
</li>
<li><code>/srv/www/domain.com</code> symlink to -> <code>/usr/share/wordpress</code>
</li>
<li><code>/srv/www/wp-uploads/domain.com/</code></li>
</ul>
<p><strong>Activating Network (aka multisite)</strong></p>
<p>At this stage you should log into http://domain.com and follow the on screen instructions.<br />
Once you are in the backend you can than click into the &#8220;Tools -> Network&#8221; link and enable the mulsite, this will create some tables in your db and it will ask you to copy&#038;paste some lines into <code>/etc/wordpress/config-domain.com.php</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SUBDOMAIN_INSTALL'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'DOMAIN_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'domain.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'PATH_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SITE_ID_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'BLOG_ID_CURRENT_SITE'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SECURE_AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'LOGGED_IN_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'NONCE_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'AUTH_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SECURE_AUTH_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'LOGGED_IN_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'NONCE_SALT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blabla'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'MULTISITE'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># for debugging purposes only
</span><span style="color: #666666; font-style: italic;"># define('WP_DEBUG', true);</span></pre></div></div>

<p>After that you&#8217;re ready to go <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Logging as super admin and going into the SuperAdmin webgui area you can create new subdomains (blogs), and users, when you can create blogs an email is sent to the owner, you can personalize templates, decide how much storage space you want to assign to every single blog, etc, etc.</p>
<p>At this point you should be able to also install/upgrade plugins and themes straight from the web gui.<br />
Note that <code>define('WP_CORE_UPDATE', false);</code> in your config file will disable the auto update, your wordpress update cycle will be managed using Debian apt tool.</p>
<p>That&#8217;s it folks, any question please comment <img src='http://blog.angelofailla.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=2095&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2010%2F12%2F29%2Fsetting-up-wordpress-multisite-on-debian-5-0-lenny%2F&amp;title=Setting%20up%20WordPress%20Multisite%20on%20Debian%205.0%20%28lenny%29" id="wpa2a_14"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2010/12/29/setting-up-wordpress-multisite-on-debian-5-0-lenny/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Highlight text on the fly thanks to terminfo and sed.</title>
		<link>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/</link>
		<comments>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 18:36:02 +0000</pubDate>
		<dc:creator>pallotron</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Lavoro]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[terminfo]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.angelofailla.com/?p=2337</guid>
		<description><![CDATA[A colleague today was looking for a way to pipe something to a command that highlights particular strings of text, keeping intact the stdin, similar to what you can see on some modern distros, ie Gentoo. Grep is not the way as it only prints the lines which contain the pattern that we are looking [...]]]></description>
			<content:encoded><![CDATA[<p>A colleague today was looking for a way to pipe something to a command that highlights particular strings of text, keeping intact the stdin, similar to what you can see on some modern distros, ie Gentoo.</p>
<p>Grep is not the way as it only prints the lines which contain the pattern that we are looking for.</p>
<p>While there are a bunch of tools that can do that, like supercat, etc. I felt no need to install additional packages for something you can do with few lines of bash and knowing terminal capabilities.</p>
<p>Therefore I wrote this small script, put it in the PATH env variable. The script uses sed and makes use of the terminfo database and of the terminal capabilities to color the text, here it is in case you find it useful:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">red</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tput bold;tput setaf <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">normal</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tput sgr0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$line</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/\($1\)/<span style="color: #007800;">$red</span>\1<span style="color: #007800;">$normal</span>/&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>If you don&#8217;t like red just read `man tput` and read <a href="http://wiki.bash-hackers.org/scripting/terminalcodes">this link</a> about terminal codes.</p>
<p>Example of usage:</p>
<p><a href="http://blog.angelofailla.com/wp-content/uploads/2011/06/highlight.jpg"><img src="http://blog.angelofailla.com/wp-content/uploads/2011/06/highlight.jpg" alt="" title="highlight" width="607" height="284" class="aligncenter size-full wp-image-2343" /></a></p>
<p>It also accept regexps (in sed syntax, not perl syntax), for example:</p>
<p><code><br />
$ sudo tail -f /var/log/system.log | highlight [Ss]potify<br />
</code></p>
<img src="http://blog.angelofailla.com/?ak_action=api_record_view&id=2337&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.angelofailla.com%2F2011%2F06%2F27%2Fhighlight-text-on-the-fly-thanks-to-terminfo-and-sed%2F&amp;title=Highlight%20text%20on%20the%20fly%20thanks%20to%20terminfo%20and%20sed." id="wpa2a_16"><img src="http://blog.angelofailla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.angelofailla.com/2011/06/27/highlight-text-on-the-fly-thanks-to-terminfo-and-sed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

