Outils pour utilisateurs

Outils du site


informatique:reseau:ssh

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
informatique:reseau:ssh [24/01/2025 10:51] – [Proxying] cyrilleinformatique:reseau:ssh [21/06/2026 08:01] (Version actuelle) – [Configuration] cyrille
Ligne 1: Ligne 1:
 ====== Secure SHell (SSH) ====== ====== Secure SHell (SSH) ======
 +
 +  * https://man.openbsd.org/sshd_config
 +
 +Guides pour configurer et durcir ssh:
 +  - https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys
 +  - https://infosec.mozilla.org/guidelines/openssh
  
 ===== Configuration ===== ===== Configuration =====
 +
 +Afficher et tester la configuration complète (variables config & default) :
 +
 +<code>
 +# Afficher et tester
 +sudo sshd -T
 +# Juste tester
 +sudo sshd -t
 +</code>
  
 Dans /etc/ssh/sshd_config tu change la ligne Dans /etc/ssh/sshd_config tu change la ligne
Ligne 17: Ligne 32:
 </code> </code>
  
-Mais bon ça marche pas … +Une configuration solide:
- +
-Voici une config qui fontionne :+
  
 <code> <code>
-UsePAM no +/etc/ssh/sshd_config.d/99_custom.conf
-RSAAuthentication yes +
-PermitRootLogin without-password +
-PermitEmptyPasswords no +
-PasswordAuthentication no +
-</code>+
  
-et une autre :+#Port non standardréduit le bruit malveillants
  
-<code> +MaxAuthTries 3 
-UsePAM no +LoginGraceTime 5
-Subsystem    sftp    /usr/libexec/openssh/sftp-server +
-IgnoreRhosts yes +
-IgnoreUserKnownHosts no +
-PrintMotd yes +
-StrictModes yes +
-RSAAuthentication yes+
 PermitRootLogin no PermitRootLogin no
-PermitEmptyPasswords no 
 PasswordAuthentication no PasswordAuthentication no
-</code> +PermitEmptyPasswords no 
-==== Maintien de la connexion ====+KbdInteractiveAuthentication no 
 +#ChallengeResponseAuthentication no 
 +HostbasedAuthentication no 
 +KerberosAuthentication no 
 +GSSAPIAuthentication no 
 +PubkeyAuthentication yes 
 +AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 
 +StrictModes yes 
 +Compression no 
 +AllowTcpForwarding no 
 +X11Forwarding no 
 +AllowAgentForwarding no 
 +AllowStreamLocalForwarding no 
 +IgnoreRhosts yes
  
-<code>ServerAliveInterval +#UsePAM yes ??? 
-ServerAliveCountMax +#  -  ^=^s  Check which modules are active
-</code>+
  
-''ClientAliveInterval'' dit d'envoyer un paquet de vérification toutes les xx secondes (défaut: 0) et ''ClientAliveCountMax'' dit de couper la connexion après x messages sans réponse (défaut: 3)+HostKeyAlgorithms ssh-ed25519,rsa-sha2-512 
 +PubkeyAcceptedKeyTypes ssh-ed25519,rsa-sha2-512,rsa-sha2-256 
 +MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com 
 + 
 +# remove LC_* to avoid some "Can't set locale; make sure $LC_* and $LANG are correct!" 
 +AcceptEnv LANG 
 + 
 +ClientAliveInterval 20 
 +ClientAliveCountMax 
 +TCPKeepAlive yes 
 + 
 +</code>
  
  
Ligne 77: Ligne 101:
   * [[http://live.gnome.org/GnomeKeyring|GNOME Keyring]], [[wpen>GNOME_Keyring]], [[http://library.gnome.org/devel/gnome-keyring/stable/|gnome-keyring Reference Manual]]   * [[http://live.gnome.org/GnomeKeyring|GNOME Keyring]], [[wpen>GNOME_Keyring]], [[http://library.gnome.org/devel/gnome-keyring/stable/|gnome-keyring Reference Manual]]
   * ssh-agent   * ssh-agent
 +
 +==== sshfs ====
 +
 +Permet de monter un filesystem distant via ssh
 +
 +  * https://doc.ubuntu-fr.org/sshfs
 +
 +<code>
 +sshfs -p <port> user@sftp-server.net:/home/user/ local-folder
 +</code>
  
 ===== Tips ===== ===== Tips =====
Ligne 128: Ligne 162:
  
 Ssh tunneling (Encrypt your HTTP Traffic and more): Ssh tunneling (Encrypt your HTTP Traffic and more):
 +
 +  * https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys#setting-up-ssh-tunnels
  
 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. 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.
informatique/reseau/ssh.1737712294.txt.gz · Dernière modification : de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki