elnappo.secure_openssh_server
ansible-role-secure-openssh-server
OpenSSHサーバー (バージョン6.5以上) のための安全な設定を行います。このプレイブックは、sshd設定ファイルを置き換えるのではなく拡張します。
- SSHバージョン1を無効にする
- RSA認証を無効にする(バージョン1でのみ使用可能)
- 空のパスワードを許可しない
- パスワードなしでのみルートログインを許可する
- StrictModesを使用する
- Secure Secure Shellによって推奨されたKexAlgorithms、Ciphers、およびMACのみを許可する
- デフォルトでDSAおよびECDSAホストキーを削除します。これが不要な場合は
ssh_remove_deprecated_server_keys
を変更してください - 4096ビット未満の場合、RSAホストキーを再生成する(デフォルト)
- デフォルトでパスワードログインを無効にし、
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サーバー >= 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を無効にし、ssh_host_rsa_key_length
が<の場合はRSAキーを再生成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
所有者