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

Commit 5e47ffa

Browse files
committed
split crypto.yml in several playbooks
preserve the version ordering of defaults and group all tasks according to base configuration variable (cipthers, hostkeys, kex and macs) Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
1 parent 83263cf commit 5e47ffa

File tree

5 files changed

+71
-72
lines changed

5 files changed

+71
-72
lines changed

tasks/crypto.yml

Lines changed: 4 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,12 @@
11
---
2-
- name: set hostkeys to default
2+
- include_tasks: crypto_hostkeys.yml
33
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', '>=')
94

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', '>=')
14-
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', '>=')
19-
20-
- name: set macs to default
5+
- include_tasks: crypto_macs.yml
216
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', '>=')
27-
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', '>=')
34-
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', '>=')
39-
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', '>=')
447

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', '>=')
49-
50-
51-
- name: set ciphers to default
8+
- include_tasks: crypto_ciphers.yml
529
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', '>=')
58-
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', '>=')
6310

64-
- name: set kex to default
11+
- include_tasks: crypto_kex.yml
6512
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', '>=')
71-
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', '>=')
76-
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', '>=')

tasks/crypto_ciphers.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: set ciphers according to openssh-version if openssh >= 5.3
3+
set_fact:
4+
ssh_ciphers: '{{ ssh_ciphers_53_default }}'
5+
when: sshd_version is version('5.3', '>=')
6+
7+
- name: set ciphers according to openssh-version if openssh >= 6.6
8+
set_fact:
9+
ssh_ciphers: '{{ ssh_ciphers_66_default }}'
10+
when: sshd_version is version('6.6', '>=')

tasks/crypto_hostkeys.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: set hostkeys according to openssh-version if openssh >= 5.3
3+
set_fact:
4+
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key']
5+
when: sshd_version is version('5.3', '>=')
6+
7+
- name: set hostkeys according to openssh-version if openssh >= 6.0
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', '>=')
11+
12+
- name: set hostkeys according to openssh-version if openssh >= 6.3
13+
set_fact:
14+
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key']
15+
when: sshd_version is version('6.3', '>=')

tasks/crypto_kex.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: set kex according to openssh-version if openssh >= 5.9
3+
set_fact:
4+
ssh_kex: '{{ ssh_kex_59_default }}'
5+
when: sshd_version is version('5.9', '>=')
6+
7+
- name: set kex according to openssh-version if openssh >= 6.6
8+
set_fact:
9+
ssh_kex: '{{ ssh_kex_66_default }}'
10+
when: sshd_version is version('6.6', '>=')
11+
12+
- name: set kex according to openssh-version if openssh >= 8.0
13+
set_fact:
14+
ssh_kex: '{{ ssh_kex_80_default }}'
15+
when: sshd_version is version('8.0', '>=')

tasks/crypto_macs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
- name: set macs according to openssh-version if openssh >= 5.3
3+
set_fact:
4+
ssh_macs: '{{ ssh_macs_53_default }}'
5+
when: sshd_version is version('5.3', '>=')
6+
7+
- name: set macs for Enterprise Linux >= 6.5 (openssh 5.3 with backports)
8+
set_fact:
9+
ssh_macs: '{{ ssh_macs_53_el_6_5_default }}'
10+
when:
11+
- ansible_facts.distribution in ['CentOS', 'OracleLinux', 'RedHat']
12+
- ansible_facts.distribution_version is version('6.5', '>=')
13+
14+
- name: set macs according to openssh-version if openssh >= 5.9
15+
set_fact:
16+
ssh_macs: '{{ ssh_macs_59_default }}'
17+
when: sshd_version is version('5.9', '>=')
18+
19+
- name: set macs according to openssh-version if openssh >= 6.6
20+
set_fact:
21+
ssh_macs: '{{ ssh_macs_66_default }}'
22+
when: sshd_version is version('6.6', '>=')
23+
24+
- name: set macs according to openssh-version if openssh >= 7.6
25+
set_fact:
26+
ssh_macs: '{{ ssh_macs_76_default }}'
27+
when: sshd_version is version('7.6', '>=')

0 commit comments

Comments
 (0)