<?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>Gnuton's Blog &#187; myDocs</title>
	<atom:link href="http://www.gnuton.org/blog/category/mydocs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gnuton.org/blog</link>
	<description>A little blog of a little dreamer</description>
	<lastBuildDate>Tue, 08 Nov 2011 14:05:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Transparent QML applications</title>
		<link>http://www.gnuton.org/blog/2011/01/transparent-qml-application/</link>
		<comments>http://www.gnuton.org/blog/2011/01/transparent-qml-application/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 15:13:58 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myLinux]]></category>
		<category><![CDATA[myPhone]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[QML]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=485</guid>
		<description><![CDATA[Here is the code to make a QDeclarativeView based application transparent. #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QDeclarativeView view; view.setSource(QUrl::fromLocalFile(&#8220;myqmlfile.qml&#8221;)); view.setAttribute(Qt::WA_TranslucentBackground); view.viewport()-&#62;setAutoFillBackground(false); view.show(); return a.exec(); }]]></description>
			<content:encoded><![CDATA[<p>Here is the code to make a QDeclarativeView based application transparent.</p>
<p>#include<br />
#include </p>
<p>int main(int argc, char *argv[])<br />
{<br />
    QApplication a(argc, argv);</p>
<p>    QDeclarativeView view;<br />
    view.setSource(QUrl::fromLocalFile(&#8220;myqmlfile.qml&#8221;));<br />
    view.setAttribute(Qt::WA_TranslucentBackground);<br />
    view.viewport()-&gt;setAutoFillBackground(false);</p>
<p>    view.show();<br />
    return a.exec();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2011/01/transparent-qml-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing flash plugin on Ubuntu Maverick 10.10</title>
		<link>http://www.gnuton.org/blog/2010/10/installing-flash-plugin-on-ubuntu-maverick-10-10/</link>
		<comments>http://www.gnuton.org/blog/2010/10/installing-flash-plugin-on-ubuntu-maverick-10-10/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 09:16:48 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myLinux]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=472</guid>
		<description><![CDATA[Today I&#8217;ve updated my linux box to the latest stable KUbuntu release. Everything went smooth except that flash plugin seems missing. YouTube as well as Google streetmap claim Flash plugin 10.x is not available. Adobe website says that the plugin has been integrated into the browser.. The point is I&#8217;m not able to see any [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve updated my linux box to the latest stable KUbuntu release. Everything went smooth except that flash plugin seems missing. YouTube as well as Google streetmap claim Flash plugin 10.x is not available. Adobe website says that the plugin has been integrated into the browser..<br />
The point is I&#8217;m not able to see any flash content! So what the heck?<br />
Looks that Chromium doesn&#8217;t have flash plugin at all (Maybe Chrome has it!), and flasher-installer package didn&#8217;t work during the upgrade.<br />
Then to make it working, I did the following steps:<br />
1) Download the flash plugin from adobe website (Linux 64bit version in my case) http://labs.adobe.com/downloads/flashplayer10.html<br />
2) Uncompress the downloaded tarball: tar xvzf flashplayer_square_p2_64bit_linux_092710.tar.gz<br />
3) Move the shared object to the right dir: mv libflashplayer.so /usr/lib/chromium-browser/plugins/<br />
4) Restart your chromium</p>
<p>Maybe there are other ways like installing the flash plugin from some ubuntu unofficial repositories.. but I preferred this way.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2010/10/installing-flash-plugin-on-ubuntu-maverick-10-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cloning a git repository over the https://</title>
		<link>http://www.gnuton.org/blog/2010/09/cloning-a-git-repository-over-the-https/</link>
		<comments>http://www.gnuton.org/blog/2010/09/cloning-a-git-repository-over-the-https/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 07:49:58 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=470</guid>
		<description><![CDATA[To have push access on your repository, you can clone a git repository over SSH or HTTPS. Current git version, doesn&#8217;t ask for username then git clone https://mydomain.org/project.git will fail with this error: error: The requested URL returned error: 401 while accessing https://mydomain.org/project.git Error 401 means the client is not authorized to access to that [...]]]></description>
			<content:encoded><![CDATA[<p>To have push access on your repository, you can clone a git repository over SSH or HTTPS.<br />
Current git version, doesn&#8217;t ask for username then<br />
<em>git clone https://mydomain.org/project.git</em><br />
will fail with this error:<br />
error: The requested URL returned error: 401 while accessing https://mydomain.org/project.git<br />
<em> Error 401 means the client is not authorized to access to that resource.</em></p>
<p>The solution is to clone the repository putting the username in the URL:<br />
<em>git clone https://username@mydomain.org/project.git</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2010/09/cloning-a-git-repository-over-the-https/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a personal remote git repository</title>
		<link>http://www.gnuton.org/blog/2010/08/setting-up-a-personal-remote-git-repository/</link>
		<comments>http://www.gnuton.org/blog/2010/08/setting-up-a-personal-remote-git-repository/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 11:31:38 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myLinux]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=458</guid>
		<description><![CDATA[Even if Forum Nokia gives public git repositories for free, in some cases coders want to keep their work in a &#8220;more secret&#8221; place. So I set up a git remote repository on my home server. Here are the steps I followed to have it in place: On the server side: 1. apt-get install apache2 [...]]]></description>
			<content:encoded><![CDATA[<p>Even if Forum Nokia gives public git repositories for free, in some cases coders want to keep their work in a &#8220;more secret&#8221; place. So I set up a git remote repository on my home server.</p>
<p>Here are the steps I followed to have it in place:</p>
<p>On the server side:</p>
<p>1. apt-get install apache2 git-core gitweb</p>
<p>2. mkdir  /var/cache/git</p>
<p>Now we can create our first remote repository:</p>
<p>1. cd /var/cache/git/repository-name.git</p>
<p>2. git &#8211;bare init</p>
<p>3. chown﻿﻿ your _ssh_username ﻿/var/cache/git/repository-name.git -R</p>
<p>4. chgrp﻿﻿ your _ssh_username ﻿/var/cache/git/repository-name.git -R</p>
<p>So we have initialized an empty git repository  and we are now ready to use it!</p>
<p>On your local machine:</p>
<p>1. ﻿ git clone ssh://your_ssh_username@remote_server/var/cache/git/repository-name.git</p>
<p>2. cd repository-name</p>
<p>Let&#8217;s now try to do a simple basic operation, like adding a file to the repository</p>
<p>1. touch HELLO</p>
<p>2. git add HELLO</p>
<p>3. git commit -a -m &#8220;Add HELLO&#8221;</p>
<p>4. git push origin master</p>
<p>Moreover, since we installed gitweb, it shows our commits. Gitweb is available at  http://remote_server/gitweb</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2010/08/setting-up-a-personal-remote-git-repository/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to translate PDFs using Google Translator</title>
		<link>http://www.gnuton.org/blog/2010/05/how-to-translate-pdfs-using-google-translator/</link>
		<comments>http://www.gnuton.org/blog/2010/05/how-to-translate-pdfs-using-google-translator/#comments</comments>
		<pubDate>Fri, 28 May 2010 20:09:45 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=454</guid>
		<description><![CDATA[So far this is the best way I know to translate PDFs using google translator without losing images and text formatting. What you have to do is: 1) Upload the PDF to http://viewer.zoho.com/ 2) Get the URL of the uploaded document 3) paste the URL in http://translate.google.com Enjoy!]]></description>
			<content:encoded><![CDATA[<p>So far this is the best way I know to translate PDFs using google translator without losing images and text formatting.<br />
What you have to do is:<br />
1) Upload the PDF to http://viewer.zoho.com/<br />
2) Get the URL of the uploaded document<br />
3) paste the URL in http://translate.google.com<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2010/05/how-to-translate-pdfs-using-google-translator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Acquistare un account megavideo premium a 30% in meno dall Europa</title>
		<link>http://www.gnuton.org/blog/2009/11/acquistare-un-account-megavideo-premium-a-30-in-meno-dall-europa/</link>
		<comments>http://www.gnuton.org/blog/2009/11/acquistare-un-account-megavideo-premium-a-30-in-meno-dall-europa/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 09:53:08 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myFunStuff]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/2009/11/acquistare-un-account-megavideo-premium-a-30-in-meno-dall-europa/</guid>
		<description><![CDATA[Grazie a questo video apparso su youtube, son venuto a conoscenza di un trucchetto carino per salvare qualche euro durante l&#8217;acquisto di un account megavideo premium. In pratica tale &#8220;procedura&#8221; ti consente di acquistare un account megavideo/megaupload premium pagando in dollari l&#8217;importo che avresti pagato in euro. Per esempio invece di pagare 79,99 Euro un [...]]]></description>
			<content:encoded><![CDATA[<p>Grazie a <a href="http://www.youtube.com/watch?v=2ZiMnksBBKc">questo</a> video apparso su youtube, son venuto a conoscenza di un trucchetto carino per salvare qualche euro durante l&#8217;acquisto di un account megavideo premium.<br />
In pratica tale &#8220;procedura&#8221; ti consente di acquistare un account megavideo/megaupload premium pagando in dollari l&#8217;importo che avresti pagato in euro.<br />
Per esempio invece di pagare 79,99 Euro un account di 2 anni, lo paghi 79,99 dollari (=53 euro circa).</p>
<p>Sfortunatamente i proxy americani sono difficili da reperire. Ce ne sono di gratuiti, ma non permettono la connessione a Paypal o son lentissimi.</p>
<p>Io ho usato questo:  <strong>planetlab03.cs.washington.edu:3128</strong> e questa e&#8217; la procedura da seguire.<br />
1. mi registro a megavideo.com<br />
2. attivo il proxy americano<br />
3. essendo ancora loggato nel sito, vado sul tab &#8220;premium&#8221; e clicco sull icona di paypal per acuistare l opzione premium desiderata<br />
4. la connessione si interrompe e&#8217; viene mostrata un pagina di errore, questo accade  perche il proxy non mi permette l acquisto. (NO PROBLEM!)<br />
5. disattivo il proxy<br />
6. aggiorno la pagina che mostra l errore di connessione, cliccando su SI quando la finestra di dialogo chiede se si vuole<br />
inviare i dati nuovamente.<br />
7. Posso ora accedere a paypal. L importo da pagare viene mostrato nella schermata subito o dopo il login.</p>
<p>8. Pochi minuti dopo il pagamento una mail di notifica ci conferma l&#8217;attivazione del nostro account premium.</p>
<p>Sharing di un Account Megavideo tra utenti:</p>
<p>L account megavideo dovrebbe permettere la connessione contemporanea di max 5 utenti. L&#8217;account viene disattivato per 6 ore nel caso in cui + di 5 IP diversi sono connessi con lo stesso account premium.<br />
Dopo le 6 ore, la password dell account viene resettata ed inviata alla mail usata al momento della registrazione dell account.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=16171923-736c-87b4-8b7b-5f87054950ee" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2009/11/acquistare-un-account-megavideo-premium-a-30-in-meno-dall-europa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DD-WRT: Remove SSH login banner</title>
		<link>http://www.gnuton.org/blog/2009/11/dd-wrt-remove-ssh-login-banner/</link>
		<comments>http://www.gnuton.org/blog/2009/11/dd-wrt-remove-ssh-login-banner/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 22:15:49 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myLinux]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=413</guid>
		<description><![CDATA[Despite DD-WRT is a cool firmware there are some default things that looks very crap from a security point of view. One of these is the ssh login banner used by sshd. To remove it use Web interface &#62; Administration &#62; Commands &#62; paste echo "Unauthorized access is prohibited." &#62; /tmp/loginprompt killall dropbear dropbear -b [...]]]></description>
			<content:encoded><![CDATA[<p>Despite DD-WRT is a cool firmware there are some default things that looks very crap from a security point of view. One of these is the ssh login banner used by sshd.</p>
<p>To remove it use Web interface &gt; Administration &gt; Commands &gt; paste</p>
<pre><em>
<pre id="startup">echo "Unauthorized access is prohibited." &gt; /tmp/loginprompt
killall dropbear
dropbear -b /tmp/loginprompt -r /tmp/root/.ssh/ssh_host_rsa_key -d /tmp</pre>
<pre id="startup"></pre>
<p></em></pre>
<pre>and press "<em>Save Startup"</em> button<em>.
Power light will blink for 30 seconds. After that sshd will show new banner.

</em>gnuton@iron:~$ ssh root@192.168.1.1
Unauthorized access is prohibited.
root@192.168.1.1's password:</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2009/11/dd-wrt-remove-ssh-login-banner/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using Avahi</title>
		<link>http://www.gnuton.org/blog/2009/03/using-avahi/</link>
		<comments>http://www.gnuton.org/blog/2009/03/using-avahi/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 02:39:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[myDocs]]></category>
		<category><![CDATA[myLinux]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/?p=368</guid>
		<description><![CDATA[Few people know how much useful avahi could be. You can forget to run ifconfig on the target machines/devices to know the IP, you don&#8217;t need a static Ip anymore for those&#8230; You can give to any machine that runs an avahi-server the possibilty to have a DNS like machinename.local. Installing avahi is quite simple; [...]]]></description>
			<content:encoded><![CDATA[<p>Few people know how much useful avahi could be. You can forget to run ifconfig on the target machines/devices to know the IP, you don&#8217;t need a static Ip anymore for those&#8230;<br />
You can give to any machine that runs an avahi-server the possibilty to have a DNS like machinename.local.</p>
<p><strong>Installing avahi</strong> is quite simple; you just need to run apt-get install avahi-daemon.<br />
After that you can reach that machine over the net using its new domain name.<br />
You can discover them with:<br />
<em>gnuton@joshua:~$ avahi-browse -a<br />
+ vmnet8 IPv4 WOPR [00:50:56:c0:00:08]                      Workstation          local<br />
+ vmnet1 IPv4 WOPR [00:50:56:c0:00:01]                      Workstation          local<br />
+ eth1 IPv4 WOPR [00:1e:c2:be:4e:f6]                      Workstation          local<br />
+ eth1 IPv4 key [00:0d:60:5e:35:ab]                       Workstation          local</em></p>
<p>In my case I have some virtual nets belong to VMWare and one wireless net on eth1.<br />
These interfaces are using the same domain name: WOPR.local<br />
You can see also that there is another workstation in my net.<br />
Its domain name is key.local. That&#8217;s my home server&#8230;</p>
<p>What more? Avahi can also publish some services so that they are discoverable in the net.<br />
Use case:<br />
- I want to transfer files with Dolphin for KDE4 using ssh/scp. The target machine doesn&#8217;t have a static Ip on my net.<br />
  I can get the files that I need just opening Dolphin, clicking on the &#8220;Network&#8221; icon in the sidebar and then &#8220;Network services&#8221;.</p>
<p>To make discoverable the ssh service you have to:<br />
copy the config ssh service file in the avahi configuration directory with:<br />
<em>cp /usr/share/doc/avahi-daemon/examples/ssh.service  /etc/avahi/services/</em><br />
and then you have to restart the avahi service with<br />
/etc/init.d/avahi-daemon restart</p>
<p>Then you can check that everything goes okay with avahi-browse-domain utility:<br />
root@key:/etc/avahi# avahi-browse-domains -a<br />
+ eth0 IPv4 joshua [00:1e:c2:be:4e:f6]                    Workstation          local<br />
+ eth0 IPv4 key [00:0d:60:5e:35:ab]                       Workstation          local<br />
+ eth0 IPv4 key                                           SSH Remote Terminal  local</p>
<p>Here we are! The new service is in the last line! <img src='http://www.gnuton.org/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Avahi is also available for the Meemo devices. You can install it on your N810/N800 just<br />
running apt-get install avahi-daemon.<br />
Note: An old <a href="http://thpmaemo.blogspot.com/2008/11/get-avahi-working-on-maemo.html">post</a> says about some problem with at the startup that have been solved.</p>
<p>On your linux box now you have something like this:<br />
root@joshua:/etc/avahi# avahi-browse-domains -a<br />
+ vmnet8 IPv4 joshua [00:50:56:c0:00:08]                    Workstation          local<br />
+ vmnet1 IPv4 joshua [00:50:56:c0:00:01]                    Workstation          local<br />
+ eth1 IPv4 joshua [00:1e:c2:be:4e:f6]                        Workstation          local<br />
+ eth1 IPv4 key [00:0d:60:5e:35:ab]                            Workstation          local<br />
+ eth1 IPv4 key                                                     SSH Remote Terminal  local<br />
+ eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8]           Workstation          local<br />
- eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8]           Workstation          local<br />
+ eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8]           Workstation          local<br />
- eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8]           Workstation          local<br />
+ eth1 IPv4 freaky [00:1d:6e:9c:00:e8]                    Workstation          local</p>
<p>In this report you can see that I restarted 2 times my avahi daemon on the N810 and<br />
the last time I changed the hostname editing /etc/avahi/avahi-daemon.conf</p>
<p>Note: the avahi utils are in a separate package: avahi-utils <img src='http://www.gnuton.org/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2009/03/using-avahi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging a KUniqueApplication</title>
		<link>http://www.gnuton.org/blog/2008/03/debugging-a-kuniqueapplication/</link>
		<comments>http://www.gnuton.org/blog/2008/03/debugging-a-kuniqueapplication/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 20:17:02 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/2008/03/04/debugging-a-kuniqueapplication/</guid>
		<description><![CDATA[Today i&#8217;ve found a crash in kblogger. But i was unable to get a valid backtrace because kblogger is a KUniqueApplication . A KUniqueApplication will fork(): the parent process exits, the child continues. So if you want debug a application child of KUniqueApplication you must launch gdb &#8211;args your_application &#8211;nofork (thank to pinotree for the [...]]]></description>
			<content:encoded><![CDATA[<p>Today i&#8217;ve found a crash in kblogger. But i was unable to get a valid backtrace because kblogger is a KUniqueApplication .</p>
<p>A KUniqueApplication will fork(): the parent process exits, the child continues.</p>
<p>So if you want debug a application child of KUniqueApplication you must launch</p>
<p><em>gdb &#8211;args your_application &#8211;nofork</em></p>
<p>(thank to pinotree for the suggestion)</p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2008/03/debugging-a-kuniqueapplication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenVPN: Navigare sicuri via VPN.</title>
		<link>http://www.gnuton.org/blog/2008/03/openvpn-navigare-sicuri-via-vpn/</link>
		<comments>http://www.gnuton.org/blog/2008/03/openvpn-navigare-sicuri-via-vpn/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 11:49:44 +0000</pubDate>
		<dc:creator>gnuton</dc:creator>
				<category><![CDATA[myDocs]]></category>

		<guid isPermaLink="false">http://www.gnuton.org/blog/2008/03/02/openvpn-navigare-sicuri-via-vpn/</guid>
		<description><![CDATA[Scopo di questo piccolo howto è installare e configurare una VPN (Virtual Private Network) da usare come tunnel per connettersi in modo &#8220;sicuro&#8221; ad internet quando si è in giro per il mondo (o in università!:P) e si usano connessioni wireless/wired poco affidabili. Iniziamo installando il pacchetto openvpn sul nostro server (io uso ubuntu). apt-get [...]]]></description>
			<content:encoded><![CDATA[<p>Scopo di questo piccolo howto è installare e configurare una VPN (Virtual Private Network) da usare come tunnel per connettersi in modo &#8220;sicuro&#8221; ad internet quando si è in giro per il mondo (o in università!:P) e si usano connessioni wireless/wired poco affidabili.</p>
<p>Iniziamo installando il pacchetto openvpn sul nostro server (io uso ubuntu).</p>
<p><em>apt-get install openvpn</em></p>
<p>Copiamo i tools necessari alla generazione dei certificati e delle chiavi in una dir a nostro piacere (usare /tmp è poco paranoico! <img src='http://www.gnuton.org/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
<p><em>cp /usr/share/doc/openvpn/easy-rsa /tmp -r</em></p>
<p><em>cd /tmp</em></p>
<p>Editiamo il file vars e lo avviamo</p>
<p><em>. vars</em></p>
<p>Avviandolo abbiamo impostato alcune variabili d&#8217;ambiente necessarie per l&#8217;esecuzione degli altri script</p>
<p>NOTA: va eseguito con il &#8216;.&#8217; ovvero &#8220;. vars&#8221;!!!</p>
<p>ora creiamo i nostro root key e certificato con il quale faremo poi il sign delle varie chiavi di server e client.</p>
<p><em> ./build-ca</em></p>
<p>verranno creati i file ca.crt e ca.key nella KEY_DIR impostata nel file vars.</p>
<p>creiamo i DIFFIE-HELLMAN PARAMETERS (necessary for the server end of a SSL/TLS connection).</p>
<p><em> ./build-dh</em></p>
<p>creiamo chiave e certificato per server e client</p>
<p><em>./build-key-server server</em></p>
<p>scrivendo &#8220;server&#8221; o qualunque cosa ci ricordi che quello è il server alla voce common name.</p>
<p>Creiamo ora le chiavi per i client</p>
<p><em>./build-key client1</em></p>
<p>scrivendo &#8220;client1&#8243; o qualunque cosa ci ricordi che quello è il client n°1 alla voce common name.</p>
<p>Nota: se abbiamo + client possiamo creare + chiavi con buid-key.</p>
<p>Abbiamo creato cosi i seguenti files:</p>
<p>Filename       Needed By                  Purpose                     Secret</p>
<p>ca.crt       server + all clients       Root CA certificate         NO</p>
<p>ca.key       key signing machine only   Root CA key                 YES</p>
<p>dh{n}.pem    server only                Diffie Hellman parameters   NO</p>
<p>server.crt   server only                Server Certificate          NO</p>
<p>server.key   server only                Server Key                  YES</p>
<p>client1.crt  client1 only               Client1 Certificate         NO</p>
<p>client1.key  client1 only               Client1 Key                 YES</p>
<p>Creiaamo ora le directory CA, SERVER in /etc/openvpn</p>
<p><em>mkdir /etc/openvpn/CA</em></p>
<p><em>mkdir /etc/openvpn/SERVER</em></p>
<p>e spostiamo i file delle chiavi e dei certificati attenendoci alla tabella riportata sopra.</p>
<p>Avremo cosi i seguenti file nelle seguenti cartelle:</p>
<p>CA:</p>
<p>ca.crt  ca.key</p>
<p>SERVER:</p>
<p>dh1024.pem  server.crt  server.key</p>
<p>Copiamo ora sul client i file:</p>
<p>ca.crt</p>
<p>client1.crt</p>
<p>client1.key</p>
<p>(Magari usando sftp o una via &#8220;sicura&#8221; proteggendo il .key da occhi indiscreti!)</p>
<p>Creiamo i file server.conf sul host server e client.conf sugli host client</p>
<p>Usiamo come file di configurazione per client e server i file di esempi standard che potete trovare qui sotto o in /usr/share/doc/openvpn/examples.</p>
<p>Ricordando che # e ; son caratteri che commentano la riga.</p>
<p><code>--------------------SERVER-------------------------------------</code></p>
<p><code>root@dharma:/etc/openvpn# cat server.conf</code></p>
<p><code>#################################################</code></p>
<p><code># Sample OpenVPN 2.0 config file for            #</code></p>
<p><code># multi-client server.                          #</code></p>
<p><code>#                                               #</code></p>
<p><code># This file is for the server side              #</code></p>
<p><code># of a many-clients  one-server              #</code></p>
<p><code># OpenVPN configuration.                        #</code></p>
<p><code>#                                               #</code></p>
<p><code># OpenVPN also supports                         #</code></p>
<p><code># single-machine  single-machine             #</code></p>
<p><code># configurations (See the Examples page         #</code></p>
<p><code># on the web site for more info).               #</code></p>
<p><code>#                                               #</code></p>
<p><code># This config should work on Windows            #</code></p>
<p><code># or Linux/BSD systems.  Remember on            #</code></p>
<p><code># Windows to quote pathnames and use            #</code></p>
<p><code># double backslashes, e.g.:                     #</code></p>
<p><code># "C:\\Program Files\\OpenVPN\\config\\foo.key" #</code></p>
<p><code>#                                               #</code></p>
<p><code># Comments are preceded with '#' or ';'         #</code></p>
<p><code>#################################################</code></p>
<p><code># Which local IP address should OpenVPN</code></p>
<p><code># listen on? (optional)</code></p>
<p><code>local 192.168.1.2</code></p>
<p><code># Which TCP/UDP port should OpenVPN listen on?</code></p>
<p><code># If you want to run multiple OpenVPN instances</code></p>
<p><code># on the same machine, use a different port</code></p>
<p><code># number for each one.  You will need to</code></p>
<p><code># open up this port on your firewall.</code></p>
<p><code>;port 5002</code></p>
<p><code>lport 5002</code></p>
<p><code># TCP or UDP server?</code></p>
<p><code>proto tcp</code></p>
<p><code>;proto udp</code></p>
<p><code># "dev tun" will create a routed IP tunnel,</code></p>
<p><code># "dev tap" will create an ethernet tunnel.</code></p>
<p><code># Use "dev tap0" if you are ethernet bridging</code></p>
<p><code># and have precreated a tap0 virtual interface</code></p>
<p><code># and bridged it with your ethernet interface.</code></p>
<p><code># If you want to control access policies</code></p>
<p><code># over the VPN, you must create firewall</code></p>
<p><code># rules for the the TUN/TAP interface.</code></p>
<p><code># On non-Windows systems, you can give</code></p>
<p><code># an explicit unit number, such as tun0.</code></p>
<p><code># On Windows, use "dev-node" for this.</code></p>
<p><code># On most systems, the VPN will not function</code></p>
<p><code># unless you partially or fully disable</code></p>
<p><code># the firewall for the TUN/TAP interface.</code></p>
<p><code>;dev tap</code></p>
<p><code>dev tun</code></p>
<p><code># Windows needs the TAP-Win32 adapter name</code></p>
<p><code># from the Network Connections panel if you</code></p>
<p><code># have more than one.  On XP SP2 or higher,</code></p>
<p><code># you may need to selectively disable the</code></p>
<p><code># Windows firewall for the TAP adapter.</code></p>
<p><code># Non-Windows systems usually don't need this.</code></p>
<p><code>;dev-node MyTap</code></p>
<p><code># SSL/TLS root certificate (ca), certificate</code></p>
<p><code># (cert), and private key (key).  Each client</code></p>
<p><code># and the server must have their own cert and</code></p>
<p><code># key file.  The server and all clients will</code></p>
<p><code># use the same ca file.</code></p>
<p><code>#</code></p>
<p><code># See the "easy-rsa" directory for a series</code></p>
<p><code># of scripts for generating RSA certificates</code></p>
<p><code># and private keys.  Remember to use</code></p>
<p><code># a unique Common Name for the server</code></p>
<p><code># and each of the client certificates.</code></p>
<p><code>#</code></p>
<p><code># Any X509 key management system can be used.</code></p>
<p><code># OpenVPN can also use a PKCS #12 formatted key file</code></p>
<p><code># (see "pkcs12" directive in man page).</code></p>
<p><code>ca    /etc/openvpn/CA/ca.crt</code></p>
<p><code>cert /etc/openvpn/SERVER/server.crt</code></p>
<p><code>key  /etc/openvpn/SERVER/server.key  # This file should be kept secret</code></p>
<p><code># Diffie hellman parameters.</code></p>
<p><code># Generate your own with:</code></p>
<p><code>#   openssl dhparam -out dh1024.pem 1024</code></p>
<p><code># Substitute 2048 for 1024 if you are using</code></p>
<p><code># 2048 bit keys.</code></p>
<p><code>dh /etc/openvpn/SERVER/dh1024.pem</code></p>
<p><code># Configure server mode and supply a VPN subnet</code></p>
<p><code># for OpenVPN to draw client addresses from.</code></p>
<p><code># The server will take 10.8.0.1 for itself,</code></p>
<p><code># the rest will be made available to clients.</code></p>
<p><code># Each client will be able to reach the server</code></p>
<p><code># on 10.8.0.1. Comment this line out if you are</code></p>
<p><code># ethernet bridging. See the man page for more info.</code></p>
<p><code>server 10.8.0.0 255.255.255.0</code></p>
<p><code># Maintain a record of client  virtual IP address</code></p>
<p><code># associations in this file.  If OpenVPN goes down or</code></p>
<p><code># is restarted, reconnecting clients can be assigned</code></p>
<p><code># the same virtual IP address from the pool that was</code></p>
<p><code># previously assigned.</code></p>
<p><code>ifconfig-pool-persist ipp.txt</code></p>
<p><code># Configure server mode for ethernet bridging.</code></p>
<p><code># You must first use your OS's bridging capability</code></p>
<p><code># to bridge the TAP interface with the ethernet</code></p>
<p><code># NIC interface.  Then you must manually set the</code></p>
<p><code># IP/netmask on the bridge interface, here we</code></p>
<p><code># assume 10.8.0.4/255.255.255.0.  Finally we</code></p>
<p><code># must set aside an IP range in this subnet</code></p>
<p><code># (start=10.8.0.50 end=10.8.0.100) to allocate</code></p>
<p><code># to connecting clients.  Leave this line commented</code></p>
<p><code># out unless you are ethernet bridging.</code></p>
<p><code>;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100</code></p>
<p><code># Push routes to the client to allow it</code></p>
<p><code># to reach other private subnets behind</code></p>
<p><code># the server.  Remember that these</code></p>
<p><code># private subnets will also need</code></p>
<p><code># to know to route the OpenVPN client</code></p>
<p><code># address pool (10.8.0.0/255.255.255.0)</code></p>
<p><code># back to the OpenVPN server.</code></p>
<p><code>;push "route 192.168.10.0 255.255.255.0"</code></p>
<p><code>;push "route 192.168.20.0 255.255.255.0"</code></p>
<p><code># To assign specific IP addresses to specific</code></p>
<p><code># clients or if a connecting client has a private</code></p>
<p><code># subnet behind it that should also have VPN access,</code></p>
<p><code># use the subdirectory "ccd" for client-specific</code></p>
<p><code># configuration files (see man page for more info).</code></p>
<p><code># EXAMPLE: Suppose the client</code></p>
<p><code># having the certificate common name "Thelonious"</code></p>
<p><code># also has a small subnet behind his connecting</code></p>
<p><code># machine, such as 192.168.40.128/255.255.255.248.</code></p>
<p><code># First, uncomment out these lines:</code></p>
<p><code>;client-config-dir ccd</code></p>
<p><code>;route 192.168.40.128 255.255.255.248</code></p>
<p><code># Then create a file ccd/Thelonious with this line:</code></p>
<p><code>#   iroute 192.168.40.128 255.255.255.248</code></p>
<p><code># This will allow Thelonious' private subnet to</code></p>
<p><code># access the VPN.  This example will only work</code></p>
<p><code># if you are routing, not bridging, i.e. you are</code></p>
<p><code># using "dev tun" and "server" directives.</code></p>
<p><code># EXAMPLE: Suppose you want to give</code></p>
<p><code># Thelonious a fixed VPN IP address of 10.9.0.1.</code></p>
<p><code># First uncomment out these lines:</code></p>
<p><code>;client-config-dir ccd</code></p>
<p><code>;route 10.9.0.0 255.255.255.252</code></p>
<p><code># Then add this line to ccd/Thelonious:</code></p>
<p><code>#   ifconfig-push 10.9.0.1 10.9.0.2</code></p>
<p><code># Suppose that you want to enable different</code></p>
<p><code># firewall access policies for different groups</code></p>
<p><code># of clients.  There are two methods:</code></p>
<p><code># (1) Run multiple OpenVPN daemons, one for each</code></p>
<p><code>#     group, and firewall the TUN/TAP interface</code></p>
<p><code>#     for each group/daemon appropriately.</code></p>
<p><code># (2) (Advanced) Create a script to dynamically</code></p>
<p><code>#     modify the firewall in response to access</code></p>
<p><code>#     from different clients.  See man</code></p>
<p><code>#     page for more info on learn-address script.</code></p>
<p><code>;learn-address ./script</code></p>
<p><code># If enabled, this directive will configure</code></p>
<p><code># all clients to redirect their default</code></p>
<p><code># network gateway through the VPN, causing</code></p>
<p><code># all IP traffic such as web browsing and</code></p>
<p><code># and DNS lookups to go through the VPN</code></p>
<p><code># (The OpenVPN server machine may need to NAT</code></p>
<p><code># the TUN/TAP interface to the internet in</code></p>
<p><code># order for this to work properly).</code></p>
<p><code># CAVEAT: May break client's network config if</code></p>
<p><code># client's local DHCP server packets get routed</code></p>
<p><code># through the tunnel.  Solution: make sure</code></p>
<p><code># client's local DHCP server is reachable via</code></p>
<p><code># a more specific route than the default route</code></p>
<p><code># of 0.0.0.0/0.0.0.0.</code></p>
<p><code>;push "redirect-gateway"</code></p>
<p><code># Certain Windows-specific network settings</code></p>
<p><code># can be pushed to clients, such as DNS</code></p>
<p><code># or WINS server addresses.  CAVEAT:</code></p>
<p><code># http://openvpn.net/faq.html#dhcpcaveats</code></p>
<p><code>;push "dhcp-option DNS 10.8.0.1"</code></p>
<p><code>;push "dhcp-option WINS 10.8.0.1"</code></p>
<p><code># Uncomment this directive to allow different</code></p>
<p><code># clients to be able to "see" each other.</code></p>
<p><code># By default, clients will only see the server.</code></p>
<p><code># To force clients to only see the server, you</code></p>
<p><code># will also need to appropriately firewall the</code></p>
<p><code># server's TUN/TAP interface.</code></p>
<p><code>;client-to-client</code></p>
<p><code># Uncomment this directive if multiple clients</code></p>
<p><code># might connect with the same certificate/key</code></p>
<p><code># files or common names.  This is recommended</code></p>
<p><code># only for testing purposes.  For production use,</code></p>
<p><code># each client should have its own certificate/key</code></p>
<p><code># pair.</code></p>
<p><code>#</code></p>
<p><code># IF YOU HAVE NOT GENERATED INDIVIDUAL</code></p>
<p><code># CERTIFICATE/KEY PAIRS FOR EACH CLIENT,</code></p>
<p><code># EACH HAVING ITS OWN UNIQUE "COMMON NAME",</code></p>
<p><code># UNCOMMENT THIS LINE OUT.</code></p>
<p><code>;duplicate-cn</code></p>
<p><code># The keepalive directive causes ping-like</code></p>
<p><code># messages to be sent back and forth over</code></p>
<p><code># the link so that each side knows when</code></p>
<p><code># the other side has gone down.</code></p>
<p><code># Ping every 10 seconds, assume that remote</code></p>
<p><code># peer is down if no ping received during</code></p>
<p><code># a 120 second time period.</code></p>
<p><code>keepalive 10 120</code></p>
<p><code># For extra security beyond that provided</code></p>
<p><code># by SSL/TLS, create an "HMAC firewall"</code></p>
<p><code># to help block DoS attacks and UDP port flooding.</code></p>
<p><code>#</code></p>
<p><code># Generate with:</code></p>
<p><code>#   openvpn --genkey --secret ta.key</code></p>
<p><code>#</code></p>
<p><code># The server and each client must have</code></p>
<p><code># a copy of this key.</code></p>
<p><code># The second parameter should be '0'</code></p>
<p><code># on the server and '1' on the clients.</code></p>
<p><code>;tls-auth ta.key 0 # This file is secret</code></p>
<p><code># Select a cryptographic cipher.</code></p>
<p><code># This config item must be copied to</code></p>
<p><code># the client config file as well.</code></p>
<p><code>;cipher BF-CBC        # Blowfish (default)</code></p>
<p><code>;cipher AES-128-CBC   # AES</code></p>
<p><code>;cipher DES-EDE3-CBC  # Triple-DES</code></p>
<p><code># Enable compression on the VPN link.</code></p>
<p><code># If you enable it here, you must also</code></p>
<p><code># enable it in the client config file.</code></p>
<p><code>comp-lzo</code></p>
<p><code># The maximum number of concurrently connected</code></p>
<p><code># clients we want to allow.</code></p>
<p><code>;max-clients 100</code></p>
<p><code># It's a good idea to reduce the OpenVPN</code></p>
<p><code># daemon's privileges after initialization.</code></p>
<p><code>#</code></p>
<p><code># You can uncomment this out on</code></p>
<p><code># non-Windows systems.</code></p>
<p><code>;user nobody</code></p>
<p><code>;group nogroup</code></p>
<p><code># The persist options will try to avoid</code></p>
<p><code># accessing certain resources on restart</code></p>
<p><code># that may no longer be accessible because</code></p>
<p><code># of the privilege downgrade.</code></p>
<p><code>persist-key</code></p>
<p><code>persist-tun</code></p>
<p><code># Output a short status file showing</code></p>
<p><code># current connections, truncated</code></p>
<p><code># and rewritten every minute.</code></p>
<p><code>status openvpn-status.log</code></p>
<p><code># By default, log messages will go to the syslog (or</code></p>
<p><code># on Windows, if running as a service, they will go to</code></p>
<p><code># the "\Program Files\OpenVPN\log" directory).</code></p>
<p><code># Use log or log-append to override this default.</code></p>
<p><code># "log" will truncate the log file on OpenVPN startup,</code></p>
<p><code># while "log-append" will append to it.  Use one</code></p>
<p><code># or the other (but not both).</code></p>
<p><code>;log         openvpn.log</code></p>
<p><code>;log-append  openvpn.log</code></p>
<p><code># Set the appropriate level of log</code></p>
<p><code># file verbosity.</code></p>
<p><code>#</code></p>
<p><code># 0 is silent, except for fatal errors</code></p>
<p><code># 4 is reasonable for general usage</code></p>
<p><code># 5 and 6 can help to debug connection problems</code></p>
<p><code># 9 is extremely verbose</code></p>
<p><code>verb 4</code></p>
<p><code># Silence repeating messages.  At most 20</code></p>
<p><code># sequential messages of the same message</code></p>
<p><code># category will be output to the log.</code></p>
<p><code>;mute 20</code></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;CLIENT&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p><code>$ cat client.conf</code></p>
<p><code>##############################################</code></p>
<p><code># Sample client-side OpenVPN 2.0 config file #</code></p>
<p><code># for connecting to multi-client server.     #</code></p>
<p><code>#                                            #</code></p>
<p><code># This configuration can be used by multiple #</code></p>
<p><code># clients, however each client should have   #</code></p>
<p><code># its own cert and key files.                #</code></p>
<p><code>#                                            #</code></p>
<p><code># On Windows, you might want to rename this  #</code></p>
<p><code># file so it has a .ovpn extension           #</code></p>
<p><code>##############################################</code></p>
<p><code># Specify that we are a client and that we</code></p>
<p><code># will be pulling certain config file directives</code></p>
<p><code># from the server.</code></p>
<p><code>client</code></p>
<p><code># Use the same setting as you are using on</code></p>
<p><code># the server.</code></p>
<p><code># On most systems, the VPN will not function</code></p>
<p><code># unless you partially or fully disable</code></p>
<p><code># the firewall for the TUN/TAP interface.</code></p>
<p><code>;dev tap</code></p>
<p><code>dev tun</code></p>
<p><code># Windows needs the TAP-Win32 adapter name</code></p>
<p><code># from the Network Connections panel</code></p>
<p><code># if you have more than one.  On XP SP2,</code></p>
<p><code># you may need to disable the firewall</code></p>
<p><code># for the TAP adapter.</code></p>
<p><code>;dev-node MyTap</code></p>
<p><code># Are we connecting to a TCP or</code></p>
<p><code># UDP server?  Use the same setting as</code></p>
<p><code># on the server.</code></p>
<p><code>proto tcp</code></p>
<p><code>;proto udp</code></p>
<p><code># The hostname/IP and port of the server.</code></p>
<p><code># You can have multiple remote entries</code></p>
<p><code># to load balance between the servers.</code></p>
<p><code>remote gnuton.homeunix.org 5002</code></p>
<p><code>;remote my-server-2 1194</code></p>
<p><code># Choose a random host from the remote</code></p>
<p><code># list for load-balancing.  Otherwise</code></p>
<p><code># try hosts in the order specified.</code></p>
<p><code>;remote-random</code></p>
<p><code># Keep trying indefinitely to resolve the</code></p>
<p><code># host name of the OpenVPN server.  Very useful</code></p>
<p><code># on machines which are not permanently connected</code></p>
<p><code># to the internet such as laptops.</code></p>
<p><code>resolv-retry infinite</code></p>
<p><code># Most clients don't need to bind to</code></p>
<p><code># a specific local port number.</code></p>
<p><code>nobind</code></p>
<p><code># Downgrade privileges after initialization (non-Windows only)</code></p>
<p><code>;user nobody</code></p>
<p><code>;group nogroup</code></p>
<p><code># Try to preserve some state across restarts.</code></p>
<p><code>persist-key</code></p>
<p><code>persist-tun</code></p>
<p><code># If you are connecting through an</code></p>
<p><code># HTTP proxy to reach the actual OpenVPN</code></p>
<p><code># server, put the proxy server/IP and</code></p>
<p><code># port number here.  See the man page</code></p>
<p><code># if your proxy server requires</code></p>
<p><code># authentication.</code></p>
<p><code>;http-proxy-retry # retry on connection failures</code></p>
<p><code>;http-proxy [proxy server] [proxy port #]</code></p>
<p><code># Wireless networks often produce a lot</code></p>
<p><code># of duplicate packets.  Set this flag</code></p>
<p><code># to silence duplicate packet warnings.</code></p>
<p><code>;mute-replay-warnings</code></p>
<p><code># SSL/TLS parms.</code></p>
<p><code># See the server config file for more</code></p>
<p><code># description.  It's best to use</code></p>
<p><code># a separate .crt/.key file pair</code></p>
<p><code># for each client.  A single ca</code></p>
<p><code># file can be used for all clients.</code></p>
<p><code>ca ca.crt</code></p>
<p><code>cert client1.crt</code></p>
<p><code>key client1.key</code></p>
<p><code># Verify server certificate by checking</code></p>
<p><code># that the certicate has the nsCertType</code></p>
<p><code># field set to "server".  This is an</code></p>
<p><code># important precaution to protect against</code></p>
<p><code># a potential attack discussed here:</code></p>
<p><code>#  http://openvpn.net/howto.html#mitm</code></p>
<p><code>#</code></p>
<p><code># To use this feature, you will need to generate</code></p>
<p><code># your server certificates with the nsCertType</code></p>
<p><code># field set to "server".  The build-key-server</code></p>
<p><code># script in the easy-rsa folder will do this.</code></p>
<p><code>;ns-cert-type server</code></p>
<p><code># If a tls-auth key is used on the server</code></p>
<p><code># then every client must also have the key.</code></p>
<p><code>;tls-auth ta.key 1</code></p>
<p><code># Select a cryptographic cipher.</code></p>
<p><code># If the cipher option is used on the server</code></p>
<p><code># then you must also specify it here.</code></p>
<p><code>;cipher x</code></p>
<p><code># Enable compression on the VPN link.</code></p>
<p><code># Don't enable this unless it is also</code></p>
<p><code># enabled in the server config file.</code></p>
<p><code>comp-lzo</code></p>
<p><code># Set log file verbosity.</code></p>
<p><code>verb 4</code></p>
<p><code># Silence repeating messages</code></p>
<p><code>;mute 20</code></p>
<p><code>-----------------------------------------------------------------</code></p>
<p>NOTA: Salvando queste configurazioni in /etc/openvpn/ lo script /etc/init.d/openvpn avvierà automaticamente il demone al riavvio della macchina utilizzando tali configurazioni.</p>
<p>Per testare le nostre configurazione, lanciamo sul server e poi sul client</p>
<p><em>openvpn &#8211;config /etc/openvpn/server.conf</em></p>
<p><em>openvpn &#8211;config /etc/openvpn/client.conf</em></p>
<p>se nei log stampati a schermo leggiamo qualcosa del tipo</p>
<p><em>Sun Mar  2 10:15:53 2008 us=254390 Initialization Sequence Completed</em></p>
<p>sia lato client che server è tutto ok</p>
<p>controlliamo anche se l&#8217;interfaccia  tun0 è up (se è tutto ok, dovrebbe essere certamente &#8220;su&#8221;)</p>
<p><em>#ifconfig tun0</em></p>
<p><em>tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00</em></p>
<p><em>          inet addr:10.8.0.6  P-t-P:10.8.0.5  Mask:255.255.255.255</em></p>
<p><em>          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1</em></p>
<p><em>          RX packets:0 errors:0 dropped:0 overruns:0 frame:0</em></p>
<p><em>          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0</em></p>
<p><em>          collisions:0 txqueuelen:100</em></p>
<p><em>          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)</em></p>
<p>Ricordandoci che  10.8.0.1 è l&#8217;ip del client.</p>
<p>proviamo a pingare il server</p>
<p><em># ping 10.8.0.1</em></p>
<p>se pinga è tutto ok! <img src='http://www.gnuton.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ora che abbiamo creato un tunnel punto a punto tra server e client, se si vuole che il client usi la VPN per &#8220;navigare in internet&#8221; usando la connessione internet del server (magari quella di casa nostra o del nostro ufficio), abilitiamo il nostro server VPN a funzionare da gateway.</p>
<p>1) Modifichiamo lo script del firewall in /etc/init.d aggiungendo righe tipo queste:</p>
<p>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</p>
<p>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</p>
<p>dove eth0 è l&#8217;intefaccia dalla quale il mio gateway VPN &#8220;riceve la connessione internet&#8221; secondo lo schema:</p>
<p><code> [internet][router]eth0[OpenVPN Server]tun0tun0[OpenVPN client]</code></p>
<p>Nel caso in cui non avessimo nessuno script che setti le regole del firewall sul server (male) possiamo anche in maniera molto, ma molto grezza inserire le precedenti linee nel file /etc/init.d/openvpn in modo tale che il server al boot possa fare da gateway per le connessioni internet delle macchine che si collegano via vpn.</p>
<p>2) Decommentiamo la linea &#8216;push &#8220;redirect-gateway&#8221;&#8216; nel server.conf</p>
<p>Ora per testare il corretto funzionamento, posso usare l&#8217;utility tracepath o route;</p>
<p>se tutto è andato bene vedremo che i nostri pacchetti saranno instradati via openVPN</p>
<p><em>$ tracepath www.google.it</em></p>
<p><em> 1:  10.8.0.6 (10.8.0.6)                                    0.654ms pmtu 1500</em></p>
<p><em> 1:  10.8.0.1 (10.8.0.1)                                   90.794ms</em></p>
<p><em> 2:  192.168.1.1 (192.168.1.1)                             92.217ms</em></p>
<p><em> 3:  192.168.1.1 (192.168.1.1)                            asymm  2  90.773ms pmtu 1492</em></p>
<p>se quacosa è andato storto</p>
<p>1) tracepath è muto, dobbiamo configurare il NAT sul nostro openVPN server</p>
<p>2) tracepath ritorna qualcosa di simile:</p>
<p><em>  $ tracepath www.google.it</em></p>
<p><em>   1:  192.168.1.2 (192.168.1.2)                                    0.64ms</em></p>
<p><em>   2:  192.168.1.1 (192.168.1.1)</em></p>
<p>In questo caso stiamo ancora usando il default gateway della nostra sottorete, percui tutti i pacchetti sono instradati verso internet per mezzo del nostro router e non via VPN.</p>
<p>Probabilmente abbiamo dimenticato di modificare il server.conf, aggiungendo/decommentando la riga push &#8220;redirect-gateway&#8221;.</p>
<p>Nota: Nel caso avessimo delle regole di firewalling restrittive i pacchetti icmp di tracepath potrebbero essere bloccati, in tal caso tracepath nn ci da nulla.</p>
<p>Possiamo però ugualmente controllare la tabella di routing del kernel del nostro client con il comando &#8220;route&#8221;</p>
<p>Questo è tutto. Spero di esser stato chiaro e di non aver saltato passaggi o commesso errori.</p>
<p>Per qualunque cosa, usate commentate il post!</p>
<p>Nota: Se siete dei possessori dei fantastici Nokia Internet Tablet (come me), vi ricordo che openvpn è presente nei repository ufficiali!!</p>
<p>Buona navigazione &#8220;sicura&#8221;!</p>
<p>Per maggiori informazioni vi rimando al sito ufficiale di <a HREF="http://www.openvpn.org">openvpn</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gnuton.org/blog/2008/03/openvpn-navigare-sicuri-via-vpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

