Restric SSH, more security.

This commit is contained in:
Andreas B. Mundt 2023-09-15 21:20:51 +02:00
parent 1b990b8cdb
commit adb31d1e86
3 changed files with 14 additions and 2 deletions

View file

@ -2,5 +2,4 @@
systemd:
name: sshd
state: reloaded
notify: "reload sshd"
when: not run_in_installer|default(false)|bool

View file

@ -0,0 +1,4 @@
- name: Reload sshd
systemd:
name: sshd
state: reloaded

View file

@ -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