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

Commit d232871

Browse files
author
Sebastian Gumprich
committed
divide plays to workaround gathered facts
1 parent a9353e1 commit d232871

File tree

3 files changed

+64
-46
lines changed

3 files changed

+64
-46
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ script:
5454
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-ssh-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"'
5555

5656
# Test role.
57+
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-ssh-hardening/default_custom.yml'
5758
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-ssh-hardening/default.yml'
5859

5960
# Verify role

default.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with custom settings
2+
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
33
hosts: localhost
44
pre_tasks:
55
- package: name="{{item}}" state=installed
@@ -19,48 +19,3 @@
1919

2020
roles:
2121
- ansible-ssh-hardening
22-
vars:
23-
network_ipv6_enable: true
24-
ssh_allow_root_with_key: true
25-
ssh_allow_tcp_forwarding: true
26-
ssh_gateway_ports: true
27-
ssh_allow_agent_forwarding: true
28-
ssh_server_permit_environment_vars: ['PWD','HTTP_PROXY']
29-
ssh_client_alive_interval: 100
30-
ssh_client_alive_count: 10
31-
ssh_client_password_login: true
32-
ssh_client_cbc_required: true
33-
ssh_client_weak_kex: true
34-
ssh_challengeresponseauthentication: true
35-
ssh_compression: true
36-
ssh_allow_users: 'root kitchen vagrant'
37-
ssh_allow_groups: 'root kitchen vagrant'
38-
ssh_deny_users: 'foo bar'
39-
ssh_deny_groups: 'foo bar'
40-
ssh_authorized_keys_file: '/etc/ssh/authorized_keys/%u'
41-
ssh_max_auth_retries: 10
42-
ssh_permit_tunnel: true
43-
ssh_print_motd: true
44-
ssh_print_last_log: true
45-
ssh_banner: true
46-
ssh_server_password_login: true
47-
ssh_server_weak_hmac: true
48-
sftp_enabled: true
49-
ssh_server_match_group:
50-
- group: 'root'
51-
rules: 'AllowTcpForwarding yes'
52-
ssh_server_match_user:
53-
- user: 'root'
54-
rules: 'AllowTcpForwarding yes'
55-
ssh_remote_hosts:
56-
- names: ['example.com', 'example2.com']
57-
options: ['Port 2222', 'ForwardAgent yes']
58-
- names: ['example3.com']
59-
options: ['StrictHostKeyChecking no']
60-
ssh_use_dns: true
61-
ssh_use_pam: true
62-
63-
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
64-
hosts: localhost
65-
roles:
66-
- ansible-ssh-hardening

default_custom.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with custom settings
3+
hosts: localhost
4+
pre_tasks:
5+
- package: name="{{item}}" state=installed
6+
with_items:
7+
- "openssh-clients"
8+
- "openssh-server"
9+
ignore_errors: true
10+
- apt: name="{{item}}" state=installed update_cache=true
11+
with_items:
12+
- "openssh-client"
13+
- "openssh-server"
14+
ignore_errors: true
15+
- file: path="/var/run/sshd" state=directory
16+
- name: create ssh host keys
17+
command: "ssh-keygen -A"
18+
when: not ((ansible_os_family in ['Oracle Linux', 'RedHat']) and ansible_distribution_major_version < '7')
19+
20+
roles:
21+
- ansible-ssh-hardening
22+
vars:
23+
network_ipv6_enable: true
24+
ssh_allow_root_with_key: true
25+
ssh_allow_tcp_forwarding: true
26+
ssh_gateway_ports: true
27+
ssh_allow_agent_forwarding: true
28+
ssh_server_permit_environment_vars: ['PWD','HTTP_PROXY']
29+
ssh_client_alive_interval: 100
30+
ssh_client_alive_count: 10
31+
ssh_client_password_login: true
32+
ssh_client_cbc_required: true
33+
ssh_client_weak_kex: true
34+
ssh_challengeresponseauthentication: true
35+
ssh_compression: true
36+
ssh_allow_users: 'root kitchen vagrant'
37+
ssh_allow_groups: 'root kitchen vagrant'
38+
ssh_deny_users: 'foo bar'
39+
ssh_deny_groups: 'foo bar'
40+
ssh_authorized_keys_file: '/etc/ssh/authorized_keys/%u'
41+
ssh_max_auth_retries: 10
42+
ssh_permit_tunnel: true
43+
ssh_print_motd: true
44+
ssh_print_last_log: true
45+
ssh_banner: true
46+
ssh_server_password_login: true
47+
ssh_server_weak_hmac: true
48+
sftp_enabled: true
49+
ssh_server_enabled: false
50+
ssh_server_match_group:
51+
- group: 'root'
52+
rules: 'AllowTcpForwarding yes'
53+
ssh_server_match_user:
54+
- user: 'root'
55+
rules: 'AllowTcpForwarding yes'
56+
ssh_remote_hosts:
57+
- names: ['example.com', 'example2.com']
58+
options: ['Port 2222', 'ForwardAgent yes']
59+
- names: ['example3.com']
60+
options: ['StrictHostKeyChecking no']
61+
ssh_use_dns: true
62+
ssh_use_pam: true

0 commit comments

Comments
 (0)