Restric SSH, more security.
This commit is contained in:
parent
1b990b8cdb
commit
adb31d1e86
3 changed files with 14 additions and 2 deletions
|
@ -2,5 +2,4 @@
|
|||
systemd:
|
||||
name: sshd
|
||||
state: reloaded
|
||||
notify: "reload sshd"
|
||||
when: not run_in_installer|default(false)|bool
|
||||
|
|
4
roles/lmn_security/handlers/main.yml
Normal file
4
roles/lmn_security/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: Reload sshd
|
||||
systemd:
|
||||
name: sshd
|
||||
state: reloaded
|
|
@ -5,7 +5,7 @@
|
|||
key: "{{ item }}"
|
||||
loop: "{{ keys2deploy }}"
|
||||
|
||||
- name: Allow sudo access without password
|
||||
- name: Allow sudo without password for ansible
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/sudoers.d/95-lmn-ansible
|
||||
line: 'ansible ALL=(root) NOPASSWD: ALL'
|
||||
|
@ -18,3 +18,12 @@
|
|||
ansible.builtin.user:
|
||||
name: ansible
|
||||
password_lock: True
|
||||
|
||||
- name: Limit SSH access to user ansible
|
||||
ansible.builtin.blockinfile:
|
||||
dest: /etc/ssh/sshd_config.d/local.conf
|
||||
create: true
|
||||
block: |
|
||||
PasswordAuthentication no
|
||||
AllowUsers ansible
|
||||
notify: Reload sshd
|
||||
|
|
Loading…
Add table
Reference in a new issue