From 6f39d8db092a8f2ea6af56c02174db6f31418941 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Mon, 11 Nov 2024 12:26:12 +0100 Subject: [PATCH] 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 --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 713621b..8712f84 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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