Skip to content

Commit c55f95b

Browse files
committed
Provide granular noop for shh configuration
1 parent 3f3e8cf commit c55f95b

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

roles/ssh_hardening/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ For more information, see [this issue](https://github.com/dev-sec/ansible-collec
140140
- Required: no
141141
- `ssh_ciphers`
142142
- Default: ``
143-
- Description: Change this list to overwrite ciphers. Defaults found in `defaults/main.yml`
143+
- Description: Change this list to overwrite ciphers. If false this configuration will be skipped. Defaults found in `defaults/main.yml`
144144
- Type: list
145145
- Required: no
146146
- `ssh_client_alive_count`
@@ -240,7 +240,7 @@ For more information, see [this issue](https://github.com/dev-sec/ansible-collec
240240
- Required: no
241241
- `ssh_host_key_algorithms`
242242
- Default: ``
243-
- Description: Host key algorithms that the server offers. If empty the default list will be used. Otherwise overrides the setting with specified list of algorithms. Check `man sshd_config`, `ssh -Q HostKeyAlgorithms` or other sources for supported algorithms - make sure you check the correct version
243+
- Description: Host key algorithms that the server offers. If empty the default list will be used. If false this configuration will be skipped. Otherwise overrides the setting with specified list of algorithms. Check `man sshd_config`, `ssh -Q HostKeyAlgorithms` or other sources for supported algorithms - make sure you check the correct version
244244
- Type: list
245245
- Required: no
246246
- `ssh_host_key_files`
@@ -260,7 +260,7 @@ For more information, see [this issue](https://github.com/dev-sec/ansible-collec
260260
- Required: no
261261
- `ssh_kex`
262262
- Default: ``
263-
- Description: Change this list to overwrite kexs. Defaults found in `defaults/main.yml`
263+
- Description: Change this list to overwrite kexs. If false this configuration will be skipped. Defaults found in `defaults/main.yml`
264264
- Type: list
265265
- Required: no
266266
- `ssh_listen_to`
@@ -275,7 +275,7 @@ For more information, see [this issue](https://github.com/dev-sec/ansible-collec
275275
- Required: no
276276
- `ssh_macs`
277277
- Default: ``
278-
- Description: Change this list to overwrite macs. Defaults found in `defaults/main.yml`
278+
- Description: Change this list to overwrite macs. If false this configuration will be skipped. Defaults found in `defaults/main.yml`
279279
- Type: list
280280
- Required: no
281281
- `ssh_max_auth_retries`

roles/ssh_hardening/defaults/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ssh_client_port: "22" # ssh
4141
ssh_listen_to: [0.0.0.0] # sshd
4242

4343
# Host keys to look for when starting sshd.
44-
ssh_host_key_files: [] # sshd
44+
ssh_host_key_files: none # sshd
4545

4646
# Host RSA key size in bits
4747
ssh_host_rsa_key_size: 4096 # sshd
@@ -206,9 +206,9 @@ ssh_max_startups: 10:30:60 # sshd
206206

207207
ssh_ps59: sandbox
208208

209-
ssh_macs: []
210-
ssh_ciphers: []
211-
ssh_kex: []
209+
ssh_macs: none
210+
ssh_ciphers: none
211+
ssh_kex: none
212212
# directory where to store ssh_password policy
213213
ssh_custom_selinux_dir: /etc/selinux/local-policies
214214

roles/ssh_hardening/tasks/hardening.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@
3535
ansible.builtin.set_fact:
3636
sshd_version: "{{ sshd_version_raw.stderr | regex_replace('.*_([0-9]*.[0-9]).*', '\\1') }}"
3737

38-
- name: Set default for ssh_host_key_files if not supplied
38+
- name: Set default for ssh_host_key_files if none
3939
ansible.builtin.include_tasks: crypto_hostkeys.yml
4040
when:
4141
- ssh_server_hardening | bool
42-
- not ssh_host_key_files
42+
- ssh_host_key_files is none
4343

44-
- name: Set default for ssh_macs if not supplied
44+
- name: Set default for ssh_macs if none
4545
ansible.builtin.include_tasks: crypto_macs.yml
46-
when: not ssh_macs
46+
when: ssh_macs is none
4747

48-
- name: Set default for ssh_ciphers if not supplied
48+
- name: Set default for ssh_ciphers if none
4949
ansible.builtin.include_tasks: crypto_ciphers.yml
50-
when: not ssh_ciphers
50+
when: ssh_ciphers is none
5151

52-
- name: Set default for ssh_kex if not supplied
52+
- name: Set default for ssh_kex if none
5353
ansible.builtin.include_tasks: crypto_kex.yml
54-
when: not ssh_kex
54+
when: ssh_kex is none
5555

5656
- name: Create revoked_keys and set permissions to root/600
5757
ansible.builtin.template:

0 commit comments

Comments
 (0)