Hardened systemd config
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 32/100
- Issue-Typ
- Feature
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- ansible, centos, linux, ubuntu
- Bereich
- devops, operating-systems, security
Rechercherichtung
Beginnen Sie mit der Überprüfung der referenzierten Konfiguration templates/systemd-hardening.conf.j2 und des Setups für den SysmonForLinux-Dienst. Vergleichen Sie die aufgeführten Varianten für Ubuntu 18.04/20.04 und CentOS 8 und bestimmen Sie anschließend, wo diese Konfiguration im Repository hingehört. Der Abschluss sollte eine klar definierte Hardening-Konfiguration und eine Validierung über die genannten Distributionen hinweg umfassen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
As security tool, we want to ensure not adding more attack surface than what is prevented/detected.
From early testing, following is working on Ubuntu 18.04, 20.04 and Centos8 with few variations
https://github.com/juju4/ansible-sysmon/blob/master/templates/systemd-hardening.conf.j2
(jinja2 template)
{{ ansible_managed | comment }}
#
# /etc/systemd/system/sysmon.service.d/hardening.conf
#
[Service]
# Hardening
# Warning! Test to your context
NoNewPrivileges=yes
PrivateTmp=true
ProtectHome=true
ProtectSystem=true
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 21 %}
ProtectProc=noaccess
{% endif %}
PrivateDevices=yes
DeviceAllow=
PrivateUsers=false
DynamicUser=false
UMask=077
# ReadWritePaths=
#InaccessiblePaths=/proc
{% if (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 7) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 18) %}
ProtectKernelTunables=true
ProtectKernelModules=yes
{% if (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 20) or
(ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 8 )
%}
ProtectKernelLogs=yes
ProtectHostname=yes
ProtectClock=yes
{% endif %}
ProtectControlGroups=true
LockPersonality=true
RestrictRealtime=true
RestrictNamespaces=yes
RestrictSUIDSGID=yes
MemoryDenyWriteExecute=yes
PrivateNetwork=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK AF_PACKET
IPAccounting=yes
IPAddressAllow=localhost link-local multicast 10.0.0.0/8 192.168.0.0/16
# IPAddressDeny=
AmbientCapabilities=CAP_BPF CAP_PERFMON
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_DAC_READ_SEARCH
CapabilityBoundingSet=~CAP_SYS_RAWIO
CapabilityBoundingSet=~CAP_SYS_PTRACE
CapabilityBoundingSet=~CAP_DAC_* CAP_FOWNER CAP_IPC_OWNER
CapabilityBoundingSet=~CAP_NET_ADMIN
CapabilityBoundingSet=~CAP_KILL
CapabilityBoundingSet=~CAP_NET_BIND_SERVICE CAP_NET_BROADCAST
CapabilityBoundingSet=~CAP_SYS_BOOT
CapabilityBoundingSet=~CAP_LINUX_IMMUTABLE
CapabilityBoundingSet=~CAP_SYS_CHROOT
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND
CapabilityBoundingSet=~CAP_LEASE
CapabilityBoundingSet=~CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
# CapabilityBoundingSet=~CAP_SYS_ADMIN
# CapabilityBoundingSet=~CAP_SYS_NICE CAP_SYS_RESOURCE
# CapabilityBoundingSet=~CAP_SETUID CAP_SETGID CAP_SETPCAP
# CapabilityBoundingSet=~CAP_CHOWN CAP_FSETID CAP_SETFCAP
# CapabilityBoundingSet=~CAP_NET_RAW
# CapabilityBoundingSet=~CAP_IPC_LOCK
{% endif %}
{% if not (ansible_virtualization_type is defined and
(ansible_virtualization_type == "lxc" or ansible_virtualization_type == "docker")
) and
not (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8) %}
{% if (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 20) %}
SystemCallFilter=@system-service @debug @privileged
SystemCallFilter=~@mount @cpu-emulation @obsolete @resources @clock @swap @reboot @module
SystemCallArchitectures=native
# When system call is disallowed, return error code instead of killing process
SystemCallErrorNumber=EPERM
{% endif %}
{% endif %}
{% if sysmon_cgroups_restriction_enable|bool %}
CPUShares={{ sysmon_cgroups_cpushares | default('1024') }}
CPUQuota={{ sysmon_cgroups_cpuquota | default('10%') }}
MemoryLimit={{ sysmon_cgroups_memorylimit | default('1G') }}
{% endif %}
- Vorherrschende Sprache
- C
- Sterne
- 2.2k
- Forks
- 224
- Ø Merge
- 4 Std. 50 Min.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/Sysmon-Linux
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
microsoft/Sysmon-Linux#253 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
microsoft/Sysmon-Linux#252 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
microsoft/Sysmon-Linux#247 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 12/100
microsoft/Sysmon-Linux#246 · 3 Kommentare ·
-
Sysmon service executable remains `(deleted)` after restart, causing repeated needrestart restarts and systemd start-limit-hitEvtl. wieder frei @MarioHewardt hat das vor 31 Tagen übernommen, und es ist kein Pull Request offen. Offen
microsoft/Sysmon-Linux#244 · 1 zugewiesene Person ·
Alle Issues in microsoft/Sysmon-Linux
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
Issue-Bug Needs-Triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
ly05010419/MacNativeGames#2001 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/docdb kind/bug priority/medium status/awaiting-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
yugabyte/yugabyte-db#37426 ·
Maintainer antworten meist innerhalb von 1 Tag