A propos de sécurité informatique
Notes sur SSH, openSSH
Définition
Secure SHell : connection distante sécurisée.
Quelques remarques
OpenSSH supporte SSH1 et SSH2. Chaque utilisateur possède sa paire de clefs. Il peut se connecter à un serveur SSHD soit en utilisant ses clefs, soit en se connectant avec son id utilisateur connu du serveur.
Installation
Fichiers de configuration : ssh_config pour le client, sshd_config pour le serveur.
Quelques opérations essentielles
- Création de la paire de clefs (sera de type RSA1 pour SSH1)
- ssh-keygen N'entrer AUCUNE PHRASE DE PASSE, et spécifier le chemin complet des fichiers à créer.
- Pour SSH2, création des paires de clefs DSA et RSA
- ssh-keygen -t dsa
- ssh-keygen -t rsa
- Connection et ouverture de session
- ssh -l [utilisateur] [nom de l'ordinateur distant]
- Transfert de fichier
- Envoi : scp [nom fichier lu] [nom utilisateur]@[nom hote]:/[chemin]/[nom fichier sorti]
- Réception : scp [nom utilisateur]@[nom hote]:/[chemin]/[nom fichier distant] [chemin local]/[nom fichier sorti]
Configuration serveur
Voir la page de manuel man sshd_config
Port 22 #Protocol 2,1 #ListenAddress 0.0.0.0 #ListenAddress :: HostKey /etc/ssh_host_key ServerKeyBits 768 LoginGraceTime 600 KeyRegenerationInterval 3600 PermitRootLogin yes IgnoreRhosts yes IgnoreRootRhosts yes StrictModes yes X11Forwarding no X11DisplayOffset 10 PrintMotd yes KeepAlive yes SyslogFacility AUTH LogLevel INFO RhostsAuthentication no RhostsRSAAuthentication no RSAAuthentication yes # To disable tunneled clear text passwords, change to no here! PasswordAuthentication yes PermitEmptyPasswords no # Uncomment to disable s/key passwords #SkeyAuthentication no
Configuration client
Voir la page de manuel man ssh_config
# /etc/ssh/ssh_config # Default options to use when connecting to a remote host Host * # Compress the session data? Compression yes # .. using which compression level? (1 - fast/poor, 9 - slow/good) CompressionLevel 6 # Fall back to rsh if the secure connection fails? FallBackToRsh no # Should we send keep-alive messages? Useful if you use IP masquerade KeepAlive yes # Try RSA authentication? RSAAuthentication yes # Try RSA authentication in combination with .rhosts authentication? RhostsRSAAuthentication yes