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

Commit 45eb0e2

Browse files
author
Sebastian Gumprich
committed
Oracle support
- Add check for Oracle operating systems - Add minus sign to remove whitespace
1 parent ccf58ca commit 45eb0e2

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

roles/ansible-ssh-hardening/templates/openssh.conf.j2

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
# ===================
1010

1111
# Address family should always be limited to the active network configuration.
12-
AddressFamily {% if network_ipv6_enable %}any{% else %}inet{% endif %}
12+
AddressFamily {% if network_ipv6_enable -%}any{% else -%}inet{% endif %}
1313

1414
# Restrict the following configuration to be limited to this Host.
15-
{% for host in ssh_remote_hosts %}
15+
{% for host in ssh_remote_hosts -%}
1616
Host {{host}}
1717
{% endfor %}
1818

1919
# The port at the destination should be defined
20-
{% for port in ssh_ports %}
20+
{% for port in ssh_ports -%}
2121
Port {{port}}
2222
{% endfor %}
2323

@@ -48,15 +48,15 @@ StrictHostKeyChecking ask
4848
# -- see: (http://net-ssh.github.com/net-ssh/classes/Net/SSH/Transport/CipherFactory.html)
4949
#
5050
{% if ssh_client_cbc_required %}
51-
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' %}
51+
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
5252
Ciphers {{ciphers_66_weak}}
53-
{% else %}
53+
{% else -%}
5454
Ciphers {{ciphers_53_weak}}
5555
{% endif %}
5656
{% else %}
57-
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' %}
57+
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
5858
Ciphers {{ciphers_66_default}}
59-
{% else %}
59+
{% else -%}
6060
Ciphers {{ciphers_53_default}}
6161
{% endif %}
6262
{% endif %}
@@ -66,21 +66,21 @@ Ciphers {{ciphers_53_default}}
6666
# eg Ruby's Net::SSH at around 2.2.* doesn't support sha2 for hmac, so this will have to be set true in this case.
6767
#
6868
{% if ssh_server_weak_hmac %}
69-
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' %}
69+
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
7070
MACs {{macs_66_weak}}
71-
{% elif ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6' %}
71+
{% elif (ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6') or ansible_os_family == 'Oracle Linux' -%}
7272
MACs {{macs_53_default}}
73-
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' %}
73+
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' -%}
7474
MACs {{macs_53_default}}
7575
{% else %}
7676
MACs {{macs_59_weak}}
7777
{% endif %}
7878
{% else %}
79-
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' %}
79+
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
8080
MACs {{macs_66_default}}
81-
{% elif ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6' %}
81+
{% elif (ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6') or ansible_os_family == 'Oracle Linux' -%}
8282
MACs {{macs_53_default}}
83-
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' %}
83+
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' -%}
8484
MACs {{macs_53_default}}
8585
{% else %}
8686
MACs {{macs_59_default}}
@@ -101,7 +101,7 @@ MACs {{macs_59_default}}
101101
KexAlgorithms {{kex_66_default}}
102102
{% endif %}
103103
{% else -%}
104-
{% if ansible_os_family == 'RedHat' or (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') -%}
104+
{% if ansible_os_family == 'RedHat' or (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') or ansible_os_family == 'Oracle Linux' -%}
105105
#KexAlgorithms
106106
{% else -%}
107107
KexAlgorithms {{kex_59_default}}

roles/ansible-ssh-hardening/templates/opensshd.conf.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Ciphers {{ciphers_53_default}}
7676
{% if ssh_server_weak_hmac -%}
7777
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
7878
MACs {{macs_66_weak}}
79-
{% elif ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6' -%}
79+
{% elif (ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6') or ansible_os_family == 'Oracle Linux' -%}
8080
MACs {{macs_53_default}}
8181
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' -%}
8282
MACs {{macs_53_default}}
@@ -86,7 +86,7 @@ MACs {{macs_59_weak}}
8686
{% else %}
8787
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '14.04' -%}
8888
MACs {{macs_66_default}}
89-
{% elif ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6' -%}
89+
{% elif (ansible_os_family == 'RedHat' and ansible_distribution_major_version <= '6') or ansible_os_family == 'Oracle Linux' -%}
9090
MACs {{macs_53_default}}
9191
{% elif ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6' -%}
9292
MACs {{macs_53_default}}
@@ -109,7 +109,7 @@ MACs {{macs_59_default}}
109109
KexAlgorithms {{kex_66_default}}
110110
{% endif %}
111111
{% else -%}
112-
{% if ansible_os_family == 'RedHat' or (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') -%}
112+
{% if ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux' or (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') -%}
113113
#KexAlgorithms
114114
{% else -%}
115115
KexAlgorithms {{kex_59_default}}
@@ -121,7 +121,7 @@ MACs {{macs_59_default}}
121121

122122
# Secure Login directives.
123123
UseLogin no
124-
UsePrivilegeSeparation {% if (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') or ansible_os_family == 'RedHat' -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
124+
UsePrivilegeSeparation {% if (ansible_distribution == 'Debian' and ansible_distribution_major_version <= '6') or ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux' -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
125125

126126
PermitUserEnvironment no
127127
LoginGraceTime 30s
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sshd_service_name: sshd

0 commit comments

Comments
 (0)