# uname -a

Switch

Mot-clé -

Fil des billets

mardi 12 septembre 2017

The war on SPAM: an review of the real world tools

Anti-spam techniques review: a few hints and tools review from my own experience.

Spam mesage are very common these days, but filtering them out is not as easy as it seems. The filtering techniques have evolved at the same rate than the spammers' evasive techniques, and the risk of filtering out a legitimate message is greater than ever.

It is also quite difficult to find good and up-to-date counter-measures list that anyone can implement.

Here is a summary of the anti-spam strategies I used / am still using. I hope it will help you understanding today's threats, and build your own solutions.

Lire la suite...

jeudi 18 février 2016

Debian 8 : Limit SSH users to SFTP

Let’s say you want to configure a secure remote file access for you users, but you can’t use FTPS for some reasons (problems with passive mode and commercial firewalls ? Yes !). Your only secure solution is either a VPN, or a SFTP access.

SFTP is great, but it may implies giving full command line access to your end users.  In order to prevent that, you could set-up a jailed SSH access with Jailkit and some bind mount, but it’s not that trivial to configure and to maintain ; and it may not work with software virtualization (Docker, LXCs…). There is a simpler solution.

The solution is : use the native chroot and limitations abilities of OpenSSH. Here is how.

Lire la suite...

dimanche 6 décembre 2015

Set-up SQL quarantine with Amavisd-new and ISPConfig

It's documented, but it took me two days to do it correctly, so here is how to reconfigure an ISPConfig installation of Amavis to store quarantined mail in SQL database, in order to install a quarantine viewer like Mailzu.

Lire la suite...

mercredi 21 octobre 2015

Configurer dibbler-client pour IPv6 sur une Dedibox (Online.net) avec Debian 8 (Jessie)

La documentation d’Online pour IPv6 ne traite pas le cas de Debian, Ubuntu, ou toute distribution utilisant systemd (CentOS6, etc). La documention doit être étendue pour ajouter le service sysetmd au démarrage, en lieu et place de l’init script.

Vérifiez que l’IPv6 est activé

Cela devrait normalement être le cas, puisque le noyau par défaut de Debian 8 inclut nativement IPv6 et ne peut pas être désactivé. Mais au cas où vous ne verriez pas le link-local sur vos interfaces :

Changer dans /etc/modprobe.d/local.conf :

options ipv6 disable=0

Ajouter dans /etc/modules :

ipv6

Il faudra sans doute redémarrer pour appliquer les changments.

Récupérez votre préfixe et votre DUID depuis la console d’Online

Vous devez demander l’activation de IPv6 au support et créer votre /64 dans la console d’Online pour obtenir votre DUID.

Créez un /64 et n’utilisez pas le /48 ou le 56 directement, vous pourriez le regretter si vous souhaitez redécouper le réseau. Vous n’avez qu’un seul /48 par compte, un /56 pour chaque serveur, et un /64 pour chaque failover souscrit.

Configurez l’interface réseau

Encore une fois, c’est sans doute facultatif puisque Dibbler reconfigure l’interface lorsqu’il se lance, donc explicitons ça dans le fichier /etc/network/interfaces, juste au cas où :

iface eth0 inet6 static
    address your_ipv6_address
    netmask 64
    accept_ra 2

Notes sur Proxmox et le forwarding

Sous Proxmox on travaille sur l’interface bridge, c’est vmbr0 et non pas eth0.

Si le forwarding est activé, vous devez forcer le accept_ra à 2, une valeur de 1 fera ignorer les router advertisements lorsque le forwarding est activé. Explications. Ajoutez dans sysctl.conf :

net.ipv6.conf.vmbr0.accept_ra = 2

Notez bien que dans le cas où vous adressez vos machines virtuelles en IPv6 vous ne devez pas brancher l’interface IPv6 de vos VM directement sur l’interface vmbr0. Voilà pourquoi.

Compilez et installez Dibbler

  • Téléchargez Dibbler 1.0.1 à partir du site officiel
  • Installez build-essential : apt-get install build-essential
  • Décompressez Dibbler : tar -xzf dibbler-1.0.1.tar.gz && cd dibbler-1.0.1
  • Compilez et installez Dibbler : ./configure && ./make

Configurez Dibbler

Créez les dossiers et fichiers de configuration comme le précise la documentation :

Configurez le DUID dans /var/lib/dibbler/client-duid :

mkdir /var/lib/dibbler/
touch /var/lib/dibbler/client-duid
chmod 640 /var/lib/client-duid
# Set up you duid in client-duid
vim /var/lib/client-duid

Configurez /etc/dibbler/client.conf :

mkdir /etc/dibbler
vim /etc/dibbler/client.conf

Voici le contenu de mon client.conf :

auth-protocol reconfigure-key
auth-replay monotonic
auth-methods digest-hmac-md5
duid-type duid-ll
inactive-mode
log-level 8
iface eth0 {
    pd
    ia
}

Encore une fois, c’est à adapter en fonction du nom de votre interface.

Démarrez le client pour tester la connectivité :

dibbler-client run

Pour vérifier que Dibbler a configuré l’interface, pressez CTRL+Z pour suspendre le processus et vérifiez que l’IP et les routes sont bien configurées. Tapez la commande “fg” pour retourner au processus en cours d’exécution, et tapez CTRL+C pour stopper Dibbler.

Si pendant l’opération les routes et les IPs sont incorrectes, vérifiez que votre pare feu accepte les connexions entrantes par le port 546 UDP.

Configurez Dibbler au démarrage

Cette section est différente de la documentation d’Online.

Avant systemd, le système d’init par dépendances se contentait d’un script dans /etc/init.d/. Avec systemd, il faut créer un fichier service dans /etc/systemd/system/ .

Créez le fichier suivant : /etc/systemd/system/dibbler.service :

[Unit]
Description=Dibbler
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/dibbler-client start
ExecStop=/usr/local/sbin/dibbler-client stop
PrivateTmp=true
NonBlocking=yes

[Install]
WantedBy=multi-user.target

Lancez la commande suivante pour que systemd lise le fichier  :

systemctl daemon-reload

Et activez le service :

systemctl enable dibbler.service

Et essayez de le lancer pour la première fois :

systemctl start dibbler.service

Vérifions que tout est correct :

service dibbler status
ifconfig
route -6
ping6 whatever-you-want.com

Si tout va bien, redémarrez et l’IPv6 fonctionnera dès le démarrage ! :)

Addendum : juste au cas où, n’utilisez pas resolvconf pour pousser les DNS IPv6 automatiquement, conservez autant que possible vos DNS IPv4. Ça serait tellement dommage que votre connectivité IPv6 saute et que vous vous retrouviez sans DNS (oui ça m’est arrivé…).

Sources

Configure dibbler-client for IPV6 networking on Dedibox (or any Online.net) servers with Debian 8 (Jessie)

The Online documentation for IPv6 is not dealing with the case of Debian 8, Ubuntu, or any distribution using systemd. Systemd replaces upstart, so the procedure has to be extended to add systemd service for startup, replacing the previoux behavior that was using init scripts.

Ensure that you are IPv6-proof

It should be the case as Debian 8 is shipping a kernel with native IPv6, but just to be sure :

In /etc/modprobe.d/local.conf :

options ipv6 disable=0

In /etc/modules :

ipv6

You may have to reboot in order to apply the changes.

Set up your IPv6 prefix and get your DUID on Online console

You have to request IPv6 activation to support and create your /64 on Online console before getting your DUID working.

Make a /64 and do not use your /48 or your /56 directly, as you may regret it. You can have only one /48 by account, one /56 by server, and one /64 by IP failover (the /48 is divided to make the /56 and so on).

Configure your network interface

It may not be mandatory as Dibbler will reconfigure your interface, but you have to ensure that you accept router advertisements. Add to /etc/network/interfaces :

iface eth0 inet6 static
    address your_ipv6_address
    netmask 64
    accept_ra 2

Notes about Proxmox and forwarding

On Proxmox, you are working on the bridge interface, it should be vmbr0 instead of eth0.

If you enabled forwarding on this interface (to give your VM an access to IPv6 network), you have to force the accept_ra to 2, while the default value of 1 wil make your Debian to ignore router advertisements when forwarding is enabled ! Read more. Add to sysctl.conf :

net.ipv6.conf.vmbr0.accept_ra = 2

Also do not set the IPv6 interface of your VM to vmbr0, as you can break your network access. Read more.

Compile and install Dibbler

  • Download Dibbler 1.0.1 from the offical website.
  • Install build-essential : apt-get install build-essential
  • Extract Dibbler : tar -xzf dibbler-1.0.1.tar.gz && cd dibbler-1.0.1
  • Compile and install Dibbler : ./configure && ./make

Configure Dibbler

Make the directories and set up according to the documentation :

Set up duid :

mkdir /var/lib/dibbler/
touch /var/lib/dibbler/client-duid
chmod 640 /var/lib/client-duid
# Set up you duid in client-duid
vim /var/lib/client-duid

Set up client.conf :

mkdir /etc/dibbler
vim /etc/dibbler/client.conf

The content of my client.conf :

auth-protocol reconfigure-key
auth-replay monotonic
auth-methods digest-hmac-md5
duid-type duid-ll
inactive-mode
log-level 8
iface eth0 {
    pd
    ia
}

Note that if your interface name is different you have to change it accordingly. For instance, on a Proxmox host server, it should be vmbr0 instead of eth0.

Start dibbler to try the connectivity :

dibbler-client run

Hit CTRL+Z to suspend the process and check that the IP and routes are configured. Type the command “fg” to get back to the running process and hit CTRL+C to stop it.

If it doesn’t work, check your firewall, dibbler needs to listen port 546 UDP.

Set Dibbler at startup

This section differs from Online documentation.

Before systemd, the dependency-based boot sequence only needed an init script, for instance /etc/init.d/dibbler . With systemd, you have to make a service file in /etc/systemd/system/ .

Make the following file : /etc/systemd/system/dibbler.service :

[Unit]
Description=Dibbler
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/dibbler-client start
ExecStop=/usr/local/sbin/dibbler-client stop
PrivateTmp=true
NonBlocking=yes

[Install]
WantedBy=multi-user.target

Run the following command to make systemd read file :

systemctl daemon-reload

Enable the service :

systemctl enable dibbler.service

And then, try to start it :

systemctl start dibbler.service

Check everything is fine :

service dibbler status
ifconfig
route -6
ping6 whatever-you-want.com

Reboot and the IPv6 networking should work at startup ! :)

Addendum : just in case, don’t use resolvconf with IPv6 DNS pushing and if possible keep IPv4 DNS, it would be such a pity if the IPv6 networking crashes while your DNS servers are set to IPv6 addresses (yeah, it happened to to me)…

Sources

- page 1 de 3