sudoers

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(dst string)

Cleanup removes the installed sudoers entry at dst. Intended for rollback handlers; errors are logged to stdout but not returned.

func ValidateContent

func ValidateContent(content []byte) error

ValidateContent checks that content is structurally valid sudoers syntax. It joins continuation lines then verifies that each non-comment, non-empty logical line contains a host/runas separator ('='), a command tag (':'), and only absolute-path commands. This catches the most common malformations that would break sudo without requiring a shell invocation.

func WriteEntry

func WriteEntry(dst string, content []byte) error

WriteEntry validates content then atomically installs it at dst with mode 0o440. Delegates to fsx.AtomicWriteFile so partial writes are never visible to sudo.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL