elnappo.secure_openssh_server
ansible-role-secure-openssh-server
Настройте безопасную конфигурацию для OpenSSH Server >= 6.5. Этот плейбук дополняет ваш файл конфигурации sshd, а не заменяет его.
- Отключить SSH версию 1
- Отключить RSAAuthentication (доступно только в версии 1)
- Не разрешать пустые пароли
- Разрешить вход под root только без пароля
- Использовать StrictModes
- Разрешить только KexAlgorithms, Ciphers и MACs, которые были рекомендованы в Secure Secure Shell
- По умолчанию удалить ключи хоста DSA и ECDSA. Измените
ssh_remove_deprecated_server_keys
, если это вам не нужно - Перегенерировать RSA ключ хоста, если его длина меньше 4096 бит (по умолчанию)
- Отключить вход по паролю по умолчанию, что также устанавливает
MaxAuthTries 1
иLoginGraceTime 30
Рекомендуемая конфигурация ~/.ssh/config
, /etc/ssh/ssh_config
Host *
HashKnownHosts yes
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
псевдоним для устаревших подключений: alias ssh_ignore="ssh -F /dev/null"
Вдохновение
Требования
- Ubuntu или Debian
- OpenSSH Server >= 6.5 (который доступен в Ubuntu >= 14.04 и Debian >= 8)
Переменные роли
ssh_sshd_config_dir: /etc/ssh/
ssh_sshd_config_path: "{{ ssh_sshd_config_dir }}sshd_config"
ssh_permit_root_login: "without-password"
кавычки обязательны!ssh_disable_password_login: true
ssh_remove_deprecated_server_keys: true
отключает DSA, ECDSA и перегенерирует RSA ключ, если <ssh_host_rsa_key_length
ssh_host_rsa_key_length: 4096
ssh_setup_ufw: true
ssh_port: 22
Зависимости
Нет.
Пример плейбука
- hosts: server
remote_user: root
vars:
- ssh_remove_deprecated_server_keys: false
- ssh_port: 1813
roles:
- { role: elnappo.secure_openssh_server }
Лицензия
MIT
Информация об авторе
elnappo elnappo@nerdpol.io
Установить
ansible-galaxy install elnappo.secure_openssh_server
Лицензия
Unknown
Загрузки
80
Владелец