debian:hosts.deny

Ceci est une ancienne révision du document !


Remove a host that denyhosts has banned

Denyhosts is a utility that automatically bans IPs who attempt to ssh in to your server and get three wrong passwords.

This is great when people are dictionary-attacking your SSH server, but less good when you have actual users who might get their password wrong.

#/bin/sh
REMOVE=$1
/etc/init.d/denyhosts stop
cd /var/lib/denyhosts
for THISFILE in hosts hosts-restricted hosts-root hosts-valid users-hosts;
do
mv $THISFILE /tmp/;
cat /tmp/$THISFILE | grep -v $REMOVE > $THISFILE;
rm /tmp/$THISFILE;
done;

mv /etc/hosts.deny /tmp/
cat /tmp/hosts.deny | grep -v $REMOVE > /etc/hosts.deny;
rm /tmp/hosts.deny

/etc/init.d/denyhosts start

Needs to run as root or someone with access to <em class=“u”> all </em> denyhost’s files (plus hosts.deny).

OR

#/bin/sh
REMOVE=$1
/usr/share/denyhosts/daemon-control stop
cd /usr/share/denyhosts/data
for THISFILE in hosts hosts-restricted hosts-root hosts-valid users-hosts;
do
mv $THISFILE /tmp;
cat /tmp/$THISFILE | grep -v $REMOVE > $THISFILE;
rm /tmp/$THISFILE;
done;
mv /etc/hosts.deny /tmp/
cat /tmp/hosts.deny | grep -v $REMOVE > /etc/hosts.deny;
rm /tmp/hosts.deny

$ /usr/share/denyhosts/daemon-control start

Source: http://www.aquarionics.com/2009/05/13/to-remove-a-host-that-denyhosts-has-banned

  • debian/hosts.deny.1645608386.txt
  • Dernière modification : 2022/02/23 10:26
  • de erreur32