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

Commit 02d96bf

Browse files
author
Sebastian Gumprich
committed
change vars to bool, put comments inside block
1 parent b988ca4 commit 02d96bf

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

.kitchen.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ driver:
99
transport:
1010
max_ssh_sessions: 5
1111

12-
transport:
13-
max_ssh_sessions: 5
14-
15-
1612
provisioner:
1713
name: ansible_playbook
1814
hosts: all
@@ -26,6 +22,7 @@ provisioner:
2622
http_proxy: <%= ENV['http_proxy'] || nil %>
2723
https_proxy: <%= ENV['https_proxy'] || nil %>
2824
playbook: default.yml
25+
ansible_diff: true
2926
ansible_extra_flags:
3027
- "--skip-tags=sysctl"
3128

default.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
ssh_client_cbc_required: true
2828
ssh_client_weak_kex: true
2929
ssh_challengeresponseauthentication: true
30-
ssh_compression: 'yes'
30+
ssh_compression: true
3131
ssh_allow_users: 'root kitchen vagrant'
3232
ssh_allow_groups: 'root kitchen vagrant'
3333
ssh_deny_users: 'foo bar'
@@ -55,7 +55,7 @@
5555
ssh_use_dns: true
5656
ssh_use_pam: true
5757

58-
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
59-
hosts: localhost
60-
roles:
61-
- ansible-ssh-hardening
58+
#- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
59+
# hosts: localhost
60+
# roles:
61+
# - ansible-ssh-hardening

templates/opensshd.conf.j2

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
# ===================
88

99
# Either disable or only allowssh root login via certificates.
10-
PermitRootLogin {{ 'without-password' if ssh_allow_root_with_key else 'no' }}
10+
PermitRootLogin {% if ssh_allow_root_with_key|bool %} without-password {% else %} no {% endif %}
11+
#PermitRootLogin {{ 'without-password' if ssh_allow_root_with_key else 'no' | bool }}
1112

1213
# Define which port sshd should listen to. Default to `22`.
1314
{% for port in ssh_server_ports -%}
@@ -220,12 +221,13 @@ Banner {{ '/etc/ssh/banner.txt' if ssh_banner else 'none' }}
220221
DebianBanner {{ 'yes' if ssh_print_debian_banner else 'no' }}
221222
{% endif %}
222223

224+
{% if sftp_enabled %}
223225
# SFTP matching configuration
224226
# ===========================
225-
{% if sftp_enabled %}
226227
# Configuration, in case SFTP is used
227228
# override default of no subsystems
228229
# Subsystem sftp /opt/app/openssh5/libexec/sftp-server
230+
229231
Subsystem sftp internal-sftp -l INFO -f LOCAL6
230232

231233
# These lines must appear at the *end* of sshd_config
@@ -239,23 +241,23 @@ PermitRootLogin no
239241
X11Forwarding no
240242
{% endif %}
241243

244+
{% if ssh_server_match_group %}
242245
# Group matching configuration
243246
# ============================
244247

245-
{% if ssh_server_match_group %}
246248
{% for item in ssh_server_match_group %}
247249
Match Group {{ item.group }}
248250
{{ item.rules | indent(4) }}
249251
{% endfor %}
250252
{% endif %}
251253

254+
255+
{% if ssh_server_match_user %}
252256
# User matching configuration
253257
# ===========================
254258

255-
{% if ssh_server_match_user %}
256259
{% for item in ssh_server_match_user %}
257260
Match User {{ item.user }}
258261
{{ item.rules | indent(4) }}
259262
{% endfor %}
260263
{% endif %}
261-

0 commit comments

Comments
 (0)