Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente |
serveur:ssh [2024/11/01 15:58] – [Fichier de configuration du client] d2air | serveur:ssh [2024/11/01 20:06] (Version actuelle) – [Fichier de configuration du client] d2air |
---|
==== Fichier de configuration du serveur ==== | ==== Fichier de configuration du serveur ==== |
Cette configuration désactive la connexion par l'utilisateur root, elle interdit l'authentification par un mot de passe et la remplace par une clef. | Cette configuration désactive la connexion par l'utilisateur root, elle interdit l'authentification par un mot de passe et la remplace par une clef. |
Copiez ce fichier dans /etc/ssh/sshd_config.d/ | Copiez la configuration suivante dans un fichier se terminant par .conf dans le répertoire : /etc/ssh/sshd_config.d/ |
<file sh sshd_config> | <file sh sshd_config_local.conf> |
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ | |
| |
# This is the sshd server system-wide configuration file. See | |
# sshd_config(5) for more information. | |
| |
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
| |
# The strategy used for options in the default sshd_config shipped with | |
# OpenSSH is to specify options with their default value where | |
# possible, but leave them commented. Uncommented options override the | |
# default value. | |
Port 1234 | Port 1234 |
#AddressFamily any | #AddressFamily any |
# Ciphers and keying | # Ciphers and keying |
#RekeyLimit default none | #RekeyLimit default none |
#https://www.securiteinfo.com/cryptographie/renforcer-cryptage-ssh.shtml | Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-gcm@openssh.com,aes128-ctr |
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-gcm@openssh.com | HostKeyAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256 |
HostKeyAlgorithms rsa-sha2-512,rsa-sha2-256,ssh-ed25519 | KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,gss-curve25519-sha256-,diffie-hellman-group16-sha512,gss-group16-sha512-,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256 |
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512 | MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com |
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com | PubkeyAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-256 |
| HostbasedAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-256 |
| CASignatureAlgorithms sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256 |
| GSSAPIKexAlgorithms gss-curve25519-sha256-,gss-group16-sha512- |
| |
# Logging | # Logging |
PubkeyAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256 | PubkeyAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256 |
</file> | </file> |
Le site [[https://www.ssh-audit.com/hardening_guides.html|SSH Audit]] propose des exemples de configurations adaptées. | Les sites [[https://www.ssh-audit.com/hardening_guides.html|SSH Audit]] et [[https://www.securiteinfo.com/cryptographie/renforcer-cryptage-ssh.shtml|Sécurité Info]] proposent des exemples de configurations adaptées. |
==== Redémarrer SSH ==== | ==== Redémarrer SSH ==== |
<code> | <code> |
systemctl restart ssh.service | systemctl restart ssh.service |
</code> | </code> |