<?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>Luca Gibelli &#187; howto</title>
<atom:link href="http://www.nervous.it/lang/en-us/categories/howto/feed/" rel="self" type="application/rss+xml" />
<link>http://www.nervous.it</link>
<description>You came here by hitting the wrong anykey.</description>
<lastBuildDate>Sat, 24 Dec 2011 01:43:16 +0000</lastBuildDate>
<language>en-us</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>http://wordpress.org/?v=3.2.1</generator>
<item>
<title>Huawei E1750 3G USB modem on OpenWRT Kamikaze</title>
<link>http://www.nervous.it/lang/en-us/2010/12/huawei-e1750-and-openwrt</link>
<comments>http://www.nervous.it/lang/en-us/2010/12/huawei-e1750-and-openwrt#comments</comments>
<pubDate>Sat, 18 Dec 2010 19:16:40 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[hw support]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=516</guid>
<description>
<![CDATA[I recently configured a Netgear WGT634U access point running OpenWRT Kamikaze 8.09.2 to use a HUAWEI E1750 3G modem. The HUAWEI E1750 is sold under different names, some people report it as E220 or E1752. You should check in /proc/bus/usb/devices what is the vendor and product id of your 3G modem. You should see the [...]]]>
</description>
<content:encoded>
<![CDATA[<p>I recently configured a Netgear WGT634U access point running <a href="http://www.openwrt.org">OpenWRT</a> Kamikaze 8.09.2 to use a HUAWEI E1750 3G modem.</p>
<p>The HUAWEI E1750 is sold under different names, some people report it as E220 or E1752. You should check in /proc/bus/usb/devices what is the vendor and product id of your 3G modem. You should see the following values:<br />
<code>vendor=0x12d1 product=0x1446</code></p>
<p>This howto should apply to all 3G USB modems with the same vendor and product id and any AP running OpenWRT Kamikaze 8.09.2.<br />
Here is how I got the whole thing running:</p>
<p>1. Install the required kernel modules and utilities:</p>
<p><code><br />
# opkg update<br />
# opkg install kmod-usb-acm kmod-usb-core kmod-usb-ohci kmod-usb-serial comgt \<br />
kmod-usb-serial-option kmod-usb-storage kmod-usb-uhci kmod-usb2  usb-modeswitch<br />
</code></p>
<p>2. Create or edit the file /etc/modules.d/60-usb-serial so that it only contains the following line:</p>
<p><code>usbserial vendor=0x12d1 product=0x1446</code></p>
<p>3. Create or edit the file/etc/usb_modeswitch.conf so that it looks as follows:</p>
<p><code>DefaultVendor= 0x12d1<br />
DefaultProduct=0x1446<br />
TargetVendor=  0x12d1<br />
TargetProductList="1001,1406,140c,14ac"<br />
CheckSuccess=20<br />
MessageEndpoint=0×01<br />
MessageContent="55534243123456780000000000000011060000000000000000000000000000"<br />
</code></p>
<p>4. Add the following section to /etc/config/network:</p>
<p><strong>WARNING!!! Depending on the model of your 3G modem you may need to replace ttyUSB0 with ttyUSB1, ttyUSB2, etc. Check the output of &#8220;dmesg&#8221; to know which is the correct port. If you are unsure, find out by trial-and-error.</strong><br />
<code><br />
config 'interface' 'ppp0'<br />
    option 'ifname' 'ppp0'<br />
    option 'proto' '3g'<br />
    option 'device' '/dev/ttyUSB0'<br />
    option 'apn' 'YOURAPNHERE'<br />
    option 'pincode' 'YOURPINCODEHERE'</code></p>
<p>Replace YOURAPNHERE with the name of your APN (e.g. &#8220;tre.it&#8221; for H3G Italy) and YOURPINCODEHERE with the PIN code of your SIM. </p>
<p><strong>WARNING!!! If you have disabled PIN code verification for your SIM, you can omit the pincode option but you&#8217;ll need to workaround a bug in /lib/network/3g.sh. Open /lib/network/3g.sh in your editor and comment out the following lines:</strong></p>
<p><code>#  PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom &#124;&#124; {<br />
#               echo "$cfg(3g): Failed to set the PIN code."<br />
#               set_3g_led 0 0 0<br />
#               return 1<br />
#       }<br />
</code></p>
<p>5. Reboot your OpenWRT device.</p>
<p>6. Manually run the following commands and after a minute verify that your 3G connection is working:</p>
<p><code>usb_modeswitch<br />
ifup ppp0<br />
</code></p>
<p>7. Add the following lines to the top of /etc/rc.local:</p>
<p><code>sleep 3<br />
/usr/sbin/usb_modeswitch<br />
sleep 3<br />
/sbin/ifup ppp0 </code></p>
<p>8. Log on the web interface of your OpenWRT device and click on Administration/Networks/Interfaces/ppp0 and add it to the WAN zone.</p>
<p>You may need to adjust the DNS settings manually. </p>
<p>Credits: <a href="http://www.it-slav.net/blogs/2010/06/12/howto-use-3g-dongle-huawei-e1750-in-openwrt/">Peter Andersson</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;count=horizontal&amp;text=Huawei%20E1750%203G%20USB%20modem%20on%20OpenWRT%20Kamikaze" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;count=horizontal&amp;text=Huawei%20E1750%203G%20USB%20modem%20on%20OpenWRT%20Kamikaze" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F12%2Fhuawei-e1750-and-openwrt&amp;title=Huawei%20E1750%203G%20USB%20modem%20on%20OpenWRT%20Kamikaze" id="wpa2a_2"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/12/huawei-e1750-and-openwrt/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>Skype video call shortcut in MacOSX</title>
<link>http://www.nervous.it/lang/en-us/2010/11/skype-video-call-shortcut</link>
<comments>http://www.nervous.it/lang/en-us/2010/11/skype-video-call-shortcut#comments</comments>
<pubDate>Tue, 16 Nov 2010 19:30:33 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[applescript]]>
</category>
<category>
<![CDATA[automator]]>
</category>
<category>
<![CDATA[call]]>
</category>
<category>
<![CDATA[macosx]]>
</category>
<category>
<![CDATA[skype]]>
</category>
<category>
<![CDATA[video]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=508</guid>
<description>
<![CDATA[I use Skype to make video calls mainly to a couple of contacts. I didn&#8217;t want to enable video automatically for all calls and at the same time I find it tiring to search for the contact name and place a video call. I wanted something easy to automate that. Here is a simple Automator [...]]]>
</description>
<content:encoded>
<![CDATA[<p>I use Skype to make video calls mainly to a couple of contacts. I didn&#8217;t want to enable video automatically for all calls and at the same time I find it tiring to search for the contact name and place a video call.</p>
<p>I wanted something easy to automate that. Here is a simple Automator written in AppleScript which will take care of that:<br />
<code><br />
on GetPart(s, p, d)<br />
        set theList to every text item of s<br />
        return (item p of theList)<br />
end GetPart<br />
on run {input, parameters}</p>
<p>     (* Your script goes here *)<br />
        activate application "Skype"<br />
        tell application "System Events"<br />
                delay 1<br />
                set AppleScript's text item delimiters to " "<br />
                tell application "Skype"<br />
                        set login to "luca.gibelli"<br />
                        set foo to send command "GET USER " &#038; login &#038; " ONLINESTATUS" script name "MyScript"<br />
                        set UserStatus to my GetPart(foo, 4, " ")<br />
                        if UserStatus is "ONLINE" then<br />
                                say "calling " &#038; login<br />
                                set Res to send command "CALL " &#038; login script name "MyScript"<br />
                                set CallId to my GetPart(Res, 2, " ")</p>
<p>                             copy (run script "tell application \"Finder\" to desktop's window's bounds") to bounds of window 1<br />
                                set MaxTries to 60<br />
                                set CallStatus to "unknown"<br />
                                repeat while (CallStatus is not "INPROGRESS" and CallStatus is not "REFUSED" and CallStatus is not "FAILED" and MaxTries > 0)<br />
                                        delay 1<br />
                                        set MaxTries to MaxTries - 1<br />
                                        set Res to send command "GET CALL " &#038; CallId &#038; " STATUS" script name "MyScript"<br />
                                        set CallStatus to my GetPart(Res, 4, " ")<br />
                                end repeat<br />
                                if CallStatus is "INPROGRESS" then<br />
                                        send command "ALTER CALL " &#038; CallId &#038; " START_VIDEO_SEND" script name "MyScript"<br />
                                end if<br />
                        else<br />
                                say login &#038; "offline!"<br />
                        end if<br />
                end tell<br />
        end tell</p>
<p>     return input</p>
<p>end run<br />
</code><br />
Of course I wanted to also enable video automatically when answering calls from specific contacts. Fortunately <a href="http://www.apple.com/downloads/macosx/email_chat/skypeextender.html">Skype Extender</a> does just that! </p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;count=horizontal&amp;text=Skype%20video%20call%20shortcut%20in%20MacOSX" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;count=horizontal&amp;text=Skype%20video%20call%20shortcut%20in%20MacOSX" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F11%2Fskype-video-call-shortcut&amp;title=Skype%20video%20call%20shortcut%20in%20MacOSX" id="wpa2a_4"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/11/skype-video-call-shortcut/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>DNAT and IP source routing woes</title>
<link>http://www.nervous.it/lang/en-us/2010/09/dnat-and-ip-source-routing-woes</link>
<comments>http://www.nervous.it/lang/en-us/2010/09/dnat-and-ip-source-routing-woes#comments</comments>
<pubDate>Thu, 23 Sep 2010 19:51:25 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=481</guid>
<description>
<![CDATA[I recently came across a nasty problem. I have a Linux box (let&#8217;s call it LinuxFW) with three ethernet ports: LAN: 192.168.0.1 connected to eth0 ADSL1: $IP1 connected to eth1 ADSL2: $IP2 connected to eth2 $IP1 and $IP2 are my public IP addresses. Their respective default gateways are $GW1 and $GW2. I use IP source [...]]]>
</description>
<content:encoded>
<![CDATA[<p>I recently came across a nasty problem.<br />
I have a Linux box (let&#8217;s call it LinuxFW) with three ethernet ports:</p>
<ul>
<li>LAN: 192.168.0.1 connected to eth0</li>
<li>ADSL1: $IP1 connected to eth1</li>
<li>ADSL2: $IP2 connected to eth2</li>
</ul>
<p>$IP1 and $IP2 are my public  IP addresses.<br />
Their respective default gateways are $GW1 and $GW2.</p>
<p>I use IP source routing to accept incoming connections from $IP1 and $IP2.<br />
This is the easy part: there is a lot of documentation (see <a href="http://www.lartc.org/howto/lartc.rpdb.html#LARTC.RPDB.SIMPLE">LARTC website</a> for the details) on how to do this, I&#8217;ll just sum it up here for completeness.</p>
<p><code><br />
ip route add default via $GW1 table adsl1<br />
ip rule add from $IP1 table adsl1<br />
ip route add default via $GW2 table adsl2<br />
ip rule add from $IP2 table adsl2<br />
ip route add default via $GW1</code><br />
<code><br />
echo 200        adsl1 &#62;&#62;/etc/iproute2/rt_tables<br />
echo 201        adsl2 &#62;&#62;/etc/iproute2/rt_tables</code></p>
<p>If somebody connects to $IP1 on port 22, LinuxFW receives packets on eth1 and outgoing packets are sent through eth1, thanks to the iproute2 rules mentioned above.<br />
Similarly, if somebody connects to $IP2 on port 22, packets enter from eth2 and exit from eth2.</p>
<p>So far so good. Now comes the hard part:</p>
<p>I added a new Linux box behind the old one, let&#8217;s call it LinuxMail. The new box has IP address 192.168.0.2 and is running Postfix. It&#8217;s connected to the same LAN switch that LinuxFW has on &#8220;eth0&#8243;.<br />
Obviously I could install a smtp proxy on LinuxFW and redirect all emails from LinuxFW to LinuxMail, but this poses some tread-offs, i.e.:</p>
<ul>
<li>LinuxMail won&#8217;t be able to see the IP addresses of incoming connections directly</li>
<li>LinuxMail won&#8217;t be able to do connection throttling</li>
<li>LinuxMail won&#8217;t be able to reject messages for non-existant accounts</li>
</ul>
<p>All these problems can be solved to some degree by introducing more logic on the smtp proxy of course, but let&#8217;s assume that we don&#8217;t want to do that, either because LinuxFW doesn&#8217;t have enough resources or because we want to keep things simple.<br />
There are three solutions to this problem.</p>
<span id="CTSTATE_DNAT"><h3>1 &#8211; CTSTATE DNAT</h3></span>
<pre>iptables -t nat -I PREROUTING -i eth1 -p tcp --dport 25 -j DNAT --to 192.168.0.2:25
iptables -t nat -I PREROUTING -i eth2 -p tcp --dport 25 -j DNAT --to 192.168.0.2:25
iptables -t nat -A PREROUTING -i eth1 -m conntrack --ctstate DNAT --ctorigdst $IP1 -j MARK --set-mark 0x6
iptables -t nat -A PREROUTING -i eth2 -m conntrack --ctstate DNAT --ctorigdst $IP2 -j MARK --set-mark 0x7</pre>
<p>All incoming packets with destination port 25 coming from either eth1 or eth2 will be redirected to 192.168.0.2 and marked respectively with &#8220;0&#215;6&#8243; and &#8220;0&#215;7&#8243;. These iproute2 rules will take care of routing the reply packets to the appropriate interface:</p>
<pre>ip rule add fwmark 6 table adsl1
ip rule add fwmark 7 table adsl2</pre>
<span id="CONNMARK"><h3>2 &#8211; CONNMARK</h3></span>
<p>Here is a simple way to open port 25 on both $IP1 and $IP2 and redirect incoming connections to LinuxMail using CONNMARK:</p>
<pre>iptables -t nat -I PREROUTING -i eth1 -p tcp --dport 25 -j DNAT --to 192.168.0.2:25
iptables -t nat -I PREROUTING -i eth2 -p tcp --dport 25 -j DNAT --to 192.168.0.2:25
iptables -t mangle -A PREROUTING -i eth1 -m state --state NEW,RELATED,ESTABLISHED -d $IP1 -p tcp --dport 25 -j CONNMARK --set-mark 6
iptables -t mangle -A PREROUTING -i eth0 -m connmark --mark 0x6 -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -i eth2 -m state --state NEW,RELATED,ESTABLISHED -d $IP2 -p tcp --dport 25 -j CONNMARK --set-mark 7
iptables -t mangle -A PREROUTING -i eth0 -m connmark --mark 0x7 -j CONNMARK --restore-mark</pre>
<p>Of course you will still need the usual:</p>
<pre>ip rule add fwmark 6 table adsl1
ip rule add fwmark 7 table adsl2</pre>
<span id="Double_IP_addresses"><h3>3 &#8211; Double IP addresses</h3></span>
<p>Another DIY solution is to assign a second private IP address to LinuxMail. In this scenario LinuxMail has the following IP addresses:</p>
<p>192.168.0.2</p>
<p>192.168.0.3</p>
<p>and LinuxFW redirects incoming connections from $IP1 to 192.168.0.2 and from $IP2 to 192.168.0.3:</p>
<pre>iptables -t nat -I PREROUTING -i eth1 -p tcp --dport 25 -j DNAT  --to 192.168.0.2:25
iptables -t nat -I PREROUTING -i eth2 -p tcp --dport 25 -j DNAT  --to 192.168.0.3:25
iptables -t mangle -I PREROUTING -i  eth0 -s 192.168.0.2 -p tcp -j MARK --set-mark 0x6
iptables -t mangle -I PREROUTING -i eth0 -s 192.168.0.3 -p tcp -j MARK --set-mark 0x7
</pre>
<p>Of course you will still need the usual:</p>
<pre>ip rule add fwmark 6 table adsl1
ip rule add fwmark 7 table adsl2</pre>
<p>Credits:</p>
<p>LARTC: <a href="http://lartc.org/howto/lartc.rpdb.html#LARTC.RPDB.SIMPLE">http://lartc.org/howto/lartc.rpdb.html#LARTC.RPDB.SIMPLE</a><br />
Pascal Hambourg: <a href="http://www.gossamer-threads.com/lists/iptables/user/68743#68743">http://www.gossamer-threads.com/lists/iptables/user/68743#68743</a><br />
Rodrigo Campos: <a href="http://www.mail-archive.com/lartc@mailman.ds9a.nl/msg16307.html">http://www.mail-archive.com/lartc@mailman.ds9a.nl/msg16307.html</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;count=horizontal&amp;text=DNAT%20and%20IP%20source%20routing%20woes" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;count=horizontal&amp;text=DNAT%20and%20IP%20source%20routing%20woes" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F09%2Fdnat-and-ip-source-routing-woes&amp;title=DNAT%20and%20IP%20source%20routing%20woes" id="wpa2a_6"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/09/dnat-and-ip-source-routing-woes/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>How to fix: Duplicity error 22: Invalid argument</title>
<link>http://www.nervous.it/lang/en-us/2010/08/duplicity-error-22-invalid-argument</link>
<comments>http://www.nervous.it/lang/en-us/2010/08/duplicity-error-22-invalid-argument#comments</comments>
<pubDate>Sat, 21 Aug 2010 10:26:03 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=461</guid>
<description>
<![CDATA[The latest version of duplicity which can run on RHEL 5 without too many dependency problems (available from Dag&#8217;s repository at http://packages.sw.be/duplicity/) has a nasty bug which results in the following error message: IOError: [Errno 22] Invalid argument Traceback (most recent call last): File "/usr/bin/duplicity", line 463, in ? with_tempdir(main) File "/usr/bin/duplicity", line 458, in [...]]]>
</description>
<content:encoded>
<![CDATA[<p>The latest version of duplicity which can run on RHEL 5 without too many dependency problems (available from Dag&#8217;s repository at <a href="http://packages.sw.be/duplicity/">http://packages.sw.be/duplicity/</a>) has a nasty bug which results in the following error message:</p>
<p>IOError: [Errno 22] Invalid argument</p>
<p><code><br />
Traceback (most recent call last):<br />
  File "/usr/bin/duplicity", line 463, in ?<br />
    with_tempdir(main)<br />
  File "/usr/bin/duplicity", line 458, in with_tempdir<br />
    fn()<br />
  File "/usr/bin/duplicity", line 444, in main<br />
    full_backup(col_stats)<br />
  File "/usr/bin/duplicity", line 155, in full_backup<br />
    bytes_written = write_multivol("full", tarblock_iter, globals.backend)<br />
  File "/usr/bin/duplicity", line 87, in write_multivol<br />
    globals.gpg_profile,globals.volsize)<br />
  File "/usr/lib64/python2.4/site-packages/duplicity/gpg.py", line 213, in GPGWriteFile<br />
    data = block_iter.next(bytes_to_go).data<br />
  File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 407, in next<br />
    result = self.process(self.input_iter.next(), size)<br />
  File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 487, in process<br />
    data, last_block = self.get_data_block(fp, size - 512)<br />
  File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 508, in get_data_block<br />
    buf = fp.read(read_size)<br />
  File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 338, in read<br />
    buf = self.infile.read(length)<br />
IOError: [Errno 22] Invalid argument<br />
</code></p>
<p>The problem can be easily fixed by changing line no. 507 from:</p>
<p><code>read_size = min(64*1024, max_size)</code></p>
<p>to:</p>
<p><code>read_size = min(64*1024, max(max_size, 512))</code></p>
<p>The problem also occurs if you forget to pass &#8220;&#8211;exclude /selinux&#8221; to duplicity.</p>
<p>More info <a href="http://www.mail-archive.com/duplicity-tracker@nongnu.org/msg00580.html">about the bug</a>.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;count=horizontal&amp;text=How%20to%20fix%3A%20Duplicity%20error%2022%3A%20Invalid%20argument" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;count=horizontal&amp;text=How%20to%20fix%3A%20Duplicity%20error%2022%3A%20Invalid%20argument" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fduplicity-error-22-invalid-argument&amp;title=How%20to%20fix%3A%20Duplicity%20error%2022%3A%20Invalid%20argument" id="wpa2a_8"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/08/duplicity-error-22-invalid-argument/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>Importare un&#8217;auto dalla Germania</title>
<link>http://www.nervous.it/lang/en-us/2010/08/importare-auto-dalla-germania</link>
<comments>http://www.nervous.it/lang/en-us/2010/08/importare-auto-dalla-germania#comments</comments>
<pubDate>Fri, 06 Aug 2010 17:53:32 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[funny]]>
</category>
<category>
<![CDATA[howto]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=443</guid>
<description>
<![CDATA[Questo post è per aiutare tutti quelli che intendono importare un&#8217;auto dalla Germania senza passare dal mercato parallelo, ovvero col fai-da-te. Vi voglio raccontare la mia esperienza con la burocrazia italiana giorno per giorno. Giorno 1 Seguendo i consigli del sito web dell&#8217;ACI, vado al PRA di La Spezia dove trovo una signora molto stizzita [...]]]>
</description>
<content:encoded>
<![CDATA[<p>Questo post è per aiutare tutti quelli che intendono importare un&#8217;auto dalla Germania senza passare dal mercato parallelo, ovvero col fai-da-te.</p>
<p>Vi voglio raccontare la mia esperienza con la burocrazia italiana giorno per giorno.</p>
<p><strong>Giorno 1</strong></p>
<p>Seguendo i consigli del sito web dell&#8217;ACI, vado al PRA di La Spezia dove trovo una signora molto stizzita che mi redarguisce sul fatto che tutta la documentazione che ho non serve a niente e che tutto quello che serve non ce l&#8217;ho. Aggiunge che l&#8217;auto va collaudata prima di fare qualunque pratica, quindi mi invita ad andare alla motorizzazione civile.</p>
<p>Vado alla motorizzazione civile, trovo un signore molto gentile che mi spiega che non serve nessun collaudo, che dispongo di tutta la documentazione necessaria. Mi consegna alcuni moduli da compilare e mi dà tutte le indicazioni del caso. Quando gli riferisco quanto dettomi dalla signora del PRA comincia a preoccuparsi. Mi spiega che la motorizzazione dovrà inviare il modulo NP2B, la fattura d&#8217;acquisto e il libretto dell&#8217;auto redatto secondo la legislazione italiana al PRA, in modo che il PRA possa rilasciare il CdP (Certificato di proprietà del veicolo). Tuttavia non è sicuro che al PRA tale documentazione sia sufficiente e pertanto mi invita a tornare al PRA per avere una conferma.<br />
Nel frattempo, l&#8217;ufficio del PRA ha chiuso. Se ne riparla domani.</p>
<p><strong>Giorno 2</strong></p>
<p>Vado al PRA, dopo una coda immensa circondato da cittadini infuriati con Equitalia per delle multe pazze, arriva il mio turno. Spiego che ieri sono stato rimbalzato dal PRA alla motorizzazione e dalla motorizzazione al PRA e chiedo se la documentazione indicatami dalla motorizzazione sia sufficiente al PRA per rilasciare il CdP.<br />
Vengo messo in attesa in un angolino in quanto la persona che segue questo tipo di pratiche è impegnata a giocare a Solitario nel retro dell&#8217;ufficio.</p>
<p>Durante l&#8217;attesa noto con meraviglia che il terminale per rilasciare feedback sulla prestazione ricevuta dallo sportello <a href="http://www.camcomtaranto.gov.it/Pagine/MettiamociLaFaccia/Mettiamoci%20la%20faccia_sito.htm">voluto dal ministro Brunetta</a> è spento e che lì accanto campeggia un bel foglio con stampati i feedback ricevuti durante il mese precedente: un totale di 18 feedback, 100% positivi. Un po&#8217; sospetto.</p>
<p>Dopo più di 30 minuti e quando ormai è l&#8217;ora di chiusura dell&#8217;ufficio, il giocatore incallito con aria scocciata si degna di considerarmi. Il suo collega gentilmente gli spiega la situazione e quello guarda con fare scocciato i fogli che gli porgo. Mi dice subito che il contratto di acquisto senza firma del venditore autenticata dal notaio non serve a niente. Gli spiego che non avevo a disposizione un notaio in Germania e per tutta risposta borbottando tra sè e sè sparisce.<br />
Torna dopo cinque minuti e mi dice che va tutto bene (?) a parte il fatto che manca il numero di partita IVA del venditore (chiamata UST-id in Germania) e la traduzione giurata in italiano del contratto di acquisto.<br />
Chiedo se posso usufruire del servizio di un traduttore qualunque oppure se devo rivolgermi a un traduttore ufficiale e di nuovo con fare molto scocciato mi risponde che devo andare al tribunale di La Spezia e cercare un traduttore lì.</p>
<p>Si è fatto tardi e il tribunale ha già chiuso al pubblico, ma decido di fare comunque un tentativo. Dopo aver vagato per una decina di minuti tra i corridoi infiniti del tribunale, finisco di fronte alla porta dell&#8217;ufficio URP sul quale campeggia un cartello enorme con su scritto in stampatello: &#8220;QUI NON SI EFFETTUANO TRADUZIONI&#8221;.<br />
Chiedo spiegazioni ad alcuni dei pochi impiegati rimasti durante la pausa pranzo e la risposta che ottengo è la seguente: &#8220;Sei già il secondo che viene spedito qua oggi dal PRA per avere una traduzione, noi non facciamo traduzioni! Non so perchè diano queste indicazioni sbagliate. Devi trovare un traduttore e poi il traduttore deve venire in tribunale a giurare che la traduzione sia fedele. Il nostro ruolo si limita a quello&#8221;. Esattamente l&#8217;opposto di quanto riferitomi dal PRA.<br />
Ringrazio per la gentile spiegazione e comincio a fare un giro di telefonate e alcune ricerche su Internet per trovare un libero professionista che offra il servizio di traduzione giurata/asseverata.</p>
<p>Prendo contatti con alcuni di loro e mi faccio fare alcuni preventivi.</p>
<p>Anche oggi si è fatto tardi. Trascorro il resto della giornata a cercare l&#8217;UST-id del venditore su Internet dato che al telefono non risponde. Con l&#8217;aiuto di un mio amico tedesco riesco a trovarlo.</p>
<p><strong>Giorno 3</strong></p>
<p>Trovo una traduttrice disposta a farmi la traduzione giurata con la massima urgenza. Le invio copia del contratto d&#8217;acquisto via e-mail. Ci accordiamo per 120 € iva inclusa e ci diamo appuntamento per Martedì mattina (oggi è Sabato) per la consegna dei documenti già corredati di traduzione giurata autenticata in Tribunale. </p>
<p><strong>Giorno 4</strong></p>
<p>Approfitto del weekend per compilare i moduli TT2119 e NP2B.</p>
<p>Nel modulo TT2119 inserisco i miei dati personali e i dati del veicolo, lasciando vuoto il campo codice veicolo. Copio il numero di omologazione dal <em>Certificato di conformità (COC)</em> alla voce &#8220;mit dem unter der EG-Genehmigungs Nr&#8221;.</p>
<p>Nel modulo NP2B compilo solo i riquadri A, B, M, R, S e all&#8217;interno del riquadro P inserisco solamente data, forma e prezzo, come indicatomi al PRA.</p>
<p><strong>Giorno 5 e 6</strong></p>
<p>Riposo</p>
<p><strong>Giorno 7</strong></p>
<p>Martedì mattina vado a ritirare la traduzione giurata del contratto d&#8217;acquisto, dopodichè mi reco all&#8217;ufficio della  Motorizzazione con:</p>
<ul>
<li>traduzione giurata del contratto di acquisto</li>
<li>modulo NP2B debitamente compilato</li>
<li>modulo TT2119 debitamente compilato</li>
<li>2 fotocopie della mia carta d&#8217;identità</li>
<li>Dichiarazione sostitutiva della certificazione di residenza (questo perchè la mia carta d&#8217;identità riporta un indirizzo di residenza non aggiornato)</li>
<li>2 fotocopie del mio codice fiscale</li>
<li>Certificato di conformità (COC)</li>
<li>ZULASSUNGSBESCHEINIGUNG TEIL I e II</li>
<li>ricevute dei quattro versamenti CCP effettuati: imposta di bollo 29,24 €, IPT 514,16 €, acquisto targhe 39,71 €, diritti 9 €</li>
</ul>
<p>Riporto all&#8217;impiegato quanto dettomi dal PRA e quello rassicurato prende il mio fascicolo, si segna il mio numero di cellulare e mi dice che verrò richiamato tra circa una settimana. Se non dovessi ricevere alcuna chiamata, dovrò farmi vivo io.</p>
<p><strong>Giorno 13</strong></p>
<p>Sono trascorsi sei giorni. Alle 8:30am in punto mi arriva una telefonata dalla Motorizzazione per comunicarmi che il libretto provvisorio e le targhe sono pronte. Corro alla motorizzazione e dopo una breve attesa ritiro il tutto.<br />
L&#8217;impiegato mi spiega che il libretto provvisorio è valido per massimo 60 giorni e che quello definitivo sarà pronto tra circa 15 giorni. Una volta ottenuto il libretto definitivo dovrò recarmi al PRA con il nuovo libretto, il modulo NP2B e la traduzione giurata del contratto di vendita in modo che possano prepararmi il <em>certificato di proprietà</em>.<br />
Mi riconsegna il modulo NP2B e il contratto con la traduzione cosiccome io l&#8217;avevo consegnato a lui una settimana fa e ci salutiamo. Ma non doveva pensarci la motorizzazione a spedirlo al PRA?</p>
<p>Tornato a casa mi accingo a montare le targhe e subito mi accorgo di un piccolo problema: le targhe anteriori in Italia sono più piccole di quelle posteriori, in Germania invece sono identiche alle posteriori!<br />
Provo a montarle ugualmente in modo posticcio. Chissà se posso montare un portatarga più piccolo senza dover forare la carrozzeria.</p>
<p>Stando a quanto riferitomi alla Motorizzazione mi manca solo una cosa per poter circolare: l&#8217;assicurazione.<br />
Faccio un paio di preventivi su <a href="http://www.assicurazione.it">www.assicurazione.it</a> e poi ne acquisto una di slancio (quixa). Pago con carta di credito e dopo pochi minuti ho nella mia email il tagliandito da stampare, ritagliare e apporre sul parabrezza della mia auto. L&#8217;assicurazione sarà valida dalle ore 24:00 di domani, questo vuol dire che devo aspettare ancora 36h prima di poter guidare la mia nuova auto. Che efficienza :) Non mi sembra vero.</p>
<p><strong>Giorno 15</strong></p>
<p>È il periodo di ferragosto e sono tutti in ferie. Dopo numerose telefonate trovo finalmente un carrozziere in possesso di un portatarghe anteriore. Me la cavo con 10€ <sic>.</p>
<p><strong>Giorno 35</strong></p>
<p>È giunto il momento di andare a ritirare il libretto definitivo. Torno alla motorizzazione civile, presento il libretto provvisorio e mi viene consegnato quello definitivo.<br />
Corro al PRA per presentare il modello NP2B. Attendo per l&#8217;ennesima volta l&#8217;esaurirsi dell&#8217;interminabile coda ed ecco presentarsi l&#8217;ennesimo problema.<br />
L&#8217;impiegata si meraviglia che alla motorizzazione mi abbiano fatto il libretto senza che io abbia compilato il riquadro T e mi dice che devo assolutamente compilarlo. Spiego che l&#8217;impiegato del PRA con il quale avevo parlato poco più di due settimane fa mi aveva specificatamente indicato di lasciarlo vuoto e ottengo di tutta risposta una scrollata di spalle.<br />
L&#8217;impiegata esamina il resto della documentazione e mi fa presente che manca la copia conforme del libretto di circolazione tedesco.<br />
Faccio notare che quando la motorizzazione mi aveva chiesto di andare a chiedere al PRA di quale documentazione avessero bisogno, non mi era stato detto che tale documento fosse necessario. Altra scrollata di spalle.<br />
Si è fatto tardi, ormai la motorizzazione è chiusa. Riproverò l&#8217;indomani.</p>
<p><strong>Giorno 36</strong></p>
<p>Vado di prima mattina alla motorizzazione civile. Riporto quanto dettomi dal PRA ovvero: il riquadro T va compilato e manca la copia conforme del libretto di circolazione tedesco.<br />
Con aria tra lo scocciato e il compassionevole, l&#8217;impiegato della motorizzazione riempie nervosamente il riquadro T e in pochi minuti mi prepara la copia conforme del libretto di circolazione tedesco.<br />
Mi reco al PRA e consegno tutta la documentazione. Vengo spedito per la prima volta in un ufficio interno e qui sorge un nuovo problema: il sistema non riconosce il numero di omologazione dell&#8217;auto, nonostante si tratti di una autovettura tedesca normalissima, identica a quella commercializzata in Italia. L&#8217;impiegata apre un ticket di supporto con il gestore del sistema e incredibilmente dopo appena 10 minuti il numero di omologazione viene riconosciuto. A questo punto vengo rispedito allo sportello del PRA al quale mi ero recato inizialmente e dopo varie stampe e firme vengo rispedito nuovamente all&#8217;ufficio interno dove dopo una breve attesa mi viene finalmente consegnato il Certificato di Proprietà (CdP) !</p>
<p>Che impresa :)</p>
<p>Bibliografia:<br />
<a href="http://www.aci.it/sezione-istituzionale/per-circolare/guida-pratiche-auto/importare-un-veicolo.html">http://www.aci.it/sezione-istituzionale/per-circolare/guida-pratiche-auto/importare-un-veicolo.html</a><br />
<a href="http://sosonline.aduc.it/scheda/acquistare+veicolo+all+estero_14732.php">http://sosonline.aduc.it/scheda/acquistare+veicolo+all+estero_14732.php</a><br />
<a href="http://forums.ebay.it/thread.jspa?threadID=500004342">http://forums.ebay.it/thread.jspa?threadID=500004342</a><br />
<a href="http://www.consinfo.eu/help/libretto-circolazione-norme-euro">http://www.consinfo.eu/help/libretto-circolazione-norme-euro</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;count=horizontal&amp;text=Importare%20un%26%238217%3Bauto%20dalla%20Germania" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;count=horizontal&amp;text=Importare%20un%26%238217%3Bauto%20dalla%20Germania" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F08%2Fimportare-auto-dalla-germania&amp;title=Importare%20un%26%238217%3Bauto%20dalla%20Germania" id="wpa2a_10"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/08/importare-auto-dalla-germania/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>HUAWEI K3765 and Fonera 2.0N</title>
<link>http://www.nervous.it/lang/en-us/2010/06/huawei-k3765-and-fonera-20n</link>
<comments>http://www.nervous.it/lang/en-us/2010/06/huawei-k3765-and-fonera-20n#comments</comments>
<pubDate>Tue, 22 Jun 2010 09:33:08 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[hw support]]>
</category>
<category>
<![CDATA[2.0]]>
</category>
<category>
<![CDATA[3g]]>
</category>
<category>
<![CDATA[fon]]>
</category>
<category>
<![CDATA[fonera]]>
</category>
<category>
<![CDATA[huawei]]>
</category>
<category>
<![CDATA[k3765]]>
</category>
<category>
<![CDATA[usb modem]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=414</guid>
<description>
<![CDATA[Recently my ISP has been acting up, so I decided to setup a &#8220;backup&#8221; Internet connection that I can activate by simply plugging a USB stick into my Fonera 2.0N router. Unfortunately my HUAWEI K3765 3G modem is not compatible with Fonera 2.0N wifi router out of the box, at least not with the current [...]]]>
</description>
<content:encoded>
<![CDATA[<p>Recently my ISP has been acting up, so I decided to setup a &#8220;backup&#8221; Internet connection that I can activate by simply plugging a USB stick into my Fonera 2.0N router.<br />
<a href="http://cdn.nervous.it/wp-content/uploads/2010/06/2010-11.35.06.jpg"><img class="alignnone" title="fonera and huawei k3765" src="http://cdn3.nervous.it/wp-content/uploads/2010/06/2010-11.35.06-300x225.jpg" alt="fonera and huawei k3765" width="300" height="225" /></a><br />
Unfortunately my HUAWEI K3765 3G modem is not compatible with Fonera 2.0N wifi router out of the box, at least not with the current stable version of the firmware (2.3.6.0 aka Gari the Hummingbird).</p>
<p>Here is what I had to do to make the USB modem work with Fonera 2.0N:</p>
<ul>
<li>for some crazy reason, my 3G modem refuses to work on Fonera 2.0N if there are some SMS stored on it. Plug the 3G modem into your PC and remove any SMS you may have received. YMMV.</li>
<li>upgrade your Fonera 2.0N to the latest 2.3.6.0 firmware, <a href="http://wiki.fon.com/wiki/Fon-ng:_Get_Involved#Developer_Mode">choosing  the &#8220;developer&#8221; image</a>. You need the developer version to ssh into  your Fonera 2.0N.</li>
<li>ssh into your Fonera 2.0N router.</li>
<li>edit /etc/config/umtsd:</li>
</ul>
<pre>config 'umtsd' 'umtsd'
 option '_country' '_custom'
 option 'apn' 'replacewithyourapn'
config 'umtsdstate' 'umtsdstate'
config 'umtsdevice' 'option12D11465'
 option 'vendor' 'Huawei'
 option 'device' 'K3765'
 option 'data' '/dev/ttyUSB0'
<a href="http://cdn.nervous.it/wp-content/uploads/2010/06/2010-11.35.06.jpg">
</a> option 'cmd' '/dev/ttyUSB0'</pre>
<ul>
<li>plug the HUAWEI K3765 into the Fonera 2.0N router</li>
<li>wait a few seconds and then run:
<pre>echo "0x12d1 0x1465" &#62;/sys/bus/usb-serial/drivers/option1/new_id</pre>
</li>
</ul>
<p>Visit <a href="http://fonera/luci/fon_devices/fon_umts">http://fonera/luci/fon_devices/fon_umts</a> and check the status of your 3G modem.</p>
<p>If it still doesn&#8217;t work, you may have to follow the instructions provided by <a href="http://www.ovada.it/rubriche/90-tecnologia/341-configurare-fonera-20n-con-chiavetta-umts-huawei-3765-vodafone.html">stex1967</a>:</p>
<p>Create the file /etc/usb-modeswitch.conf with the following content:<br />
<code><br />
DefaultVendor= 0x12d1<br />
DefaultProduct= 0x1520<br />
TargetVendor= 0x12d1<br />
TargetProduct=0x1465<br />
MessageContent="55534243123456780000000000000011060000000000000000000000000000"<br />
</code></p>
<p>Also create the file /etc/rc.d/k3765:</p>
<p><code><br />
#!/bin/sh /etc/rc.common<br />
START=90<br />
usb_modeswitch<br />
sec=2<br />
sleep $sec<br />
echo "0x12d1 0x1465" >/sys/bus/usb-serial/drivers/option1/new_id<br />
</code></p>
<p>Finally run:</p>
<p><code><br />
chmod 755 /etc/init.d/k3765<br />
/etc/init.d/k3765 enable<br />
</code></p>
<p>and reboot. Thumbs up! </p>
<p>An updated list of supported 3G USB modems is available at <a href="http://wiki.fon.com/wiki/3G_compatibility">http://wiki.fon.com/wiki/3G_compatibility</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;count=horizontal&amp;text=HUAWEI%20K3765%20and%20Fonera%202.0N" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;count=horizontal&amp;text=HUAWEI%20K3765%20and%20Fonera%202.0N" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fhuawei-k3765-and-fonera-20n&amp;title=HUAWEI%20K3765%20and%20Fonera%202.0N" id="wpa2a_12"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/06/huawei-k3765-and-fonera-20n/feed</wfw:commentRss>
<slash:comments>13</slash:comments>
</item>
<item>
<title>Vodafone Mobile Connect: HUAWEI K3765</title>
<link>http://www.nervous.it/lang/en-us/2010/06/disable-autoplay-huawei-k3765</link>
<comments>http://www.nervous.it/lang/en-us/2010/06/disable-autoplay-huawei-k3765#comments</comments>
<pubDate>Sun, 13 Jun 2010 12:41:49 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[hw support]]>
</category>
<category>
<![CDATA[Uncategorized]]>
</category>
<category>
<![CDATA[auto play]]>
</category>
<category>
<![CDATA[huawei]]>
</category>
<category>
<![CDATA[k3765]]>
</category>
<category>
<![CDATA[macosx]]>
</category>
<category>
<![CDATA[vodafone]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=409</guid>
<description>
<![CDATA[I recently purchased a HUAWEI K3765 HSDPA modem with Vodafone brand. It&#8217;s possible to use to this USB stick with any operator, by simply downloading the Mobile Connect software from HUAWEI (just google for it). There is no need to flash a new firmware on it, just uninstall the Vodafone Mobile Connect software and replace [...]]]>
</description>
<content:encoded>
<![CDATA[<p>I recently purchased a HUAWEI K3765 HSDPA modem with Vodafone brand. It&#8217;s possible to use to this USB stick with any operator, by simply downloading the Mobile Connect software from HUAWEI (just google for it).</p>
<p>There is no need to flash a new firmware on it, just uninstall the Vodafone Mobile Connect software and replace it with the standard one from HUAWEI: you will be able to configure the software to use any APN you like.</p>
<p>You&#8217;ll still experience a small glitch though, at least under MacOSX: everytime you plug the modem into the USB port, you will see a popup asking you to install Vodafone Mobile Connect.</p>
<p>There is a simple solution to this problem:</p>
<ul>
<li>find out the UUID of your USB stick: diskutil info /Volumes/Vodafone\ Mobile\ Broadband/ &#124; grep UUID</li>
<li>create a new entry for this disk in /etc/fstab with the <em>noauto</em> flag turned on:
<ul>
<li>open /etc/fstab in your favourite editor (create it if it doesn&#8217;t exist yet): sudo vi /etc/fstab</li>
<li>add a line like the following to /etc/fstab:<br />
UUID=A46AA80A-97B9-3B47-91A4-8128A9458A31 none hfs rw,noauto 0 0</li>
</ul>
</li>
</ul>
<p>Replace the UUID with your own UUID.</p>
<p>Thumbs up! Now unplug your USB stick and plug it again: no annoying popup this time!</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;count=horizontal&amp;text=Vodafone%20Mobile%20Connect%3A%20HUAWEI%20K3765" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;count=horizontal&amp;text=Vodafone%20Mobile%20Connect%3A%20HUAWEI%20K3765" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F06%2Fdisable-autoplay-huawei-k3765&amp;title=Vodafone%20Mobile%20Connect%3A%20HUAWEI%20K3765" id="wpa2a_14"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/06/disable-autoplay-huawei-k3765/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>Per-user spam folder with Amavisd-new, Postfix+MySQL, virtual users, Dovecot</title>
<link>http://www.nervous.it/lang/en-us/2010/03/amavisd-and-per-user-spam-folder</link>
<comments>http://www.nervous.it/lang/en-us/2010/03/amavisd-and-per-user-spam-folder#comments</comments>
<pubDate>Mon, 29 Mar 2010 15:15:04 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[dovecot]]>
</category>
<category>
<![CDATA[imap]]>
</category>
<category>
<![CDATA[lda]]>
</category>
<category>
<![CDATA[local delivery agent]]>
</category>
<category>
<![CDATA[maia]]>
</category>
<category>
<![CDATA[mailzu]]>
</category>
<category>
<![CDATA[mysql]]>
</category>
<category>
<![CDATA[postfix]]>
</category>
<category>
<![CDATA[sieve]]>
</category>
<category>
<![CDATA[spamassassin]]>
</category>
<category>
<![CDATA[virtual]]>
</category>
<category>
<![CDATA[virtual transport]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=376</guid>
<description>
<![CDATA[Long story short This is a short summary for those who don&#8217;t need a pedantic step by step guide. If you want to know all the details, you should skip to the next section. My objective is to deliver all spam messages to a dedicated IMAP folder called &#8220;spam&#8221;. This way my users can easily [...]]]>
</description>
<content:encoded>
<![CDATA[<div class='toc wptoc'>
<h2>Contents</h2>
<ol class='toc-odd level-1'>
        <li>
                <a href="#Long_story_short">Long story short</a>
        </li>
        <li>
                <a href="#Short_story_long">Short story long</a>
                <ol class='toc-even level-2'>
                        <li>
                                <a href="#The_problem_with_filtering_spam">The problem with filtering spam</a>
                        </li>
                        <li>
                                <a href="#Premises">Premises</a>
                        </li>
                        <li>
                                <a href="#The_big_picture">The big picture</a>
                        </li>
                        <li>
                                <a href="#Howto">Howto</a>
                                <ol class='toc-odd level-3'>
                                        <li>
                                                <a href="#Postfix">Postfix</a>
                                        </li>
                                        <li>
                                                <a href="#Dovecot">Dovecot</a>
                                        </li>
                                        <li>
                                                <a href="#Amavisd-new">Amavisd-new</a>
                                        </li>
                                </ol>
                        <li>
                                <a href="#Purging_old_spam_messages">Purging old spam messages</a>
                        </li>
                        <li>
                                <a href="#Conclusions">Conclusions</a>
                                <ol class='toc-odd level-3'>
                                        <li>
                                                <a href="#Bibliography">Bibliography</a>
                                        </li>
</ol>
</ol>
</ol>
</ol>
</div>
<div class='wptoc-end'>&nbsp;</div>
<span id="Long_story_short"><h2>Long story short</h2></span>
<p>This is a short summary for those who don&#8217;t need a pedantic step by step guide. If you want to know all the details, you should skip to the next section.</p>
<p>My objective is to deliver all spam messages to a dedicated IMAP folder called &#8220;spam&#8221;. This way my users can easily fetch messages which get erroneously identified as spam. Here is how I did it.</p>
<p>I configured Amavisd-new to deliver spam messages to a specific address extension (e.g. user+spam@domain.tld) using the $addr_extension_spam directive. Here I had my first problem: Amavisd-new ignores this directive for all domains which are not considered local. Therefore you have to tell Amavisd-new which domains are local or the whole thing WON&#8217;T WORK.</p>
<p>You have two options:</p>
<ul>
<li>statically define the list of local domains using @local_domains_acl</li>
<li>if your account information is stored in MySQL database, tell Amavisd-new to fetch the list of local domains using a SQL query, like the following: $sql_select_policy = &#8216;SELECT &#8220;Y&#8221; as local FROM domain WHERE CONCAT(&#8220;@&#8221;,domain) IN (%k)&#8217;;</li>
</ul>
<p>Next step is to configure the LDA (Local Delivery Agent) to deliver all messages with a specific address extension to a specific subfolder of the respective mailbox. This can be achieved by changing the LDA used by Postfix from Postfix itself to something which allows for rule filtering like <strong>procmail, maildrop or Dovecot</strong>.</p>
<p>If your mailboxes are also &#8220;system accounts&#8221;, you should stick to procmail or maildrop, which are fairly easy to setup. For example, with procmail you would use:</p>
<p>mailbox_command = procmail -a &#8220;$EXTENSION&#8221;</p>
<p>and then setup a .procmailrc which delivers mails for messages matching <em>ARG ?? ^^spam^^</em> to a specific subfolder.</p>
<p>If you have a virtual users setup this gets tricky. The directive which defines the LDA for virtual accounts in main.cf is <em>virtual_transport</em>.</p>
<p>In a virtual users setup which relies on a MySQL backend, the easiest LDA to configure is Dovecot. We have to create a new &#8220;transport&#8221; inside master.cf like this:</p>
<p>dovecot      unix    -    n    n    -    -    pipe<br />
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension}</p>
<p>And then reference it inside main.cf using the aforementioned virtual_transport directive (virtual_transport = dovecot).</p>
<p>Finally you must enable the sieve plugin in the lda section of dovecot.conf:</p>
<pre>sieve_global_path = /var/lib/sieve/default.sieve
mail_plugins = cmusieve</pre>
<p>and create the default.sieve script with the following content:</p>
<pre>if envelope :detail "to" "spam"{
 fileinto "spam";
}</pre>
<p>That&#8217;s all folks!</p>
<span id="Short_story_long"><h2>Short story long</h2></span>
<p>Here is an exhaustive description of this setup, with many useful hints to solve common problems.</p>
<span id="The_problem_with_filtering_spam"><h3>The problem with filtering spam</h3></span>
<p>Filtering spam is a endless battle. Spam filters are prone to false positives and SpamAssassin is no  exception.</p>
<p>That&#8217;s why we usually configure our mail servers to quarantine spam messages, instead of rejecting/deleting them.</p>
<p>Here comes what I usually refer to as &#8220;the quarantine problem&#8221;.</p>
<p>Unfortunately most content filters tend to put all quarantined messages in a single directory which can only be accessed by the sysadmin. Then sysadmins get hammered by questions like this all the time: &#8220;I didn&#8217;t receive the e-mail from XYZ, can you check if it&#8217;s been quarantined by the spam filter?&#8221;</p>
<p>Users are angry because they have to wait to receive their &#8220;very-important&#8221; email, sysadmins are angry because they have to waste their time on a monkey activity. Nobody likes the &#8220;quarantine spam messages in a single directory&#8221; strategy.</p>
<p>Many solutions have been proposed to allow users to retrieve spam messages from the quarantine directory by themselves: the most successful was Maia Mailguard (<a href="http://www.maiamailguard.com/maia/wiki" target="_blank">http://www.maiamailguard.com/maia/wiki</a>), which is now replaced by MailZu (<a href="http://sourceforge.net/projects/mailzu/" target="_blank">http://sourceforge.net/projects/mailzu/</a>).</p>
<p>Unfortunately all these solutions are quite clumsy to setup, they do not scale very well and they can be a pain to maintain.</p>
<p>Content filters also allow to only tag messages as spam, and deliver them to the user&#8217;s mailbox together with regular messages, but users don&#8217;t like this solution for two reasons:</p>
<ul>
<li>they have to download spam messages anyway (which can be expensive when roaming)</li>
<li>they have to setup filters on their MUAs to store spam messages in a separate folder (which can be difficult to do on mobiles)</li>
</ul>
<p>There is a simple solution to &#8220;the quarantine problem&#8221; which exploits the power of IMAP to have different folders in a single mailbox.</p>
<p>Here is the strategy we are going to adopt in this article:</p>
<ul>
<li>the first time a user accesses his mailbox via IMAP, a new folder called &#8220;INBOX.spam&#8221; is created.</li>
<li>whenever a message is tagged as spam, it&#8217;s delivered to the address: user+spam@domain.tld instead of user@domain.tld</li>
<li>if the subfolder INBOX.spam exists, the messages is stored under INBOX.spam instead of INBOX. If the subfolder doesn&#8217;t exist, the message is delivered to INBOX.</li>
<li>messages in the INBOX.spam folder older than 60 days are automatically deleted.</li>
</ul>
<p>If the user wants to check whether his very-important email was marked as spam, he can just open the Spam folder and try to find it. Normally he won&#8217;t need to download spam messages.</p>
<p>If he is using only POP3 to access his email, this &#8220;quarantine&#8221; system won&#8217;t be activated and he&#8217;ll have to rely on his MUA&#8217;s filters to store the spam in a separate folder.</p>
<p>Alternatively, the sysadmin can provide him with a webmail which uses the IMAP protocol.</p>
<span id="Premises"><h3>Premises</h3></span>
<p>In this howto we assume to be running the following software:</p>
<ul>
<li>MTA: Postfix with virtual users served off a MySQL database</li>
<li>LDA: Dovecot delivery agent with sieve plugin</li>
<li>POP3/IMAP: Dovecot</li>
<li>Content filter: Amavisd-new</li>
<li>Spam filter: SpamAssassin</li>
</ul>
<p>Configuring Postfix for virtual users stored in a MySQL database is out of the scope of this howto. There is plenty literature available on Postfix Website (<a href="http://www.postfix.org/docs.html" target="_blank">http://www.postfix.org/docs.html</a>) and official documentation (<a href="http://www.postfix.org/MYSQL_README.html" target="_blank">http://www.postfix.org/MYSQL_README.html</a>).</p>
<p>The integration of Amavisd-new into Postfix is trivial as well and there are already plenty of howtos available.</p>
<p>Finally we assume Dovecot is already configured to authenticate users using the MySQL database. Many howtos already describe how to implement this and it&#8217;s also described in the official documentation of Dovecot (<a href="http://wiki.dovecot.org/AuthDatabase/SQL" target="_blank">http://wiki.dovecot.org/AuthDatabase/SQL</a>).</p>
<p>We shall assume that you have a working setup with virtual domains stored on MySQL database.</p>
<span id="The_big_picture"><h3>The big picture</h3></span>
<p>Here is how the whole thing is going to work:</p>
<ol>
<li>an email comes in, via SMTP</li>
<li>Postfix check if the mailbox exists and passes it to Amavisd-new</li>
<li>Amavisd-new checks if the email is spam. Then it checks if the recipient of the email is a local domain or not. If <strong>both</strong> conditions are <strong>true</strong>, then the message recipient address (user@domain.tld) is replaced with user+spam@domain.tld. In all other cases (e.g. if domain.tld is not a local domain) the recipient address is left untouched.</li>
<li>Amavisd-new passes the email back to Postfix</li>
<li>Postfix passes the email to the LDA. As reported in the &#8220;Premises&#8221; paragraph, in our case Dovecot acts also as a LDA, not only as POP3/IMAP server!</li>
<li>Dovecot uses the <strong>default</strong> <strong>sieve </strong>rules to decide where to store the message. If the recipient of the message contains a &#8220;spam&#8221; extention (like in the case of user+spam@domain.tld) and the INBOX.spam subfolder exists, then the message is delivered to user@domain.tld under then INBOX.spam subfolder. In all other cases (that is if the recipient is user@domain.tld or INBOX.spam doesn&#8217;t exist) the message is delivered to INBOX.</li>
</ol>
<span id="Howto"><h3>Howto</h3></span>
<span id="Postfix"><h4>Postfix</h4></span>
<p>You will then need to change the following lines in /etc/postfix/main.cf:</p>
<pre>mailbox_command = /usr/lib/dovecot/deliver
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
recipient_delimiter = +</pre>
<p>and add the following line to /etc/postfix/master.cf:</p>
<pre>dovecot      unix    -    n    n    -    -    pipe
 flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension}
</pre>
<p>This is needed to make Postfix use Dovecot as the LDA. We need to switch to Dovecot as LDA because it has support for <strong>sieve</strong> rules. Using these rules we can decide in which folder to store a message based on a certain condition.</p>
<span id="Dovecot"><h4>Dovecot</h4></span>
<p>We have to tell Dovecot to automatically create the subfolder &#8220;Spam&#8221; on the first time the user accesses the mailbox via IMAP. For this we need to enable the <em>autocreate</em> plugin:</p>
<pre>protocol imap {
 mail_plugins = quota imap_quota autocreate
}

plugin {
 autocreate = spam
 autosubscribe = spam
}
</pre>
<p>Next step is to enable the <em>cmusieve</em> plugin and configure Dovecot to apply a special rule to all messages processed by the delivery agent (LDA):</p>
<pre>protocol lda {
 sieve_global_path = /var/lib/sieve/default.sieve
postmaster_address = &lt;postmaster-address&gt;
 auth_socket_path = /var/run/dovecot/auth-master
 mail_plugins = quota cmusieve
 sendmail_path = /usr/sbin/sendmail
}
</pre>
<p>In our case the filtering rule is stored inside /var/lib/sieve/default.sieve:</p>
<pre>require ["fileinto", "envelope", "subaddress"];
if envelope :detail "to" "spam"{
 fileinto "spam";
}
</pre>
<p>Be aware that the file /var/lib/sieve/default.sieve is compiled by Dovecot the first time it&#8217;s used. Dovecot must store the binary version of this file (/var/lib/sieve/default.sievec) in the same dir as the script so it requires write access to the directory /var/lib/sieve/.</p>
<p>Dovecot delivery agent is called by Postfix and Postfix uses the uid/gid specified in /etc/postfix/main.cf to run it. In my case this is uid 2000 / gid 2000. Check your main.cf for the correct values, look for the lines:</p>
<pre>virtual_uid_maps = static:&lt;UID&gt;
virtual_gid_maps = static:&lt;GID&gt;</pre>
<p>Then make sure that /var/lib/sieve/ is owned by the same uid/gid specified above. If everything is ok, when the first email comes in, Dovecot will create a new file called /var/lib/sieve/<strong>default.sievec</strong>.</p>
<p>You can check the syntax of the file default.sieve on this nice online sieve compiler: <a href="http://libsieve-php.exit0.net/" target="_blank">http://libsieve-php.exit0.net/</a>.</p>
<span id="Amavisd-new"><h4>Amavisd-new</h4></span>
<p>Depending on the distro you are using, your Amavisd-new config file can come as a single config. file called amavisd.conf or multiple small config files which are loaded sequentially.</p>
<p>In my case I&#8217;m using Debian Lenny and I store all my customized Amavisd-new settings inside /etc/amavis/conf.d/50-user .</p>
<p>Here is what must be modified in the standard Amavisd-new configuration:</p>
<pre>$sa_tag_level_deflt  = 5.0;  # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 7.31; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 10.31; #10.31; # triggers spam evasive actions
$sa_dsn_cutoff_level = 15;  # spam level beyond which a DSN is not sent
$sa_spam_report_header = 1;
@addr_extension_spam_maps       = ('spam');
$replace_existing_extension = 1;        # (default is false)
$recipient_delimiter = '+';
@lookup_sql_dsn =
 ( ['DBI:mysql:database=yourpostfixdb;host=127.0.0.1;port=3306', 'yourpostfixuser', 'yourpass'] );
$sql_select_policy = 'SELECT "Y" as local FROM domain WHERE CONCAT("@",domain) IN (%k)';
$localpart_is_case_sensitive = 0;        # (default is false)
$final_spam_destiny       = D_PASS;
</pre>
<p><span style="color: #ff0000;">Note  for SysCP users: if you are running SysCP the correct query is SELECT  &#8220;Y&#8221; as local FROM panel_domains WHERE CONCAT(&#8220;@&#8221;,domain) IN (%k).</span></p>
<p>The $sa_* config items are pretty much self explanatory: you can tune their values to your likening. If SpamAssassin assigns a score higher than sa_tag2_level_deflt to the message, it will be delivered to the user&#8217;s INBOX.spam subfolder.</p>
<p>The @addr_extension_spam_maps directive (together with $replace_existing_extension and recipient_delimiter) tells Amavisd-new to rewrite the recipient address of spam messages from user@domain.tld to user+spam@domain.tld .</p>
<p>The @lookup_sql_dsn directive tells Amavisd-new how to connect to the MySQL database used by Postfix to lookup the local domains, mailboxes, and aliases.</p>
<p>The $sql_select_policy directive contains a MySQL query which fetches the list of local domains from the MySQL database used by Postfix. Depending on your Postfix setup you may need to change the query so that it returns &#8220;Y&#8221; if the domain (%k) is listed inside the &#8220;domain&#8221; table.</p>
<p><span style="color: #ff0000;">CAVEAT: THIS IS CRITICAL TO MAKE THE SETUP WORK!!! If Amavisd-new doesn&#8217;t know that the domain is a local one, IT WON&#8217;T CHANGE THE RECIPIENT ADDRESS TO user+spam@domain.tld . The email will always be delivered to user@domain.tld and stored inside INBOX instead of INBOX.Spam.</span></p>
<p><span style="color: #ff0000;">Amavisd-new only modifies the original message if <strong>both </strong>the following conditions are met:</span></p>
<ul>
<li><span style="color: #ff0000;">the domain is known to be a local domain</span></li>
<li><span style="color: #ff0000;">the spam score is higher sa_tag2_level_deflt<br />
</span></li>
</ul>
<p>The $localpart_is_case_sensitive directive, when set to false, tells Amavisd-new to treat domain names as case insensitive.</p>
<p>Finally, $final_spam_destiny  tells Amavisd-new to deliver spam messages instead of simply<strong></strong> quarantine/reject them.</p>
<span id="Purging_old_spam_messages"><h3>Purging old spam messages</h3></span>
<p>The INBOX.spam subfolders will tend to grow with time. We want to setup a cronjob which purges messages older than 60 days. Assuming that our virtual mailboxes are stored under /var/mail/virtual, we may use add to crontab something like this:</p>
<pre>0 0 * * * find /var/mail/virtual/ -name .spam -type d -exec find {} -mindepth 1 -type f -ctime +60 -delete \;</pre>
<span id="Conclusions"><h3>Conclusions</h3></span>
<p>Thumbs up! We are done :)<br />
Please send me your comments if something is not clear or not working as expected!</p>
<span id="Bibliography"><h4>Bibliography</h4></span>
<ul>
<li> <a href="http://www.ijs.si/software/amavisd/README.lookups.txt" target="_blank">http://www.ijs.si/software/amavisd/README.lookups.txt</a></li>
<li><a href="http://wiki.dovecot.org/LDA/Sieve#Validate_your_script" target="_blank">http://wiki.dovecot.org/LDA/Sieve#Validate_your_script</a></li>
<li><a href="http://wiki.dovecot.org/LDA/Postfix" target="_blank">http://wiki.dovecot.org/LDA/Postfix</a></li>
</ul>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;count=horizontal&amp;text=Per-user%20spam%20folder%20with%20Amavisd-new%2C%20Postfix%2BMySQL%2C%20virtual%20users%2C%20Dovecot" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;count=horizontal&amp;text=Per-user%20spam%20folder%20with%20Amavisd-new%2C%20Postfix%2BMySQL%2C%20virtual%20users%2C%20Dovecot" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Famavisd-and-per-user-spam-folder&amp;title=Per-user%20spam%20folder%20with%20Amavisd-new%2C%20Postfix%2BMySQL%2C%20virtual%20users%2C%20Dovecot" id="wpa2a_16"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/03/amavisd-and-per-user-spam-folder/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>Isofix universale: di nome non di fatto</title>
<link>http://www.nervous.it/lang/en-us/2010/03/isofix-universale-e-top-tether</link>
<comments>http://www.nervous.it/lang/en-us/2010/03/isofix-universale-e-top-tether#comments</comments>
<pubDate>Mon, 15 Mar 2010 11:53:41 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[ancoraggio]]>
</category>
<category>
<![CDATA[auto]]>
</category>
<category>
<![CDATA[isofix]]>
</category>
<category>
<![CDATA[seggiolino]]>
</category>
<category>
<![CDATA[top tether]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/2010/03/isofix-universale-di-nome-non-di-fatto/</guid>
<description>
<![CDATA[Di recente mi sono dovuto avventurare nella scelta di un seggiolino per auto. Il mercato è una vera giungla e gli articoli delle riviste di auto di certo non aiutano con i loro consigli sibillini e molto approssimativi. Quoto a titolo d&#8217;esempio un articolo comparso su SicurAuto: ISOFIX Universal: questa scritta si riferisce alla compatibilità [...]]]>
</description>
<content:encoded>
<![CDATA[<p>Di recente mi sono dovuto avventurare nella scelta di un seggiolino per auto. Il mercato è una vera giungla e gli articoli delle riviste di auto di certo non aiutano con i loro consigli sibillini e molto approssimativi.</p>
<p>Quoto a titolo d&#8217;esempio un articolo comparso su <a href="http://www.sicurauto.it/sistemi-di-sicurezza/isofix-attacco-seggiolini-bimbi.htm">SicurAuto</a>:</p>
<blockquote><p>ISOFIX Universal: questa scritta si riferisce alla compatibilità del seggiolino con qualsiasi automobile (universal) </p></blockquote>
<p>La frase porta a credere che<strong> se</strong> il seggiolino è marchiato come &#8220;ISOFIX universal&#8221; <strong>allora</strong> è compatibile con qualunque automobile dotata di agganci ISOFIX. Niente di più falso! </p>
<p>Anzi, è proprio l&#8217;opposto. In generale<strong> i seggiolini ISOFIX semi-universal sono compatibili con più modelli di auto</strong> rispetto agli ISOFIX universal!</p>
<p>Se il seggiolino è marchiato come &#8220;ISOFIX universale&#8221; significa che <strong>richiede un terzo punto di aggancio sul retro del sedile, detto top tether</strong>. Per installare correttamente questo tipo di seggiolini occorre quindi utilizzare:</p>
<ul>
<ol>
2 punti di aggancio sulla base del sedile, fissati direttamente sugli appositi ganci che spuntano dalla scocca dell&#8217;auto. </ol>
<ol>
<p>Un terzo punto d&#8217;aggancio, comunemente chiamato top-tether e solitamente posizionato sul retro del sedile o vicino al poggiatesta, come nelle presenti foto:
</ol>
</ul>
<div id="attachment_371" class="wp-caption aligncenter" style="width: 260px"><a href="http://cdn2.nervous.it/wp-content/uploads/2010/03/toptether.jpg"><img src="http://cdn2.nervous.it/wp-content/uploads/2010/03/toptether.jpg" alt="top tether" title="toptether" width="250" height="200" class="size-full wp-image-371" /></a><p class="wp-caption-text">top tether for ISOFIX universal</p></div>
<p>Qui cominciano i problemi: le prime auto con attacchi ISOFIX introdotte in Italia (fino al 2005-2006)<strong> non dispongono di questo terzo attacco top tether e quindi non sono adatte all&#8217;utilizzo con seggiolini ISOFIX universale</strong>!</p>
<p>Al contrario i seggiolini ISOFIX semi-universali sono utilizzabili su questo tipo di autovetture in quanto dispongono di una speciale gamba-piedistallo che si fissa sotto al sedile e supplisce all&#8217;assenza dell&#8217;attacco top-tether.</p>
<p>Un seggiolino ISOFIX universale o semi-universale montato utilizzando solo i due ancoraggi alla base, ovvero <strong>senza top tether e senza gamba-piedistallo aggiuntiva</strong>, è in generale persino meno sicuro di un seggiolino tradizionale sprovvisto di attacchi ISOFIX in quanto in caso di incidente <strong>può essere soggetto a ribaltamento</strong>!</p>
<p>I due punti di ancoraggio alla base del sedile non sono sufficienti, da soli, a garantire la stabilità del seggiolino.</p>
<p>Non fidatevi quindi di chi cerca di vendervi un seggiolino ISOFIX dicendovi che il terzo attacco è opzionale o inutile! Sta mettendo a serio rischio la sicurezza del vostro bambino.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;count=horizontal&amp;text=Isofix%20universale%3A%20di%20nome%20non%20di%20fatto" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;count=horizontal&amp;text=Isofix%20universale%3A%20di%20nome%20non%20di%20fatto" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2010%2F03%2Fisofix-universale-e-top-tether&amp;title=Isofix%20universale%3A%20di%20nome%20non%20di%20fatto" id="wpa2a_18"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2010/03/isofix-universale-e-top-tether/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>How to sum the sizes of files found by &#8216;find&#8217;</title>
<link>http://www.nervous.it/lang/en-us/2009/12/sum-size-of-matching-files</link>
<comments>http://www.nervous.it/lang/en-us/2009/12/sum-size-of-matching-files#comments</comments>
<pubDate>Sun, 20 Dec 2009 19:43:14 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category>
<![CDATA[howto]]>
</category>
<category>
<![CDATA[awk]]>
</category>
<category>
<![CDATA[bash]]>
</category>
<category>
<![CDATA[find]]>
</category>
<category>
<![CDATA[one liner]]>
</category>
<category>
<![CDATA[tips]]>
</category>
<guid isPermaLink="false">http://www.nervous.it/?p=334</guid>
<description>
<![CDATA[Sometimes you want to find the size of all files that match some criteria, for example: files older than N days, or files greater than N bytes, or files that have a certain extension. In this case, using du is not practical. Here is a simple awk one-liner that will sum the size of all [...]]]>
</description>
<content:encoded>
<![CDATA[<p>Sometimes you want to find the size of all files that match some criteria, for example: files older than N days, or files greater than N bytes, or files that have a certain extension.</p>
<p>In this case, using <em>du</em> is not practical. Here is a simple awk one-liner that will sum the size of all files under /path that are older than 90 days:</p>
<p><code>find /path/ -type f -mtime +90 -printf "%s\n"&#124;awk '{sum+=$0}END{print sum}'</code></p>
<p>Enjoy!</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;count=horizontal&amp;text=How%20to%20sum%20the%20sizes%20of%20files%20found%20by%20%26%238216%3Bfind%26%238217%3B" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;counturl=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;count=horizontal&amp;text=How%20to%20sum%20the%20sizes%20of%20files%20found%20by%20%26%238216%3Bfind%26%238217%3B" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.nervous.it%2Flang%2Fen-us%2F2009%2F12%2Fsum-size-of-matching-files&amp;title=How%20to%20sum%20the%20sizes%20of%20files%20found%20by%20%26%238216%3Bfind%26%238217%3B" id="wpa2a_20"><img src="http://www.nervous.it/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]>
</content:encoded>
<wfw:commentRss>http://www.nervous.it/lang/en-us/2009/12/sum-size-of-matching-files/feed</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
</channel>
</rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              a53cd
Template:           archive
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 17/55 queries in 0.032 seconds using disk: basic
Object Caching 1342/1453 objects using disk: basic
Content Delivery Network via cdn.nervous.it

Served from: www.nervous.it @ 2012-02-05 09:19:50 -->
