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
ClusterSSH
http://sourceforge.net/apps/mediawiki/clusterssh/
ClusterSSH is a tool for making the same change on multiple servers at the same time. The 'cssh' command opens an administration console and an xterm to all specified hosts. Any text typed into the administration console is replicated to all windows. All windows may also be typed into directly.
This tool is intended for (but not limited to) cluster administration where the same configuration or commands must be run on each node within the cluster. Performing these commands all at once via this tool ensures all nodes are kept in sync.
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
Linux Keychain Guide
- Keychain
http://www.gentoo.org/doc/en/keychain-guide.xml, http://manpages.ubuntu.com/manpages/intrepid/man1/keychain.1.html, https://help.ubuntu.com/community/QuickTips#Tip%20#3%20Keychain%20-%20Manage%20ssh%20keys
- GNOME Keyring, GNOME_Keyring, gnome-keyring Reference Manual
- ssh-agent
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.
Chroot Jail
SFTP Only Chroot Jail (OpenSSH v5)
SFTP Only Chroot Jail (OpenSSH 4)
Chroot sftp: solution sftponly, bind et acl : accès sécurisé sur un serveur de sauvegarde
Tunnel
Ssh tunneling (Encrypt your HTTP Traffic and more):
Vous créez un port d'écoute qui se charge de prendre toute trame réseau qui rentre “telle quelle” et de la faire exécuter depuis l'autre bout du tunnel. ssh -D port-local nomutilisateur@nomhôte
Forwarding
ssh -C -NL 9999:localhost:5900 USER@REMOTE_HOST
- -C parameter to compress data (optional - useful for low bandwidth connections)
- -N parameter to not execute a remote command (i.e. no prompt on the remote machine)
- -L parameter for port forwarding from port 9999 on localhost to port 5900 on REMOTE_HOST.
Ne fonctionne pas toujours avec 'localhost', utiliser alors '127.0.0.1'
ssh -N -L 127.0.0.1:3307:127.0.0.1:3306 -p 30001 USER@REMOTE_HOST