remove password auth for users

format-files
chatton 3 years ago
parent c6b6c3f590
commit 03e0bf4b3c

@ -41,7 +41,7 @@ services:
{% if template_vars.glances %} {% if template_vars.glances %}
glances: glances:
image: nicolargo/glances:latest-alpine image: nicolargo/glances:latest-alpine
restart: always restart: unless-stopped
pid: host pid: host
ports: ports:
- "8083:61208" - "8083:61208"

@ -22,6 +22,6 @@ services:
- CONFIG=/data/config.yml - CONFIG=/data/config.yml
labels: labels:
- diun.enable=true - diun.enable=true
restart: always restart: unless-stopped
volumes: volumes:
data: data:

@ -11,6 +11,6 @@ services:
- data:/app/data - data:/app/data
ports: ports:
- 7875:80 - 7875:80
restart: always restart: unless-stopped
volumes: volumes:
data: data:

@ -1,18 +1,19 @@
# https://stackoverflow.com/questions/37333305/ansible-create-a-user-with-sudo-privileges # https://stackoverflow.com/questions/37333305/ansible-create-a-user-with-sudo-privileges
- name: Install Sudo. - name: Install Packages.
ansible.builtin.apt: ansible.builtin.apt:
pkg: pkg:
- sudo - sudo
- ufw
state: latest state: latest
update_cache: true update_cache: true
- name: Make sure we have a groups. - name: Ensure group.
ansible.builtin.group: ansible.builtin.group:
name: '{{ item.group }}' name: '{{ item.group }}'
state: present state: present
with_items: '{{ users }}' with_items: '{{ users }}'
- name: Add Users. - name: Ensure Users.
ansible.builtin.user: ansible.builtin.user:
name: '{{ item.name }}' name: '{{ item.name }}'
comment: '{{ item.name }} user' comment: '{{ item.name }} user'
@ -40,3 +41,17 @@
group: "{{ homelab_user }}" group: "{{ homelab_user }}"
owner: "{{ homelab_user }}" owner: "{{ homelab_user }}"
mode: 0644 mode: 0644
- name: Disable password authentication for root.
lineinfile:
path: /etc/ssh/sshd_config
state: present
regexp: '^#?PermitRootLogin'
line: 'PermitRootLogin prohibit-password'
- name: Disable password authentication for users.
lineinfile:
path: /etc/ssh/sshd_config
state: present
regexp: '^#?PasswordAuthentication'
line: 'PasswordAuthentication no'

Loading…
Cancel
Save