Md at

tales of a debian maintainer

Debian support for libxcrypt

glibc 2.29-7 and libxcrypt 1:4.4.10-10 today entered Debian testing: crypt(3) and the other related library functions in libcrypt from now on will be provided by libxcrypt instead of glibc.

After 18 months of packaging work, Debian finally supports modern password hashing methods like yescrypt: the details about them are documented in crypt(5).

For the time being there is still no support for libxcrypt in our release of PAM, but hopefully the Debian maintainer will update the package soon and this will allow using yescrypt by default.

If you want to test now the new algorithms then you can generate a password using my mkpasswd program and copy it to /etc/shadow:

# echo "marco:$(echo 12345 | mkpasswd --stdin)" | chpasswd --encrypted

Per-process netfilter rules

This article documents how the traffic of specific Linux processes can be subjected to a custom firewall or routing configuration, thanks to the magic of cgroups. We will use the Network classifier cgroup, which allows tagging the packets sent by specific processes.

To create the cgroup which will be used to identify the processes I added something like this to /etc/rc.local:

mkdir /sys/fs/cgroup/net_cls/unlocator
/bin/echo 42 > /sys/fs/cgroup/net_cls/unlocator/net_cls.classid
chown md: /sys/fs/cgroup/net_cls/unlocator/tasks

The tasks file, which controls the membership of processes in a cgroup, is made writeable by my user: this way I can add new processes without becoming root. 42 is the arbitrary class identifier that the kernel will associate with the packets generated by the member processes.

A command like systemd-cgls /sys/fs/cgroup/net_cls/ can be used to explore which processes are in which cgroup.

I use a simple shell wrapper to start a shell or a new program as members of this cgroup:

#!/bin/sh -e

if [ ! -d /sys/fs/cgroup/net_cls/$CGROUP_NAME/ ]; then
  echo "The $CGROUP_NAME net_cls cgroup does not exist!" >&2
  exit 1

/bin/echo $$ > /sys/fs/cgroup/net_cls/$CGROUP_NAME/tasks

if [ $# = 0 ]; then
  exec ${SHELL:-/bin/sh}

exec "$@"

My first goal is to use a special name server for the DNS queries of some processes, thanks to a second dnsmasq process which acts as a caching forwarder.





Description=dnsmasq - Second instance

ExecStartPre=/usr/sbin/dnsmasq --test
ExecStart=/usr/sbin/dnsmasq --keep-in-foreground --conf-file=/etc/dnsmasq2.conf
ExecReload=/bin/kill -HUP $MAINPID


Do not forget to enable the new service:

systemctl enable dnsmasq2
systemctl start dnsmasq2

Since the cgroup match extension is not yet available in a released version of iptables, you will first need to build and install it manually:

git clone git://
cd iptables
make -k
sudo cp extensions/ /lib/xtables/
sudo chmod -x /lib/xtables/

The netfilter configuration required is very simple: all DNS traffic from the marked processes is redirected to the port of the local dnsmasq2:

iptables -t nat -A OUTPUT -m cgroup --cgroup 42 -p udp --dport 53 -j REDIRECT --to-ports 5354
iptables -t nat -A OUTPUT -m cgroup --cgroup 42 -p tcp --dport 53 -j REDIRECT --to-ports 5354

For related reasons, I also need to disable IPv6 for these processes:

ip6tables -A OUTPUT -m cgroup --cgroup 42 -j REJECT

I use a different cgroup to force some programs to use my office VPN by first setting a netfilter packet mark on their traffic:

iptables -t mangle -A OUTPUT -m cgroup --cgroup 43 -j MARK --set-mark 43

The packet mark is then used to policy-route this traffic using a dedicate VRF, i.e. routing table 43:

ip rule add fwmark 43 table 43

This VPN VRF just contains a default route for the VPN interface:

ip route add default dev tun0 table 43

Depending on your local configuration it may be a good idea to also add to the VPN VRF the routes of your local interfaces:

ip route show scope link proto kernel \
  | xargs -I ROUTE ip route add ROUTE table 43

Since the source address selection happens before the traffic is diverted to the VPN, we also need to source-NAT to the VPN address the marked packets:

iptables -t nat -A POSTROUTING -m mark --mark 43 --out-interface tun0 -j MASQUERADE

Hacking Team and a case of BGP hijacking

After just a few hours the Hacking Team emails archive has already provided many tasty leaks. I want to focus on a routing security issue since this is my main research activity for this year.

Short summary: if these emails are true, and so far nobody has found any credible reason to believe that they are not, then some major italian ISPs hijacked the IP addresses of a foreign ISP on request of the section of the Carabinieri which investigates terrorism and organized crime.

The goal was to recover access to some copies of the Hacking Team malware which were controlled by "anonymizer" VPSes hosted on the hijacked network and that were abruptly disabled by their provider.

Thanks to the great RIPEstat service I have been able to verify that indeed the network was announced by (elided) (a large italian hosting company) in 2013, from august 15 to 22.

Then I downloaded from the RIPE RIS archive a BGP table dump for august 20 2013 and processed it with my zebra-dump-parser software to extract the relevant routes. It shows that (elided) did not just advertise the hijacked network to the two italian ISPs mentioned in the emails, but apparently to all their other peers since the announce was also accepted by Hurricane Electric at MIX-IT. This means that the hijacking was not limited to a couple of local networks but involved many others all over the world.

As an italian network operator I am seriously concerned that some of my BGP peers appear to be involved in what would usually be considered a criminal activity.

As all operators know, there is still too much mutual trust involved in global BGP routing, and in some cases it is misplaced: we need better best practices, tools and protocols to make this kind of things impossible in the future.

(Some of the relevant leaked emails: 1 2 3 4 5 6 7 8 9.)

L'inaffidabile rete di Telecom Italia

Da venerdì mattina fino almeno a tutto oggi pomeriggio è ricomparso il solito problema che impedisce a certi clienti di Telecom Italia di accedere a certi siti: per esempio un utente con una ADSL Alice non riesce a scaricare la posta dal proprio server in un data center.

Ho visto questo tipo di guasto molte volte, la prima il 5 febbraio 2014: si manifesta sempre con un cliente di Telecom Italia che non riesce a raggiungere uno specifico IP "esterno", ma non ha problemi per esempio a raggiungere l'IP adiacente attivo sullo stesso server. Allo stesso modo l'IP "esterno" è normalmente raggiungibile dagli altri clienti di Telecom Italia.

In tutti i casi che ho analizzato, confrontando i traceroute fatti verso un IP funzionante e uno non raggiungibile, si vede sempre che il traffico in uscita si ferma al confine tra la rete nazionale di Telecom Italia (AS3269) e il loro carrier globale Telecom Italia Sparkle (AS6762). Lo stesso comportamento mi è stato confermato dai colleghi di almeno tre altri operatori, quindi so che non dipende da specificità della mia rete. La rete nazionale di Telecom Italia è interconnessa al mondo esterno solo mediante Telecom Italia Sparkle, quindi il problema si verifica anche comprando direttamente transito da TIS.

Considerando la frequenza e la durata di questi guasti, a quanto pare non esiste un modo per avere connettività affidabile verso le ADSL di Telecom Italia, cioè il 51% degli utenti consumer italiani, che non sia comprare transito o peering dallo stesso AS3269. Sarei felice di essere smentito.

Per approfondire questi temi segnalo la mia presentazione sulle interconnessioni tra le reti italiane, disponibile anche in una versione per gli stranieri con qualche aggiornamento recente.

My position on the "init system coupling" General Resolution

I first want to clarify for the people not intimately involved with Debian that the GR-2014-003 vote is not about choosing the default init system or deciding if sysvinit should still be supported: its outcome will not stop systemd from being Debian's default init system and will not prevent any interested developers from supporting sysvinit.

Some non-developers have recently threatened of "forking Debian" if this GR will not pass, apparently without understanding well the concept: Debian welcomes forks and I think that having more users working on free software would be great no matter which init system they favour.

The goal of Ian Jackson's proposal is to force the maintainers who want to use the superior features of systemd in their packages to spend their time on making them work with sysvinit as well. This is antisocial and also hard to reconcile it with the Debian Constitution, which states:

2.1.1 Nothing in this constitution imposes an obligation on anyone to do work for the Project. A person who does not want to do a task which has been delegated or assigned to them does not need to do it. [...]

As it has been patiently explained by many other people, this proposal is unrealistic: if the maintainers of some packages were not interested in working on support for sysvinit and nobody else submitted patches then we would probably still have to release them as is even if formally declared unsuitable for a release. On the other hand, if somebody is interested in working on sysvinit support then there is no need for a GR forcing them to do it.

The most elegant outcome of this GR would be a victory of choice 4 ("please do not waste everybody's time with pointless general resolutions"), but Ian Jackson has been clear enough in explaining how he sees the future of this debate:

If my GR passes we will only have to have this conversation if those who are outvoted do not respect the project's collective decision.

If my GR fails I expect a series of bitter rearguard battles over individual systemd dependencies.

There are no significant practical differences between choices 2 "support alternative init systems as much as possible" and 3 "packages may require specific init systems if maintainers decide", but choice 3 is more explicit in supporting the technical decisions of maintainers and upstream developers.

This is why I think that we need a stronger outcome to prevent discussing this over and over, no matter how each one of us feels about working personally on sysvinit support in the future. I will vote for choices 3, 2, 4, 1.

The Italian peering ecosystem

I published the slides of my talk "An introduction to peering in Italy - Interconnections among the Italian networks" that I presented today at the MIX-IT (the Milano internet exchange) technical meeting.

15 years of whois

Exactly 15 years ago I uploaded to Debian the first release of my whois client.

At the end of 1999 the United States Government forced Network Solutions, at the time the only registrar for the .com, .net and .org top level domains, to split their functions in a registry and a registrar and to and allow competing registrars to operate.

Since then, two whois queries are needed to access the data for a domain in a TLD operating with a thin registry model: first one to the registry to find out which registrar was used to register the domain, and then one the registrar to actually get the data.

Being as lazy as I am I tought that this was unacceptable, so I implemented a whois client that would know which whois server to query for all TLDs and then automatically follow the referrals to the registrars.

But the initial reason for writing this program was to replace the simplistic BSD-derived whois client that was shipped with Debian with one that would know which server to query for IP addresses and autonomous system numbers, a useful feature in a time when people still used to manually report all their spam to the originating ISPs.

Over the years I have spent countless hours searching for the right servers for the domains of far away countries (something that has often been incredibly instructive) and now the program database is usually more up to date than the official IANA one.

One of my goals for this program has always been wide portability, so I am happy that over the years it was adopted by other Linux distributions, made available by third parties to all common variants of UNIX and even to systems as alien as Windows and OS/2.

Now that whois is 15 years old I am happy to announce that I have recently achieved complete world domination and that all Linux distributions use it as their default whois client.

CVE-2014-6271 fix for Debian woody, sarge, etch and lenny

Very old Debian releases like woody (3.0), sarge (3.1), etch (4.0) and lenny (5.0) are not supported anymore by the Debian Security Team and do not get security updates. Since some of our customers still have servers running these version, I have built bash packages with the fix for CVE-2014-6271 (the "shellshock" bug) and Florian Weimer's patch which restricts the parsing of shell functions to specially named variables:

This work has been sponsored by my employer Seeweb, an hosting, cloud infrastructure and colocation provider.

Censurato in Italia

Dopo la censura nel novembre 2013 di, il più grande social network russo, un altro importante sito russo è stato censurato in Italia: si tratta di, il più grande portale del Paese e uno dei principali mail service provider del mondo.

Il decreto di sequestro è stato inviato ai principali provider di accesso italiani da un GIP di Roma, ed è motivato dalla pubblicazione illecita di due film. Tra gli altri 24 siti censurati con questo provvedimento c'è, il popolare cyberlocker che ha sostituito MegaUpload.

Come al solito in Italia c'è l'abitudine di censurare importanti siti stranieri senza preoccuparsi dei danni collaterali. Come al solito si ordina di censurare un sito web ma vengono bloccati anche tutti gli altri servizi, come la posta. Come al solito la vittima del sequestro anomalo non è stata notificata, infatti i loro tecnici questa mattina cercavano di contattare colleghi italiani per capire cosa fosse successo...

L'elenco non ufficiale ma completo dei siti censurati in Italia è sempre disponibile sul mio sito

Aggiornamento del 19 luglio: me ne sono accorto solo ora, ma falsificando in questo modo le risposte per il dominio viene impedito anche il funzionamento di ICQ, perché il dominio usa gli stessi name server. colpito dagli stessi spammer di AOL e Yahoo?

La settimana scorsa ha modificato la propria policy SPF in hardfail: questo in pratica significa che non è più possibile inviare posta con mittente (per la precisione: envelope sender) mediante mail server terzi.

SPF impedisce anche il forwarding da un account a un altro di messaggi con mittenteè una delle sue principali limitazioni e il motivo per cui la sua diffusione è relativamente bassa.

È lecito ipotizzare che questo sia la risposta alla recente campagna di spam inviato da mittenti falsificati a indirizzi nelle loro rubriche. Si tratta dello stesso tipo di spam che nei mesi scorsi ha colpito duramente AOL e Yahoo, costringendoli ad adottare una policy DMARC con p=reject.

Non è noto come gli spammer siano venuti in possesso delle rubriche di questi utenti di Libero, ma nel caso di AOL era stata confermata una intrusione.

AOL e Yahoo hanno risolto il problema con p=reject, al prezzo di rendere impossibile ai loro utenti attività come partecipare a mailing list. Al momento Libero nemmeno firma con DKIM e quindi non può adottare la stessa strategia: vedremo cosa succederà in futuro, ma se si accodassero anche loro sarebbe una enorme novità nel panorama italiano dell'email.



Sono l'Italia che non vuole bene.

      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

See also:

My blogroll:

W3C HTML 4.01
W3C CSS 2.0     

Powered by