Skip to content

Commit

Permalink
manage systemd files
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Schurz <[email protected]>
  • Loading branch information
schurzi committed Aug 2, 2024
1 parent 162dae6 commit e3ce282
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
6 changes: 0 additions & 6 deletions molecule/ssh_hardening/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
update_cache: true
when: ansible_facts.os_family == 'Archlinux'

- name: Created needed directory
ansible.builtin.file:
path: /var/run/sshd
state: directory
mode: "0755"

- name: Create ssh host keys # noqa ignore-errors
ansible.builtin.command: ssh-keygen -A
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7')
Expand Down
6 changes: 0 additions & 6 deletions molecule/ssh_hardening_bsd/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}"
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
tasks:
- name: Created needed directory
ansible.builtin.file:
path: /var/run/sshd
state: directory
mode: "0755"

- name: Create ssh host keys # noqa ignore-errors
ansible.builtin.command: ssh-keygen -A
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7')
Expand Down
6 changes: 4 additions & 2 deletions roles/ssh_hardening/tasks/disable-systemd-socket.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
- name: Remove ssh service systemd-socket file
ansible.builtin.file:
path: /etc/systemd/system/ssh.service.d/00-socket.conf
path: "{{ item }}"
state: absent
loop:
- /etc/systemd/system/ssh.service.d/00-socket.conf
- /etc/systemd/system/ssh.service.requires/ssh.socket

- name: Disable systemd-socket activation
ansible.builtin.systemd:
name: ssh.socket
state: stopped
enabled: false
masked: true
daemon_reload: true

0 comments on commit e3ce282

Please sign in to comment.