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:
|
systemd:
|
||||||
name: sshd
|
name: sshd
|
||||||
state: reloaded
|
state: reloaded
|
||||||
notify: "reload sshd"
|
|
||||||
when: not run_in_installer|default(false)|bool
|
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 }}"
|
key: "{{ item }}"
|
||||||
loop: "{{ keys2deploy }}"
|
loop: "{{ keys2deploy }}"
|
||||||
|
|
||||||
- name: Allow sudo access without password
|
- name: Allow sudo without password for ansible
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/sudoers.d/95-lmn-ansible
|
path: /etc/sudoers.d/95-lmn-ansible
|
||||||
line: 'ansible ALL=(root) NOPASSWD: ALL'
|
line: 'ansible ALL=(root) NOPASSWD: ALL'
|
||||||
|
@ -18,3 +18,12 @@
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: ansible
|
name: ansible
|
||||||
password_lock: True
|
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