2016-12-27 14:03:35 +01:00
|
|
|
---
|
2017-09-14 14:26:00 +02:00
|
|
|
- debug:
|
|
|
|
msg: "Warning: empty 'evolinux_ssh_password_auth_addresses' variable, tasks will be skipped!"
|
2017-08-18 04:13:56 +02:00
|
|
|
when: evolinux_ssh_password_auth_addresses == []
|
|
|
|
|
2017-08-05 18:13:24 +02:00
|
|
|
- name: Security directives for Evolinux
|
|
|
|
blockinfile:
|
2016-12-27 14:03:35 +01:00
|
|
|
dest: /etc/ssh/sshd_config
|
2017-08-05 18:13:24 +02:00
|
|
|
block: |
|
2017-09-08 00:15:53 +02:00
|
|
|
Match Group evolinux-sudo
|
2017-08-05 18:13:24 +02:00
|
|
|
PasswordAuthentication no
|
|
|
|
Match Address {{ evolinux_ssh_password_auth_addresses | join(',') }}
|
|
|
|
PasswordAuthentication yes
|
|
|
|
marker: "# {mark} EVOLINUX PASSWORD RESTRICTIONS"
|
|
|
|
insertafter: EOF
|
2016-12-27 14:03:35 +01:00
|
|
|
validate: '/usr/sbin/sshd -T -f %s'
|
2017-01-03 11:44:20 +01:00
|
|
|
notify: reload sshd
|
2017-09-14 14:26:00 +02:00
|
|
|
when: not evolinux_ssh_password_auth_addresses == []
|
2016-12-27 14:03:35 +01:00
|
|
|
|
|
|
|
- name: disable SSH access for root
|
|
|
|
replace:
|
|
|
|
dest: /etc/ssh/sshd_config
|
|
|
|
regexp: '^PermitRootLogin (yes|without-password)'
|
|
|
|
replace: "PermitRootLogin no"
|
2017-06-14 15:53:15 +02:00
|
|
|
notify: reload sshd
|
2016-12-27 14:03:35 +01:00
|
|
|
when: evolinux_ssh_disable_root
|
|
|
|
|
2017-08-18 14:37:18 +02:00
|
|
|
# We disable AcceptEnv because it can be a security issue, but also because we
|
|
|
|
# do not want clients to push their environment variables like LANG.
|
2016-12-27 14:03:35 +01:00
|
|
|
- name: disable AcceptEnv in ssh config
|
|
|
|
replace:
|
|
|
|
dest: /etc/ssh/sshd_config
|
|
|
|
regexp: '^AcceptEnv'
|
|
|
|
replace: "#AcceptEnv"
|
2017-06-14 15:53:15 +02:00
|
|
|
notify: reload sshd
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_ssh_disable_acceptenv
|
2017-01-03 17:02:23 +01:00
|
|
|
|
2017-06-14 15:53:15 +02:00
|
|
|
- name: Set log level to verbose (for Debian >= 9)
|
|
|
|
replace:
|
|
|
|
dest: /etc/ssh/sshd_config
|
2017-07-19 13:49:08 +02:00
|
|
|
regexp: '^#?LogLevel [A-Z]+'
|
2017-06-14 15:53:15 +02:00
|
|
|
replace: "LogLevel VERBOSE"
|
|
|
|
notify: reload sshd
|
2017-08-22 00:42:14 +02:00
|
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
2017-06-14 15:53:15 +02:00
|
|
|
|
2017-01-03 17:02:23 +01:00
|
|
|
- meta: flush_handlers
|