Skip to content

Commit

Permalink
feat: add a kernel parameter to disable built-in auditd
Browse files Browse the repository at this point in the history
Fixes #9907

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit db4ca56)
  • Loading branch information
smira committed Jan 16, 2025
1 parent 28327e0 commit 244fd6e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ cluster:
```
Usage of `authorization-mode` CLI argument will not support this form of customization.
"""

[notes.auditd]
title = "auditd"
description = """\
Kernel parameter `talos.auditd.disabled=1` can be used to disable Talos built-in `auditd` service.
"""

[make_deps]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,18 @@ func StartSyslogd(r runtime.Sequence, _ any) (runtime.TaskExecutionFunc, string)

// StartAuditd represents the task to start auditd.
func StartAuditd(r runtime.Sequence, _ any) (runtime.TaskExecutionFunc, string) {
return func(_ context.Context, _ *log.Logger, r runtime.Runtime) error {
return func(_ context.Context, logger *log.Logger, r runtime.Runtime) error {
if !r.State().Platform().Mode().InContainer() {
disabledStr := procfs.ProcCmdline().Get(constants.KernelParamAuditdDisabled).First()
disabled, _ := strconv.ParseBool(pointer.SafeDeref(disabledStr)) //nolint:errcheck

if disabled {
logger.Printf("auditd is disabled by kernel parameter %s", constants.KernelParamAuditdDisabled)

return nil
}
}

system.Services(r).LoadAndStart(&services.Auditd{})

return nil
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func RunInstallerContainer(
constants.KernelParamEventsSink,
constants.KernelParamLoggingKernel,
constants.KernelParamEquinixMetalEvents,
constants.KernelParamAuditdDisabled,
constants.KernelParamDashboardDisabled,
constants.KernelParamNetIfnames,
constants.KernelParamSELinux,
Expand Down
3 changes: 3 additions & 0 deletions pkg/machinery/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ const (
// cgroups version to use (default is cgroupsv2, setting this kernel arg to '0' forces cgroupsv1).
KernelParamCGroups = "talos.unified_cgroup_hierarchy"

// KernelParamAuditdDisabled is the kernel parameter name for disabling auditd service.
KernelParamAuditdDisabled = "talos.auditd.disabled"

// KernelParamDashboardDisabled is the kernel parameter name for disabling the dashboard.
KernelParamDashboardDisabled = "talos.dashboard.disabled"

Expand Down

0 comments on commit 244fd6e

Please sign in to comment.