Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a kernel parameter to disable built-in auditd #10127

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ See the [documentation](https://www.talos.dev/v1.10/reference/configuration/hard
description = """\
Talos Linux no longer supports `cgroupsv1` when running in non-container mode.
The kernel argument `talos.unified_cgroup_hierarchy` is now ignored.
"""

[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,
} {
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 @@ -79,6 +79,9 @@ const (
// KernelParamCGroups is the legacy kernel parameter not supported anymore.
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
5 changes: 5 additions & 0 deletions website/content/v1.10/reference/kernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ Valid options are:
* `system` resets system disk.
* `system:EPHEMERAL,STATE` resets ephemeral and state partitions. Doing this reverts Talos into maintenance mode.

#### `talos.auditd.disabled`

By default, Talos runs `auditd` service capturing kernel audit events.
If you set `talos.auditd.disabled=1`, this behavior will be disabled, and you can run your own `auditd` service.

#### `talos.dashboard.disabled`

By default, Talos redirects kernel logs to virtual console `/dev/tty1` and starts the dashboard on `/dev/tty2`,
Expand Down