privilege

package
v4.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package privilege implements chroot and privilege-drop (setuid/setgid) for the Nauthilus server process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropPrivileges

func DropPrivileges(username, groupname, chrootPath string) error

DropPrivileges performs user/group lookup, chroot, and privilege drop in the correct order.

The sequence is:

  1. Resolve user/group to numeric UID/GID (before chroot, needs /etc/passwd).
  2. Validate essential DNS files inside the chroot directory.
  3. chroot() into the target directory.
  4. setgroups() — sets supplementary groups while still root.
  5. setgid() — must happen before setuid() to retain root for the call.
  6. setuid() — last step, drops all remaining privileges.

All parameters are optional. If all are empty, DropPrivileges is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

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