Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/pcp/atop/atop-daily.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ Type=oneshot
# compression and culls old archives before recording resumes on the new
# date-stamped archive. Compression runs in parallel with recording.
ExecStart=systemctl restart atop.service
# Hardening: no SystemCallFilter (performance impact).
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027
17 changes: 17 additions & 0 deletions src/pcp/atop/atop.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ EnvironmentFile=-@PCP_SYSCONFIG_DIR@/atop
ExecStartPre=@PCP_BINADM_DIR@/atop-daily
ExecStart=/bin/sh -c 'exec @PCP_BINADM_DIR@/pcp-atop ${LOGOPTS} -w "${LOGPATH}" ${LOGINTERVAL}'
KillSignal=SIGTERM
# Hardening: no SystemCallFilter (performance impact); needs /proc access.
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
WantedBy=multi-user.target
Expand Down
16 changes: 16 additions & 0 deletions src/pcp/geolocate/pcp-geolocate.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ Type=oneshot
ExecStart=@PCP_BINADM_DIR@/pcp-geolocate @PCP_SYSCONF_DIR@/labels/optional/geolocate
Group=root
User=root
# Hardening: no SystemCallFilter (performance impact).
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
Comment thread
kurik marked this conversation as resolved.

[Install]
WantedBy=multi-user.target
17 changes: 17 additions & 0 deletions src/pmcd/pmcd.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ Restart=always
ExecStart=@PCP_RC_DIR@/pmcd start-systemd
ExecStop=@PCP_RC_DIR@/pmcd stop-systemd
PIDFile=@PCP_RUN_DIR@/pmcd.pid
# Hardening: no SystemCallFilter (performance); NoNewPrivileges omitted
# because pmcd drops to the pcp user via setuid after startup.
# ProtectHostname omitted so pmcd can detect hostname changes and
# propagate PMCD_HOSTNAME_CHANGE to pmlogger, pmie, and other clients.
ProtectHome=yes
ProtectClock=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
WantedBy=multi-user.target
17 changes: 17 additions & 0 deletions src/pmfind/pmfind.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ Environment="PMFIND_CHECK_PARAMS=-C -q"
EnvironmentFile=-@PCP_SYSCONFIG_DIR@/pmfind
ExecStart=@PCP_BINADM_DIR@/pmfind_check $PMFIND_CHECK_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
# Hardening: no SystemCallFilter (performance impact).
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions src/pmie/pmie.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ ExecStop=@PCP_SERVICES_DIR@/pmie stop-systemd
PIDFile=@PCP_RUN_DIR@/pmie.pid
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the omission of ProtectHostname and PrivateTmp.

All other PMIE service units in this PR include ProtectHostname=yes, and most include PrivateTmp=yes (or document its absence, as pmie_farm.service.in does). pmie.service.in omits both without any inline comment explaining why. If these omissions are intentional (e.g., pmie needs hostname-change detection like pmcd.service, or needs /tmp access for inference temp files), add a brief comment for consistency with the documented exceptions in the other units.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pmie/pmie.service.in` around lines 23 - 38, Document the intentional
omission of ProtectHostname and PrivateTmp in pmie.service.in by adding a brief
inline comment near the related hardening directives. State the required runtime
behavior, such as hostname-change detection or /tmp access for inference
temporary files, and follow the exception-documentation style used by the other
service units.


[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions src/pmie/pmie_check.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,19 @@ ExecStart=@PCP_BINADM_DIR@/pmie_check $PMIE_CHECK_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
Comment thread
kurik marked this conversation as resolved.
17 changes: 17 additions & 0 deletions src/pmie/pmie_daily.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ ExecStart=@PCP_BINADM_DIR@/pmie_daily $PMIE_DAILY_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
19 changes: 19 additions & 0 deletions src/pmie/pmie_farm.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ ExecStart=@PCP_BINADM_DIR@/pmie_farm $PMIE_CHECK_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
# PrivateTmp omitted so farm instances can write to log paths from
# control files (e.g. under /tmp in QA, or user-configured locations).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
RequiredBy=pmie.service
17 changes: 17 additions & 0 deletions src/pmie/pmie_farm_check.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ TimeoutStopSec=120
# User= nor Group= here
ExecStart=@PCP_BIN_DIR@/pmiectl -m check
WorkingDirectory=@PCP_VAR_DIR@
# Hardening: no SystemCallFilter (performance impact).
# NoNewPrivileges omitted because pmiectl uses runaspcp (setuid).
PrivateTmp=yes
ProtectHome=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the omission of RemoveIPC=yes.

All other PMIE service units in this PR include RemoveIPC=yes, but pmie_farm_check.service.in omits it without comment. If this is intentional (e.g., the root-running service must not strip IPC objects on exit), add a brief comment explaining why, consistent with the documented NoNewPrivileges exception.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pmie/pmie_farm_check.service.in` around lines 16 - 32, Document the
intentional omission of RemoveIPC=yes in the hardening settings near the
existing NoNewPrivileges comment, briefly explaining the root-running service’s
IPC cleanup requirement if applicable. Do not add the directive; only add a
concise rationale consistent with the surrounding comments.

16 changes: 16 additions & 0 deletions src/pmlogger/pmlogger.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ ExecStop=@PCP_SERVICES_DIR@/pmlogger stop-systemd
PIDFile=@PCP_RUN_DIR@/pmlogger.pid
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions src/pmlogger/pmlogger_check.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@ ExecStart=@PCP_BINADM_DIR@/pmlogger_check --noerror $PMLOGGER_CHECK_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
17 changes: 17 additions & 0 deletions src/pmlogger/pmlogger_daily.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ ExecStart=@PCP_BINADM_DIR@/pmlogger_daily --noerror -P $PMLOGGER_DAILY_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
19 changes: 19 additions & 0 deletions src/pmlogger/pmlogger_farm.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ ExecStart=@PCP_BINADM_DIR@/pmlogger_farm $PMLOGGER_CHECK_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
# PrivateTmp omitted so farm instances can write to log paths from
# control files (e.g. under /tmp in QA, or user-configured locations).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027

[Install]
RequiredBy=pmlogger.service
17 changes: 17 additions & 0 deletions src/pmlogger/pmlogger_farm_check.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ TimeoutStopSec=120
# known to pmlogctl(1)
ExecStart=@PCP_BIN_DIR@/pmlogctl -m check
WorkingDirectory=@PCP_VAR_DIR@
# Hardening: no SystemCallFilter (performance impact).
# NoNewPrivileges omitted because pmlogctl uses runaspcp (setuid).
PrivateTmp=yes
ProtectHome=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027
19 changes: 18 additions & 1 deletion src/pmproxy/pmproxy.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,28 @@ BindsTo=pmproxy_check.timer pmproxy_daily.timer

[Service]
Type=notify
NotifyAccess=all
NotifyAccess=main
Restart=always
ExecStart=@PCP_SERVICES_DIR@/pmproxy start-systemd
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
UMask=0027
Comment thread
kurik marked this conversation as resolved.
Outdated

[Install]
WantedBy=multi-user.target
17 changes: 17 additions & 0 deletions src/pmproxy/pmproxy_check.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@ ExecStart=@PCP_BINADM_DIR@/pmlogger_daily --noerror -Q -K $PMLOGGER_DAILY_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
# Hardening: no SystemCallFilter (performance impact).
PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes
RemoveIPC=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectKernelTunables=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
KeyringMode=private
Loading
Loading