elnappo.secure_openssh_server
ansible-role-bezpieczny-serwer-openssh
Ustaw bezpieczną konfigurację dla serwera OpenSSH >= 6.5. Ten playbook rozszerza plik konfiguracyjny sshd zamiast go zastępować.
- Wyłącz wersję SSH 1
- Wyłącz RSAAuthentication (dostępna tylko w wersji 1)
- Nie zezwalaj na puste hasła
- Pozwól na logowanie roota tylko bez hasła
- Użyj StrictModes
- Zezwól tylko na KexAlgorithms, Ciphers i MACs, które są zalecane przez Secure Secure Shell
- Domyślnie usuwa klucze hosta DSA i ECDSA. Zmień
ssh_remove_deprecated_server_keys
, jeśli tego nie chcesz - Regeneruje klucz hosta RSA, jeśli ma mniej niż 4096 bitów (domyślnie)
- Wyłącz logowanie za hasłem domyślnie, co również ustawia
MaxAuthTries 1
iLoginGraceTime 30
Zalecana konfiguracja ~/.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 dla połączeń dziedzicznych: alias ssh_ignore="ssh -F /dev/null"
Zainspirowane przez
- Secure Secure Shell
- Wiki Mozilli - Bezpieczeństwo/wytyczne/OpenSSH
- BetterCrypto
- Podręcznik sshd_config
Wymagania
- Ubuntu lub Debian
- OpenSSH Server >= 6.5 (dostępny w Ubuntu >= 14.04 i Debian >= 8)
Zmienne roli
ssh_sshd_config_dir: /etc/ssh/
ssh_sshd_config_path: "{{ ssh_sshd_config_dir }}sshd_config"
ssh_permit_root_login: "without-password"
cudzysłowy są obowiązkowe!ssh_disable_password_login: true
ssh_remove_deprecated_server_keys: true
wyłącza DSA, ECDSA i regeneruje klucz RSA, jeśli <ssh_host_rsa_key_length
ssh_host_rsa_key_length: 4096
ssh_setup_ufw: true
ssh_port: 22
Zależności
Brak.
Przykładowy Playbook
- hosts: server
remote_user: root
vars:
- ssh_remove_deprecated_server_keys: false
- ssh_port: 1813
roles:
- { role: elnappo.secure_openssh_server }
Licencja
MIT
Informacje o autorze
elnappo elnappo@nerdpol.io
Zainstaluj
ansible-galaxy install elnappo.secure_openssh_server
Licencja
Unknown
Pobrania
80
Właściciel