Fix version number when ssh client is not available

Old sshd do not know about "-V" but output help output - with SSH
version number (without pX). Works because stderr is redirected to stdin
and output of version string looks familiar to grep expressions :)

% sshd -V
unknown option -- V
OpenSSH_8.7p1, OpenSSL 3.0.7 1 Nov 2022
This commit is contained in:
Sven Velt 2024-11-11 12:26:12 +01:00
parent 4ac6ff2cc8
commit 6f39d8db09

View file

@ -6,7 +6,7 @@
- name: Get SSH version number
shell: 'ssh -V 2>&1 | grep -Eo "OpenSSH_[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+"'
shell: 'sshd -V 2>&1 | grep -Eo "OpenSSH_[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+"'
changed_when: False
register: ssh_hardening_version