Skip to content

Commit 503edb4

Browse files
authored
Remove SSH settings validation (#1614)
This is a complex validation that was overly defensive and mostly needed back when new OpenSSH ciphers caused more version incompatibilities in ~2016. These incompatibilities are much less likely to occur now so we can remove these validations.
1 parent 2bc7bfe commit 503edb4

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

roles/common/defaults/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,3 @@ apt_packages_default:
1818

1919
apt_packages_custom: {}
2020
apt_packages: "{{ apt_packages_default | combine(apt_packages_custom) }}"
21-
22-
openssh_6_8_plus: "{{ (lookup('pipe', 'ssh -V 2>&1')) | regex_replace('(.*OpenSSH_([\\d\\.]*).*)', '\\2') is version_compare('6.8', '>=') }}"
23-
overlapping_ciphers: "[{% for cipher in (sshd_ciphers_default + sshd_ciphers_extra) if cipher in ssh_client_ciphers %}'{{ cipher }}',{% endfor %}]"
24-
overlapping_kex: "[{% for kex in (sshd_kex_algorithms_default + sshd_kex_algorithms_extra) if kex in ssh_client_kex %}'{{ kex }}',{% endfor %}]"
25-
overlapping_macs: "[{% for mac in (sshd_macs_default + sshd_macs_extra) if mac in ssh_client_macs %}'{{ mac }}',{% endfor %}]"
26-
host_key_types: "[{% for path in sshd_host_keys %}'{{ path | regex_replace('/etc/ssh/ssh_host_(.+)_key', '\\1') | regex_replace('dsa', 'ssh-dss')}}',{% endfor %}]"
27-
overlapping_host_keys: "{% for key in host_key_types if key in ssh_client_host_key_algorithms %}{{ key }},{% endfor %}"

roles/common/tasks/main.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,6 @@
7474
Staging/Production: Create a new server with Ubuntu 20.04 and provision
7575
when: ansible_distribution_version is version('18.04', '<')
7676

77-
- name: Retrieve local SSH client's settings per host
78-
set_fact:
79-
ssh_client_ciphers: "{{ lookup('pipe', 'ssh -ttG ' + ansible_host + ' | grep ciphers') }}"
80-
ssh_client_kex: "{{ lookup('pipe', 'ssh -ttG ' + ansible_host + ' | grep kexalgorithms') }}"
81-
ssh_client_macs: "{{ lookup('pipe', 'ssh -ttG ' + ansible_host + ' | grep macs') }}"
82-
ssh_client_host_key_algorithms: "{{ lookup('pipe', 'ssh -ttG ' + ansible_host + ' | grep hostkeyalgorithms') }}"
83-
when: openssh_6_8_plus and validate_ssh | default(true)
84-
tags: [sshd]
85-
86-
- name: Validate compatible settings between SSH client and server
87-
assert:
88-
that:
89-
- overlapping_ciphers | count
90-
- overlapping_kex | count
91-
- overlapping_macs | count
92-
- overlapping_host_keys | count
93-
msg: "{{ lookup('template', 'validate_ssh_msg.j2') }}"
94-
when: openssh_6_8_plus and validate_ssh | default(true)
95-
tags: [sshd]
96-
9777
- name: Clean old APT sources
9878
import_tasks: clean-apt-sources.yml
9979
when: apt_clean_sources | default(false)

roles/common/templates/validate_ssh_msg.j2

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)