This repository was archived by the owner on Dec 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +16
-0
lines changed Expand file tree Collapse file tree 5 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ Warning: This role disables root-login on the target server! Please make sure yo
49
49
| ` ssh_challengeresponseauthentication ` | false | Specifies whether challenge-response authentication is allowed (e.g. via PAM) |
50
50
| ` ssh_client_password_login ` | false | ` true ` to allow password-based authentication with the ssh client |
51
51
| ` ssh_server_password_login ` | false | ` true ` to allow password-based authentication with the ssh server |
52
+ | ` ssh_server_revoked_keys ` | [ ] | a list of revoked public keys that the ssh server will always reject, useful to revoke known weak or compromised keys.|
52
53
53
54
## Example Playbook
54
55
Original file line number Diff line number Diff line change @@ -160,3 +160,6 @@ ssh_challengeresponseauthentication: false
160
160
161
161
# look up the remote host name, defaults to false from 6.8, see: http://www.openssh.com/txt/release-6.8
162
162
ssh_use_dns : false
163
+
164
+ # a list of public keys that are never accepted by the ssh server
165
+ ssh_server_revoked_keys : []
Original file line number Diff line number Diff line change 28
28
ssh_host_key_files : ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key']
29
29
when : sshd_version.stdout >= '6.3'
30
30
31
+ - name : create revoked_keys and set permissions to root/600
32
+ template : src='revoked_keys.j2' dest='/etc/ssh/revoked_keys' mode=0600 owner="{{ ssh_owner }}" group="{{ ssh_group }}"
33
+ notify : restart sshd
34
+ when : ssh_server_hardening
35
+
31
36
- name : create sshd_config and set permissions to root/600
32
37
template : src='opensshd.conf.j2' dest='/etc/ssh/sshd_config' mode=0600 owner="{{ ssh_owner }}" group="{{ ssh_group }}" validate="/usr/sbin/sshd -T -f %s"
33
38
notify : restart sshd
Original file line number Diff line number Diff line change @@ -208,6 +208,9 @@ Banner {{ '/etc/ssh/banner.txt' if ssh_banner else 'none' }}
208
208
DebianBanner {{ 'yes' if ssh_print_debian_banner else 'no' }}
209
209
{% endif %}
210
210
211
+ # Reject keys that are explicitly blacklisted
212
+ RevokedKeys /etc/ssh/revoked_keys
213
+
211
214
{% if sftp_enabled %}
212
215
# Configuration, in case SFTP is used
213
216
## override default of no subsystems
Original file line number Diff line number Diff line change
1
+ # {{ansible_managed}}
2
+ {% for key in ssh_server_revoked_keys %}
3
+ {{key}}
4
+ {% endfor %}
You can’t perform that action at this time.
0 commit comments