Bases: enum.IntEnum
An enumeration.
Set (effective, permitted, inheritable) to provided list of caps
Return (effective, permitted, inheritable) as lists of caps
Set/unset thread’s “keep capabilities” flag - see prctl(2)
Serialization/Deserialization for privsep.
The wire format is a stream of msgpack objects encoding primitive python datatypes. Msgpack ‘raw’ is assumed to be a valid utf8 string (msgpack 2.0 ‘bin’ type is used for bytes). Python lists are converted to tuples during serialization/deserialization.
Bases: object
Received OOB message. Subclasses might want to override this.
Bases: object
Bases: object
A very simple object to track the return of a function call
Must already be holding lock used in constructor
Must already be holding lock used in constructor
Must already be holding lock used in constructor
Bases: enum.IntEnum
Types of messages sent across the communication channel
Bases: Exception
Privilege separation (“privsep”) daemon.
To ease transition this supports 2 alternative methods of starting the daemon, all resulting in a helper process running with elevated privileges and open socket(s) to the original process:
Start via fork()
Assumes process currently has all required privileges and is about to drop them (perhaps by setuid to an unprivileged user). If the the initial environment is secure and PrivContext.start(Method.FORK) is called early in main(), then this is the most secure and simplest. In particular, if the initial process is already running as non-root (but with sufficient capabilities, via eg suitable systemd service files), then no part needs to involve uid=0 or sudo.
Start via sudo/rootwrap
This starts the privsep helper on first use via sudo and rootwrap, and communicates via a temporary Unix socket passed on the command line. The communication channel is briefly exposed in the filesystem, but is protected with file permissions and connecting to it only grants access to the unprivileged process. Requires a suitable entry in sudoers or rootwrap.conf filters.
The privsep daemon exits when the communication channel is closed, (which usually occurs when the unprivileged process exits).
Bases: object
NB: This doesn’t fork() - do that yourself before calling run()
Main body of daemon request loop
Run request loop. Sets up environment, then calls loop()
Bases: Exception
Bases: oslo_privsep.daemon._ClientChannel
Bases: logging.Handler
Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so raises a NotImplementedError.
Bases: Exception
Bases: oslo_privsep.daemon._ClientChannel
Bases: enum.IntEnum
An enumeration.
Start privileged process, serving requests over a Unix socket.
Bases: enum.Enum
An enumeration.
Bases: object
Return the oslo.config section object as lazily as possible.
This is intended to be used as a decorator.
This is intended to be used as a decorator with timeout.
Initialise oslo.privsep library.
This function should be called at the top of main(), after the command line is parsed, oslo.config is initialised and logging is set up, but before calling any privileged entrypoint, changing user id, forking, or anything else “odd”.
root_helper – List of command and arguments to prefix privsep-helper with, in order to run helper as root. Note, ignored if context’s helper_command config option is set.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.