You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 26, 2020. It is now read-only.
- Don't overwrite ssh\_host\_key\_files if set manually [\#125](https://github.com/dev-sec/ansible-ssh-hardening/pull/125) ([oakey-b1](https://github.com/oakey-b1))
29
+
- Add comment filter to {{ansible\_managed}} string [\#121](https://github.com/dev-sec/ansible-ssh-hardening/pull/121) ([fazlearefin](https://github.com/fazlearefin))
Copy file name to clipboardExpand all lines: README.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,19 +27,21 @@ Warning: This role disables root-login on the target server! Please make sure yo
27
27
|`ssh_server_ports`|['22']|ports on which ssh-server should listen|
28
28
|`ssh_client_port`| '22' |port to which ssh-client should connect|
29
29
|`ssh_listen_to`|['0.0.0.0']|one or more ip addresses, to which ssh-server should listen to. Default is all adresseses, but should be configured to specific addresses for security reasons!|
30
-
|`ssh_host_key_files`|['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_dsa_key', '/etc/ssh/ssh_host_ecdsa_key']|Host keys to look for when starting sshd.|
30
+
|`ssh_host_key_files`|[]|Host keys for sshd. If empty ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key']will be used, as far as supported by the installed sshd version|
31
31
|`ssh_client_alive_interval`| 600 | specifies an interval for sending keepalive messages |
32
32
|`ssh_client_alive_count`| 3 | defines how often keep-alive messages are sent |
33
33
|`ssh_permit_tunnel`| false | true if SSH Port Tunneling is required |
34
34
|`ssh_remote_hosts`|[]| one or more hosts and their custom options for the ssh-client. Default is empty. See examples in `defaults/main.yml`.|
35
35
|`ssh_allow_root_with_key`| false | false to disable root login altogether. Set to true to allow root to login via key-based mechanism.|
36
36
|`ssh_allow_tcp_forwarding`| false | false to disable TCP Forwarding. Set to true to allow TCP Forwarding.|
37
+
|`ssh_gateway_ports`|`false`|`false` to disable binding forwarded ports to non-loopback addresses. Set to `true` to force binding on wildcard address. Set to `clientspecified` to allow the client to specify which address to bind to.|
37
38
|`ssh_allow_agent_forwarding`| false | false to disable Agent Forwarding. Set to true to allow Agent Forwarding.|
38
39
|`ssh_use_pam`| false | false to disable pam authentication.|
39
40
|`ssh_deny_users`| '' | if specified, login is disallowed for user names that match one of the patterns.|
40
41
|`ssh_allow_users`| '' | if specified, login is allowed only for user names that match one of the patterns.|
41
42
|`ssh_deny_groups`| '' | if specified, login is disallowed for users whose primary group or supplementary group list matches one of the patterns.|
42
43
|`ssh_allow_groups`| '' | if specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns.|
44
+
|`ssh_authorized_keys_file`| '' | change default file that contains the public keys that can be used for user authentication.|
43
45
|`ssh_print_motd`| false | false to disable printing of the MOTD|
44
46
|`ssh_print_last_log`| false | false to disable display of last login information|
45
47
|`sftp_enabled`| false | true to enable sftp configuration|
@@ -49,7 +51,22 @@ Warning: This role disables root-login on the target server! Please make sure yo
49
51
|`ssh_challengeresponseauthentication`| false | Specifies whether challenge-response authentication is allowed (e.g. via PAM) |
50
52
|`ssh_client_password_login`| false |`true` to allow password-based authentication with the ssh client |
51
53
|`ssh_server_password_login`| false |`true` to allow password-based authentication with the ssh server |
54
+
<<<<<<< HEAD
52
55
|`ssh_google_auth`| false |`true` to enable google authenticator based TOTP 2FA |
56
+
=======
57
+
|`ssh_banner`|`false`|`true` to print a banner on login |
58
+
|`ssh_client_hardening`|`true`|`false` to stop harden the client |
59
+
|`ssh_client_port`|`'22'`| Specifies the port number to connect on the remote host. |
60
+
|`ssh_compression`|`false`| Specifies whether compression is enabled after the user has authenticated successfully. |
61
+
|`ssh_max_auth_retries`|`2`| Specifies the maximum number of authentication attempts permitted per connection. |
62
+
|`ssh_print_debian_banner`|`false`|`true` to print debian specific banner |
63
+
|`ssh_server_enabled`|`true`|`false` to disable the opensshd server |
64
+
|`ssh_server_hardening`|`true`|`false` to stop harden the server |
65
+
|`ssh_server_match_group`| '' | Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. |
66
+
|`ssh_server_match_user`| '' | Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. |
67
+
|`ssh_server_permit_environment_vars`|`false`|`true` to specify that ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd |
68
+
|`ssh_use_dns`|`false`| Specifies whether sshd should look up the remote host name, and to check that the resolved host name for the remote IP address maps back to the very same IP address. |
69
+
>>>>>>> upstream/master
53
70
|`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.|
# Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged.
- name: test to see if selinux is installed and running
58
60
command: getenforce
59
61
register: sestatus
60
62
failed_when: false
61
63
changed_when: false
62
64
check_mode: no
63
65
66
+
<<<<<<< HEAD
64
67
# Install the 2FA packages and setup the config in PAM and SSH
65
68
66
69
- block:
@@ -101,7 +104,7 @@
101
104
- ssh_google_auth
102
105
103
106
104
-
- block: # only runs when selinux is running
107
+
- block: # only runs when selinux is installed
105
108
- name: install selinux dependencies when selinux is installed on RHEL or Oracle Linux
106
109
package: name="{{item}}" state=installed
107
110
with_items:
@@ -143,7 +146,7 @@
143
146
144
147
when: not ssh_use_pam and sestatus.stdout != 'Disabled' and ssh_password_module.stdout.find('ssh_password') != 0
145
148
146
-
# The following tasks only get executed when selinux is in state enforcing, UsePam is "yes" and the ssh_password module is installed.
149
+
# The following tasks only get executed when selinux is installed, UsePam is "yes" and the ssh_password module is installed.
147
150
- name: remove selinux-policy when Pam is used, because Allowing sshd to read the shadow file directly is considered a potential security risk (http://danwalsh.livejournal.com/12333.html)
148
151
command: semodule -r ssh_password
149
152
when: ssh_use_pam and ssh_password_module.stdout.find('ssh_password') == 0
0 commit comments