initial commit
This commit is contained in:
1 parent
cc0a7295ea
commit
6dc7279a25
8 files changed
+178
No files matched your search
@@ -0,0 +1,33 @@
|
||||
---
|
||||
- name: user | disable SSH access for root
|
||||
replace:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^PermitRootLogin (yes|without-password|prohibit-password)'
|
||||
replace: "PermitRootLogin no"
|
||||
validate: '/usr/sbin/sshd -T -f %s'
|
||||
notify: reload shd
|
||||
|
||||
#- name: user | verify AllowUsers directive
|
||||
# command: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
|
||||
# changed_when: False
|
||||
# failed_when: False
|
||||
# register: grep_allowusers_ssh
|
||||
#
|
||||
#- name: "add AllowUsers sshd directive"
|
||||
# lineinfile:
|
||||
# dest: /etc/ssh/sshd_config
|
||||
# line: "\nAllowUsers "
|
||||
# insertafter: 'Subsystem'
|
||||
# validate: '/usr/sbin/sshd -T -f %s'
|
||||
# register: allowusers_added
|
||||
# when: grep_allowusers_ssh.rc != 0
|
||||
|
||||
#- name: "append username to AllowUsers sshd directive"
|
||||
# replace:
|
||||
# dest: /etc/ssh/sshd_config
|
||||
# regexp: '^(AllowUsers(?!.*\b{{ item.key }}\b).*)$'
|
||||
# replace: '\1 {{ item.key }}'
|
||||
# validate: '/usr/sbin/sshd -T -f %s'
|
||||
# with_dict: "{{ user.name }}"
|
||||
# when: allowusers_added
|
||||
# notify: "reload SSH"
|
||||
Reference in new issue
Block a user