Documentation
¶
Overview ¶
Vendored from bot-agent internal/agent/policy (Apache-2.0, see ../NOTICE). DD changes: the key set is a caller-supplied Schema instead of bot-agent's fixed keys, and a scalar basic string is accepted. The value parsers (parseBool, parseInt, parseArray, parseString) are unchanged.
Package policy reads a root-owned host policy file in a small TOML subset.
Vendored from bot-agent internal/agent/policy (Apache-2.0, see ../NOTICE). DD changes: Load keeps bot-agent's file checks (regular file, size cap, root owner, not group- or world-writable, SHA-256 of the bytes) and its parser, but returns the parsed values for a caller-supplied Schema. The bot-agent keys (run_as, dirs, images, projects, shared networks) and the passwd/group resolution are dropped; dd-worker's keys and their meaning live in internal/worker.
Index ¶
Constants ¶
const MaxBytes = 64 * 1024
MaxBytes bounds a policy file. Larger files are invalid.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
File is one read of the policy. When Valid is false, Values is nil and Reason names why. Hash is the hex SHA-256 of the file bytes when they were read.
type Files ¶
type Files struct {
Policy string
Schema Schema
UID func(os.FileInfo) (uint32, bool)
SkipOwner bool
}
Files selects the policy file and its schema. UID, when set, replaces the uid from the file's stat. Production leaves it nil. Tests set it because this process cannot chown a file to root. The override does not affect the mode check. SkipOwner skips the root-owner and mode checks (a "policy check" of a file before it is installed).
type Kind ¶
type Kind int
Kind is a key's TOML type in the subset: bool, non-negative int, basic string, or array of basic strings.