Skip to content

Commit 0bd06c7

Browse files
author
Sebastian Gumprich
committed
initial arg spec for ssh hardening
1 parent 3fb0831 commit 0bd06c7

File tree

1 file changed

+350
-0
lines changed

1 file changed

+350
-0
lines changed
Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
---
2+
argument_specs:
3+
main:
4+
short_description: The main entry point for the ssh hardening role.
5+
options:
6+
network_ipv6_enable:
7+
default: true
8+
type: bool
9+
description: false if IPv6 is not needed. `ssh_listen_to` must also be set
10+
to listen to IPv6 addresses (for example `[::]`).
11+
ssh_client_config_file:
12+
default: /etc/ssh/ssh_config
13+
description: path of the ssh client configuration file, e.g. `/etc/ssh/ssh_config.d/custom.conf`.
14+
ssh_server_config_file:
15+
default: /etc/ssh/sshd_config
16+
description: path of the ssh server configuration file, e.g. `/etc/ssh/sshd_config.d/custom.conf`.
17+
ssh_server_ports:
18+
default: ['22']
19+
type: list
20+
description: ports on which ssh-server should listen.
21+
ssh_client_port:
22+
default: '22'
23+
description: Specifies the port number to connect on the remote host.
24+
ssh_listen_to:
25+
default: [0.0.0.0]
26+
type: list
27+
description: one or more ip addresses, to which ssh-server should listen to.
28+
Default i all IPv4 addresses, but should be configured to specific addresses
29+
for security reasons
30+
ssh_host_key_files:
31+
default: []
32+
type: list
33+
description: Host keys for sshd. If empty ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key',
34+
'/etc/ssh/ssh_host_ed25519_key'] will be used, as far as supported by the
35+
installed sshd version.
36+
ssh_host_rsa_key_size:
37+
default: 4096
38+
description: Specifies the number of bits in the private host RSA key to create.
39+
ssh_host_key_algorithms:
40+
default: []
41+
type: list
42+
description: Host key algorithms that the server offers. If empty the default
43+
lst will be used. Otherwise overrides the setting with specified list of
44+
algorithms. Check `man sshd_config`, `ssh -Q HostKeyAlgorithms` or other
45+
sources for supported algorithms - make sure you check the correct version
46+
ssh_client_host_key_algorithms:
47+
default: []
48+
type: list
49+
description: Specifies the host key algorithms that the client wants to use
50+
in order of preference. If empty the default lst will be used. Otherwise
51+
overrides the setting with specified list of algorithms. Check `man ssh_config`,
52+
`ssh -Q HostKeyAlgorithms` or other sources for supported algorithms - make
53+
sure you check the correct version!
54+
ssh_client_alive_interval:
55+
default: 600
56+
description: specifies an interval for sending keepalive messages.
57+
ssh_client_alive_count:
58+
default: 3
59+
description: Defines the number of acceptable unanswered client alive messages
60+
before disconnecting clients.
61+
ssh_permit_tunnel:
62+
default: false
63+
type: bool
64+
description: true if SSH Port Tunneling is required.
65+
ssh_remote_hosts:
66+
default: []
67+
type: list
68+
description: one or more hosts and their custom options for the ssh-client.
69+
Default i empty. See examples in `defaults/ain.yml`
70+
ssh_permit_root_login:
71+
default: 'no'
72+
description: Disable root-login. Set to `'without-password'` or `'yes'` to
73+
enable root-login - The quotes are required!
74+
ssh_allow_tcp_forwarding:
75+
default: 'no'
76+
description: "'no' or `False` to disable TCP Forwarding. Set to `'yes'` or\
77+
\ `True` to allow TCP Forwarding. If you are using OpenSSH >= 6.2 version,\
78+
\ you can specify `'yes'`, `'no'`, `'all'`, `'local'`or`'remote'`."
79+
ssh_gateway_ports:
80+
default: false
81+
type: bool
82+
description: '`false` to disable binding forwarded ports to non-loopback addresses.
83+
Set to `true` to force binding on wildcard address. Set to `clientspecified`
84+
to allow the client to specify which address to bind to.'
85+
ssh_allow_agent_forwarding:
86+
default: false
87+
type: bool
88+
description: false to disable Agent Forwarding. Set to true to allow Agent
89+
Forwarding.
90+
ssh_x11_forwarding:
91+
default: false
92+
type: bool
93+
description: false to disable X11 Forwarding. Set to true to allow X11 Forwarding.
94+
ssh_pam_support:
95+
default: true
96+
type: bool
97+
description: true if SSH has PAM support.
98+
ssh_use_pam:
99+
default: true
100+
type: bool
101+
description: false to disable pam authentication.
102+
ssh_gssapi_support:
103+
default: false
104+
type: bool
105+
description: Set to true to enable GSSAPI authentication (both client and
106+
server).
107+
ssh_gssapi_delegation:
108+
default: false
109+
type: bool
110+
description: Set to true to enable GSSAPI credential forwarding.
111+
ssh_kerberos_support:
112+
default: true
113+
type: bool
114+
description: true if SSH has Kerberos support.
115+
ssh_deny_users:
116+
default: ''
117+
description: if specified, login is disallowed for user names that match one
118+
of the patterns.
119+
ssh_allow_users:
120+
default: ''
121+
description: if specified, login is allowed only for user names that match
122+
one of the patterns.
123+
ssh_deny_groups:
124+
default: ''
125+
description: if specified, login is disallowed for users whose primary group
126+
or supplementary group list matches one of the patterns.
127+
ssh_allow_groups:
128+
default: ''
129+
description: if specified, login is allowed only for users whose primary group
130+
or supplementary group list matches one of the patterns.
131+
ssh_authorized_keys_file:
132+
default: ''
133+
description: change default fle that contains the public keys that can be
134+
used for user authentication
135+
ssh_trusted_user_ca_keys_file:
136+
default: ''
137+
description: specifies the file containing trusted certificate authorities
138+
public keys used to sign user certificates.
139+
ssh_trusted_user_ca_keys:
140+
default: []
141+
type: list
142+
description: set the trusted certificate authorities public keys used to sign
143+
user certificates. Only used if `ssh_trusted_user_ca_keys_file` is set.
144+
ssh_authorized_principals_file:
145+
default: ''
146+
description: specifies the file containing principals that are allowed. Only
147+
used if `ssh_trusted_user_ca_keys_file` is set.
148+
ssh_authorized_principals:
149+
default: []
150+
type: list
151+
description: list of hashes containing file paths and authorized principals,
152+
see `default_cstom.yml` for all options. Only used if `ssh_authorized_principals_file`
153+
is set
154+
ssh_print_motd:
155+
default: false
156+
type: bool
157+
description: false to disable printing of the MOTD.
158+
ssh_print_pam_motd:
159+
default: false
160+
type: bool
161+
description: false to disable printing of the MOTD via pam (Debian and Ubuntu).
162+
ssh_print_last_log:
163+
default: false
164+
type: bool
165+
description: false to disable display of last login information.
166+
sftp_enabled:
167+
default: true
168+
type: bool
169+
description: false to disable sftp configuration.
170+
sftp_umask:
171+
default: '0027'
172+
description: Specifies the umask for sftp.
173+
sftp_chroot:
174+
default: true
175+
type: bool
176+
description: false to disable chroot for sftp.
177+
sftp_chroot_dir:
178+
default: /home/%u
179+
description: change default stp chroot location
180+
ssh_client_roaming:
181+
default: false
182+
type: bool
183+
description: enable experimental client roaming.
184+
sshd_moduli_file:
185+
default: /etc/ssh/moduli
186+
description: path to the SSH moduli file.
187+
sshd_moduli_minimum:
188+
default: 2048
189+
description: remove Diffie-Hellman parameters smaller than the defined size
190+
to mitigate logjam.
191+
ssh_challengeresponseauthentication:
192+
default: false
193+
type: bool
194+
description: Specifies whether challenge-response authentication is allowed
195+
(e.g. via PAM).
196+
ssh_client_password_login:
197+
default: false
198+
type: bool
199+
description: '`true` to allow password-based authentication with the ssh client.'
200+
ssh_server_password_login:
201+
default: false
202+
type: bool
203+
description: '`true` to allow password-based authentication to the ssh server.
204+
You probably also need to change `sshd_authenticationmethods` to include
205+
`password` if you set `ssh_server_password_login`: `true`.'
206+
ssh_banner:
207+
default: false
208+
type: bool
209+
description: '`true` to print a banner on login.'
210+
ssh_banner_path:
211+
default: /etc/sshd/banner.txt
212+
description: path to the SSH banner file.
213+
ssh_client_hardening:
214+
default: true
215+
type: bool
216+
description: '`false` to stop harden the client.'
217+
ssh_client_compression:
218+
default: false
219+
type: bool
220+
description: Specifies whether the client requests compression.
221+
ssh_compression:
222+
default: false
223+
type: bool
224+
description: Specifies whether server-side compression is enabled after the
225+
user has authenticated successfully.
226+
ssh_login_grace_time:
227+
default: 30s
228+
description: specifies the time allowed for successful authentication to the
229+
SSH server.
230+
ssh_max_auth_retries:
231+
default: 2
232+
description: Specifies the maximum number of authentication attempts permitted
233+
per connection.
234+
ssh_max_sessions:
235+
default: 10
236+
description: Specifies the maximum number of open sessions permitted from
237+
a given connection.
238+
ssh_print_debian_banner:
239+
default: false
240+
type: bool
241+
description: '`true` to print debian specific banner.'
242+
ssh_server_enabled:
243+
default: true
244+
type: bool
245+
description: '`false` to disable the opensshd server.'
246+
ssh_server_hardening:
247+
default: true
248+
type: bool
249+
description: '`false` to stop harden the server.'
250+
ssh_server_match_address:
251+
default: ''
252+
description: Introduces a conditional block. If all of the criteria on the
253+
Match line are satisfied, the keywords on the following lines override those
254+
set in the global section of the config file, until either another Match
255+
line or the end of the file.
256+
ssh_server_match_group:
257+
default: ''
258+
description: Introduces a conditional block. If all of the criteria on the
259+
Match line are satisfied, the keywords on the following lines override those
260+
set in the global section of the config file, until either another Match
261+
line or the end of the file.
262+
ssh_server_match_user:
263+
default: ''
264+
description: Introduces a conditional block. If all of the criteria on the
265+
Match line are satisfied, the keywords on the following lines override those
266+
set in the global section of the config file, until either another Match
267+
line or the end of the file.
268+
ssh_server_match_local_port:
269+
default: ''
270+
description: Introduces a conditional block. If all of the criteria on the
271+
Match line are satisfied, the keywords on the following lines override those
272+
set in the global section of the config file, until either another Match
273+
line or the end of the file.
274+
ssh_server_permit_environment_vars:
275+
default: 'no'
276+
description: "`yes` to specify that ~/.ssh/environment and environment= options\
277+
\ in ~/.ssh/authorized_keys are processed by sshd. With openssh version\
278+
\ 7.8 it is possible to specify a whitelist of environment variable names\
279+
\ in addition to global 'yes' or 'no' settings."
280+
ssh_server_accept_env_vars:
281+
default: ''
282+
description: Specifies what environment variables sent by the client will
283+
be copied into the session's environment, multiple environment variables
284+
may be separated by whitespace.
285+
ssh_use_dns:
286+
default: false
287+
type: bool
288+
description: Specifies whether sshd should look up the remote host name, and
289+
to check that the resolved host name for the remote IP address maps back
290+
to the very same IP address.
291+
ssh_server_revoked_keys:
292+
default: []
293+
type: list
294+
description: a list of revoked public keys that the ssh server will always
295+
reject, useful to revoke known weak or compromised keys.
296+
ssh_max_startups:
297+
default: 10:30:60
298+
description: Specifies the maximum number of concurrent unauthenticated connections
299+
to the SSH daemon.
300+
ssh_macs:
301+
default: []
302+
type: list
303+
description: Change this list to overwrite macs. Defaults found in `defaults/main.yml`
304+
ssh_kex:
305+
default: []
306+
type: list
307+
description: Change this list to overwrite kexs. Defaults found in `defaults/main.yml`
308+
ssh_ciphers:
309+
default: []
310+
type: list
311+
description: Change this list to overwrite ciphers. Defaults found in `defaults/main.yml`
312+
ssh_custom_options:
313+
default: []
314+
description: Custom lines for SSH client configuration.
315+
sshd_custom_options:
316+
default: []
317+
type: list
318+
description: Custom lines for SSH daemon configuration.
319+
sshd_syslog_facility:
320+
default: AUTH
321+
description: The facility code that is used when logging messages from sshd.
322+
type: str
323+
sshd_log_level:
324+
default: VERBOSE
325+
description: the verbosity level that is used when logging messages from sshd.
326+
sshd_strict_modes:
327+
default: true
328+
type: bool
329+
description: Check file modes and ownership of the user's files and home directory
330+
before accepting login.
331+
sshd_authenticationmethods:
332+
default: publickey
333+
description: Specifies the authentication methods that must be successfully
334+
completed for a user to be granted access. Make sure to set all required
335+
variables for your selected authentication method. Defaults found in `defaults/main.yml`
336+
ssh_custom_selinux_dir:
337+
default: /etc/selinux/local-policies
338+
description: directory where to store the ssh_password policy
339+
ssh_hardening_enabled:
340+
default: true
341+
type: bool
342+
description: Wether to run the hardening or not
343+
ssh_host_certificates:
344+
default: []
345+
type: list
346+
description: Host certificates to look for when starting sshd
347+
ssh_ps59:
348+
default: sandbox
349+
description: Specifies whether sshd separates privileges by creating an unprivileged
350+
child process to deal with incoming network traffic.

0 commit comments

Comments
 (0)