Petit script php.
Voici le bon bout de code :
(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) )
et preg_match(‘/Basic\s+(.*)$/i’,$_SERVER['REMOTE_USER'], $matches)
Publié: 21 juillet 2009
Voici le bon bout de code :
(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) )
et preg_match(‘/Basic\s+(.*)$/i’,$_SERVER['REMOTE_USER'], $matches)
Publié: 21 juillet 2009
Pour un petit serveur comme celui ci, j'utilise fail2ban, même pas besoin de mettre son nez dans iptables, ce logiciel gère le ban automatiquement et il est très paramétrable. aptitude install fail2ban nano /etc/fail2ban/jail.local [ssh]enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 5 [apache] enabled = true port = http filter = apache-auth logpath = /home/*/logs/error.log maxretry = 5 [apache-noscript] enabled = false port = http filter = apache-noscript logpath = /home/*/logs/error.log maxretry = 5 [proftpd] enabled = true port = ftp filter = proftpd logpath = /home/log/proftpd/proftpd.log maxretry = 5 [proftpd2] enabled = true port = ftp filter = proftpd2 logpath = /home/log/proftpd/proftpd.log maxretry = 5
Publié: 20 juillet 2009