D'Inverno Jeremy wrote:
Bonjour,
Je souhaiterais, dans le cadre de la sécurisation d'un serveur,
supprimer l'information du service ssh.
Un truc que j'aime assez, c'est de travailler avec /etc/hosts.{allow,deny}.
Pour que cela fonctionne, tu dis que tu autorises seulement les machines
avec une certaine adresse IP. Et si la personne qui veut acceder a ce
service a une adresse IP changeante. Tu n'as qu'a faire un script qui
une fois par minute resoud les FQDN. Dans mon cas, je demande aux
utilisateurs d'utiliser un service comme DynDns et de me donner le nom
qu'ils ont chez DynDns.
/etc/hosts.deny:
ALL:ALL
/etc/hosts.allow:
shd2:/etc/ssh_hosts.allow
/etc/ssh_hosts.toallow:
ma_machine.dyndns.org
ca_machine.selfip.org
...
et le script transforme ce ssh_hosts.toallow en ssh_hosts.allow
/etc/ssh_hosts.allow:
10.12.87.59
12.78.56.128
...
et le script:
#!/bin/bash
echo '#generated automatically from /etc/ssh_hosts.toallow'\
>/etc/ssh_hosts.allow.tmp
echo '# and used in /etc/hosts.allow'\
>>/etc/ssh_hosts.allow.tmp
cat /etc/ssh_hosts.toallow | \
while read line
do
echo '' >> /etc/ssh_hosts.allow.tmp
echo "#${line}" >> /etc/ssh_hosts.allow.tmp
ip=$(/usr/bin/host $line | grep 'has address' \
| /usr/bin/awk '{print $4 }')
if [ -z "$ip" ]
then
echo '#no ip found !' >> /etc/ssh_hosts.allow.tmp
else
echo $ip >> /etc/ssh_hosts.allow.tmp
fi
done
mv /etc/ssh_hosts.allow.tmp /etc/ssh_hosts.allow
mes deux sous.
Ced.
--
Cedric BRINER
23 ch. Salomon-PENAY | mel mailto:[EMAIL PROTECTED]
CH-1217 Meyrin | voip callto:[EMAIL PROTECTED]
|
| tel::maison: +41(0)32/510-6739
| tel::portable +41(0)78/665-9701
| tel::travail +41(0)22/379-2356
_______________________________________________
gull mailing list
[email protected]
http://lists.alphanet.ch/mailman/listinfo/gull