fix(systemd_hardening): disable and mask the socket of a listed service too
Look up every listed name as a socket and as a service and act on each installed unit, the socket first. A service whose socket stays active is started again by the next connection to its port. Assisted-by: Claude Code
This commit is contained in:
1 parent
545f2fe94a
commit
f256c1c7e5
8 files changed
+101
-33
No files matched your search
@@ -7,7 +7,9 @@ argument_specs:
|
||||
Validates C(systemd_hardening_system_type) against C(systemd_hardening_profiles), then disables the unwanted services and masks the high-risk
|
||||
services that have an installed unit file, writes C(/etc/systemd/system.conf.d/hardening.conf) and renders a drop-in for every
|
||||
unit in C(systemd_hardening_services).
|
||||
- Units that are not installed are skipped. Handlers are flushed at the end of the role.
|
||||
- >-
|
||||
Every listed name is handled as a socket and as a service, the socket first; units that are not installed are skipped.
|
||||
Handlers are flushed at the end of the role.
|
||||
- >-
|
||||
The role also reads C(systemd_hardening_disable_services_extra) (default is the profile entry for C(systemd_hardening_system_type)) and the
|
||||
derived C(systemd_hardening_disable_services_effective) (the base list plus the extra list, a result, do not set it). They are
|
||||
@@ -35,13 +37,17 @@ argument_specs:
|
||||
elements: str
|
||||
default: [rpcbind, avahi-daemon, cups, bluetooth, nfs-server]
|
||||
description:
|
||||
- Services stopped and disabled on every system type, with or without the C(.service) suffix. Only installed units are touched.
|
||||
- >-
|
||||
Services stopped and disabled on every system type, with or without the C(.service) or C(.socket) suffix, together with the
|
||||
socket of the same name. Only installed units are touched.
|
||||
systemd_hardening_mask_services:
|
||||
type: list
|
||||
elements: str
|
||||
default: [telnet, rsh, rlogin, xinetd]
|
||||
description:
|
||||
- Services masked and stopped. Only installed units are touched.
|
||||
- >-
|
||||
Services masked and stopped, with or without the C(.service) or C(.socket) suffix, together with the socket of the same name.
|
||||
Only installed units are touched.
|
||||
systemd_hardening_services:
|
||||
type: dict
|
||||
default: {}
|
||||
|
||||
Reference in new issue
Block a user