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

Commit 96053b7

Browse files
authored
Merge pull request #187 from Neophy7e/fixes/use-ansible-version-compare
Use ansible version compare module
2 parents 45dd45b + e0e2ea5 commit 96053b7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Warning: This role disables root-login on the target server! Please make sure yo
1212

1313
## Requirements
1414

15-
* Ansible > 2.4
15+
* Ansible > 2.5
1616

1717
## Role Variables
1818
| Name | Default Value | Description |

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ galaxy_info:
44
description: 'This Ansible role provides numerous security-related ssh configurations, providing all-round base protection.'
55
company: Hardening Framework Team
66
license: Apache License 2.0
7-
min_ansible_version: '2.4'
7+
min_ansible_version: '2.5'
88
platforms:
99
- name: EL
1010
versions:

templates/openssh.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ForwardX11 no
8282

8383
# Never use host-based authentication. It can be exploited.
8484
HostbasedAuthentication no
85-
{% if sshd_version.stdout | float < 7.4 -%}
85+
{% if sshd_version.stdout is version('7.4', '<') %}
8686
RhostsRSAAuthentication no
8787
# Enable RSA authentication via identity files.
8888
RSAAuthentication yes
@@ -111,7 +111,7 @@ Compression yes
111111
#EscapeChar ~
112112
#VisualHostKey yes
113113

114-
{% if sshd_version.stdout | float <= 7.1 -%}
114+
{% if sshd_version.stdout is version('7.1', '<=') %}
115115
# Disable experimental client roaming. This is known to cause potential issues with secrets being disclosed to malicious servers and defaults to being disabled.
116116
UseRoaming {{ 'yes' if ssh_client_roaming else 'no' }}
117117
{% endif %}

templates/opensshd.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ LogLevel VERBOSE
7575
# --------------
7676

7777
# Secure Login directives.
78-
{% if sshd_version.stdout | float < 7.5 -%}
78+
{% if sshd_version.stdout is version('7.5', '<') %}
7979
UsePrivilegeSeparation {% if (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') or (ansible_os_family in ['Oracle Linux', 'RedHat'] and ansible_distribution_major_version <= '6') -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
8080
{% endif %}
8181

0 commit comments

Comments
 (0)