août 14
Ne trouvant pas mon bonheur parmi les plugins munin pour fail2ban j’ai décidé de l’écrire moi même. Le plugins s’adapte automatiquement à votre fail2ban car il récupère les jails activées.
On crée le fichier /usr/share/munin/plugins/fail2ban et on le remplit le avec le code ci-dessous
#! /bin/bash
PROGNAME=fail2ban
STATEDIR=/var/lib/munin/plugin-state
LISTJAIL=$(fail2ban-client status | grep " Jail list:" | sed 's/`- Jail list:\t\t//g' | sed 's/,//g')
if [ "$1" = "config" ]
then
echo 'system.type ABSOLUTE'
echo 'graph_title Fail2ban'
echo 'graph_vlabel Number of ban'
echo 'graph_category Security'
for f in $LISTJAIL; do
echo "$f.label $f"
done
exit 0
fi
for f in $LISTJAIL; do
echo "$f.value $(fail2ban-client status $f | grep " Currently banned:" | sed 's/ |- Currently banned:\t//g')"
done
Ensuite on active le plugins en créant le lien symbolyque
ln -s /usr/share/munin/plugins/fail2ban /etc/munin/plugins/
Il faut également élever les privilèges de munin pour qu’il puisse utiliser fail2ban
vi /etc/munin/plugin-conf.d/munin-node
On ajoute à la fin :
[fail2ban]
user root
On termine on redémarrant munin
/etc/init.d/munin-node restart
Et vous devriez avoir après quelques jours un graphique semblable

Graph Munin Fail2ban
avr 24
On install les paquets
apt-get install sudo debianutils coreutils
On se met dans dans le dossier /usr/local/sbin, download le script et lui donne les droits d’exécution
cd /usr/local/sbin
wget http://www.majorxtrem.be/wp-content/uploads/2009/04/make_chroot_jail.sh
chmod 700 /usr/local/sbin/make_chroot_jail.sh
Il suffit maintenant de lancer la commande suivante pour créer un utilisateur
make_chroot_jail
Voici le r ésultat
# make_chroot_jail gora
Release: 2007-10-19
Am I root?
OK
Checking distribution...
Supported Distribution found
System is running Debian Linux
Checking for which...
OK
Checking for chroot...
OK
Checking for sudo...
OK
Checking for dirname...
OK
Checking for awk...
OK
Creating /bin/chroot-shell
Creating /home/jail
Creating /home/jail/dev
Creating /home/jail/etc
Creating /home/jail/etc/pam.d
Creating /home/jail/bin
Creating /home/jail/home
Creating /home/jail/sbin
Creating /home/jail/usr
Creating /home/jail/usr/bin
Creating /home/jail/usr/lib
Modifying /etc/sudoers
Adding User "gora" to system
Entrez le nouveau mot de passe UNIX :
Retapez le nouveau mot de passe UNIX :
passwd : le mot de passe a ét é mis à jour avec succ ès
Adding User gora to jail
Copying necessary library-files to jail (may take some time)
Copying files from /etc/pam.d/ to jail
Copying PAM-Modules to jail
Recent Comments