Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit 83263cf

Browse files
committed
add blocks to crypto.yml checks
moved the check for user supplied settings to block head and reversed order of assignments to compensate for the missing check on the set variable Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
1 parent 00f5f46 commit 83263cf

File tree

1 file changed

+66
-60
lines changed

1 file changed

+66
-60
lines changed

tasks/crypto.yml

Lines changed: 66 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,80 @@
11
---
2-
- name: set hostkeys according to openssh-version
3-
set_fact:
4-
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key']
5-
when: sshd_version is version('6.3', '>=') and not ssh_host_key_files
2+
- name: set hostkeys to default
3+
when: not ssh_host_key_files
4+
block:
5+
- name: set hostkeys according to openssh-version if openssh >= 5.3
6+
set_fact:
7+
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key']
8+
when: sshd_version is version('5.3', '>=')
69

7-
- name: set hostkeys according to openssh-version
8-
set_fact:
9-
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key']
10-
when: sshd_version is version('6.0', '>=') and not ssh_host_key_files
10+
- name: set hostkeys according to openssh-version if openssh >= 6.0
11+
set_fact:
12+
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key']
13+
when: sshd_version is version('6.0', '>=')
1114

12-
- name: set hostkeys according to openssh-version
13-
set_fact:
14-
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key']
15-
when: sshd_version is version('5.3', '>=') and not ssh_host_key_files
15+
- name: set hostkeys according to openssh-version if openssh >= 6.3
16+
set_fact:
17+
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key']
18+
when: sshd_version is version('6.3', '>=')
1619

17-
###
20+
- name: set macs to default
21+
when: not ssh_macs
22+
block:
23+
- name: set macs according to openssh-version if openssh >= 5.3
24+
set_fact:
25+
ssh_macs: '{{ ssh_macs_53_default }}'
26+
when: sshd_version is version('5.3', '>=')
1827

19-
- name: set macs according to openssh-version if openssh >= 7.6
20-
set_fact:
21-
ssh_macs: '{{ ssh_macs_76_default }}'
22-
when: sshd_version is version('7.6', '>=') and not ssh_macs
28+
- name: set macs for Enterprise Linux >= 6.5 (openssh 5.3 with backports)
29+
set_fact:
30+
ssh_macs: '{{ ssh_macs_53_el_6_5_default }}'
31+
when:
32+
- ansible_facts.distribution in ['CentOS', 'OracleLinux', 'RedHat']
33+
- ansible_facts.distribution_version is version('6.5', '>=')
2334

24-
- name: set macs according to openssh-version if openssh >= 6.6
25-
set_fact:
26-
ssh_macs: '{{ ssh_macs_66_default }}'
27-
when: sshd_version is version('6.6', '>=') and not ssh_macs
35+
- name: set macs according to openssh-version if openssh >= 5.9
36+
set_fact:
37+
ssh_macs: '{{ ssh_macs_59_default }}'
38+
when: sshd_version is version('5.9', '>=')
2839

29-
- name: set macs according to openssh-version
30-
set_fact:
31-
ssh_macs: '{{ ssh_macs_59_default }}'
32-
when: sshd_version is version('5.9', '>=') and not ssh_macs
40+
- name: set macs according to openssh-version if openssh >= 6.6
41+
set_fact:
42+
ssh_macs: '{{ ssh_macs_66_default }}'
43+
when: sshd_version is version('6.6', '>=')
3344

34-
- name: set macs for Enterprise Linux >= 6.5 (openssh 5.3 with backports)
35-
set_fact:
36-
ssh_macs: '{{ ssh_macs_53_el_6_5_default }}'
37-
when:
38-
- ansible_facts.distribution in ['CentOS', 'OracleLinux', 'RedHat']
39-
- ansible_facts.distribution_version is version('6.5', '>=')
40-
- not ssh_macs
45+
- name: set macs according to openssh-version if openssh >= 7.6
46+
set_fact:
47+
ssh_macs: '{{ ssh_macs_76_default }}'
48+
when: sshd_version is version('7.6', '>=')
4149

42-
- name: set macs according to openssh-version
43-
set_fact:
44-
ssh_macs: '{{ ssh_macs_53_default }}'
45-
when: sshd_version is version('5.3', '>=') and not ssh_macs
4650

47-
###
51+
- name: set ciphers to default
52+
when: not ssh_ciphers
53+
block:
54+
- name: set ciphers according to openssh-version if openssh >= 5.3
55+
set_fact:
56+
ssh_ciphers: '{{ ssh_ciphers_53_default }}'
57+
when: sshd_version is version('5.3', '>=')
4858

49-
- name: set ciphers according to openssh-version if openssh >= 6.6
50-
set_fact:
51-
ssh_ciphers: '{{ ssh_ciphers_66_default }}'
52-
when: sshd_version is version('6.6', '>=') and not ssh_ciphers
59+
- name: set ciphers according to openssh-version if openssh >= 6.6
60+
set_fact:
61+
ssh_ciphers: '{{ ssh_ciphers_66_default }}'
62+
when: sshd_version is version('6.6', '>=')
5363

54-
- name: set ciphers according to openssh-version
55-
set_fact:
56-
ssh_ciphers: '{{ ssh_ciphers_53_default }}'
57-
when: sshd_version is version('5.3', '>=') and not ssh_ciphers
64+
- name: set kex to default
65+
when: not ssh_kex
66+
block:
67+
- name: set kex according to openssh-version if openssh >= 5.9
68+
set_fact:
69+
ssh_kex: '{{ ssh_kex_59_default }}'
70+
when: sshd_version is version('5.9', '>=')
5871

59-
###
72+
- name: set kex according to openssh-version if openssh >= 6.6
73+
set_fact:
74+
ssh_kex: '{{ ssh_kex_66_default }}'
75+
when: sshd_version is version('6.6', '>=')
6076

61-
- name: set kex according to openssh-version if openssh >= 8.0
62-
set_fact:
63-
ssh_kex: '{{ ssh_kex_80_default }}'
64-
when: sshd_version is version('8.0', '>=') and not ssh_kex
65-
66-
- name: set kex according to openssh-version if openssh >= 6.6
67-
set_fact:
68-
ssh_kex: '{{ ssh_kex_66_default }}'
69-
when: sshd_version is version('6.6', '>=') and not ssh_kex
70-
71-
- name: set kex according to openssh-version
72-
set_fact:
73-
ssh_kex: '{{ ssh_kex_59_default }}'
74-
when: sshd_version is version('5.9', '>=') and not ssh_kex
77+
- name: set kex according to openssh-version if openssh >= 8.0
78+
set_fact:
79+
ssh_kex: '{{ ssh_kex_80_default }}'
80+
when: sshd_version is version('8.0', '>=')

0 commit comments

Comments
 (0)