Ceci est une ancienne révision du document !
Table des matières
Secure SHell
Configuration
Dans /etc/ssh/sshd_config tu change la ligne
PermitRootLogin Yes en PermitRootLogin No
Et si tu veux autoriser l'accès ssh en root uniquement avec clé ssh tu mets :
PermitRootLogin without-password
Mais bon ça marche pas …
Voici une config qui fontionne :
UsePAM no RSAAuthentication yes PermitRootLogin without-password PermitEmptyPasswords no PasswordAuthentication no
et une autre :
UsePAM no Subsystem sftp /usr/libexec/openssh/sftp-server IgnoreRhosts yes IgnoreUserKnownHosts no PrintMotd yes StrictModes yes RSAAuthentication yes PermitRootLogin no PermitEmptyPasswords no PasswordAuthentication no
Clients
Clients pour Windows
http://www.openssh.com/windows.html
http://www.funix.org/fr/windows/ssh.htm
SSH Tectia Client (previously SSH Secure Shell for Workstations) :
http://www.ssh.com/support/downloads/secureshellwks/non-commercial.html
Tunnelier : http://www.bitvise.com/tunnelier.html
PuTTY : http://www.chiark.greenend.org.uk/~sgtatham/putty/
SharpSSH - A Secure Shell (SSH) library for .NET: http://www.tamirgal.com/blog/page/SharpSSH.aspx
Tips
Logs
comment demander gentilement a sshd de logger tout ce qui se passe connexion/deconnexions dans un fichier /var/log/sshd.log ?
voir /etc/syslog.conf
# ATTENTION : local5 est utilisé notamment par sshd local5.info /var/log/sshd
Email automatique lors de la connexion
Email automatique pour toute connexion ssh:
créer le fichier /etc/ssh/sshrc avec:
email="$USER@"`hostname` ldate=`date "+%A %e %B %Y à %Hh%M %Z"` echo -e "Bonjour,\n\nUne session SSH version $SHLVL à été ouverte\n\ncompte: $email\n\ndate: $ldate\n\nconnexion: $SSH_CONNECTION." | mail -s "connexion ssh" monemail@mondomaine.com
Blacklister les Ips indésirables
Avec le script ssh-blacklist, voir ssh_scanning.