Documentation
¶
Overview ¶
Package keysvc is the key-centric read layer: for every key the manifest owns, what is on disk for it, which hosts wire it, and where it is deployed. The query package answers the same questions host-first (list/view); this one is key-first, because a key can now outlive - or precede - any host that uses it.
It reports facts, not judgements: whether a file is there, whether a record covers it, which hosts name it. Deciding that some combination of those facts means a key is "dangling" belongs to one package so every command agrees, and that package is keyaudit, which reads these rows.
Read-only, and deliberately shallow on disk: it uses os.Lstat, so a symlink planted where a key should be reports as what it is rather than being followed, and it never reads private key material.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detail ¶
type Detail struct {
Row
// DiskFingerprint is fingerprinted from the .pub actually on disk, which can
// disagree with the recorded one after a key was regenerated outside authama.
// Empty when there is no .pub to read.
DiskFingerprint string
// FingerprintErr explains an unreadable or malformed .pub, rather than
// letting it show as a blank fingerprint.
FingerprintErr string
}
Detail is a Row plus what only reading the public key can answer.
func (Detail) Mismatched ¶
Mismatched reports whether the key on disk is a different key from the one the inventory recorded - the state where deployments and expiry describe a key that no longer exists.
type Row ¶
type Row struct {
Ref manifest.KeyRef
Type string // resolved: the declared override, else the default
RotateAfterDays int
Declared bool // has an explicit keys[] entry (vs. implied by a host)
IdentityFile string
PrivatePath string
PublicPath string
PrivateOnDisk bool
PublicOnDisk bool
PrivateMode os.FileMode // zero when the file is absent
PublicMode os.FileMode
Recorded bool // an inventory record covers this key
Fingerprint string
Created string
ExpiresOn string
Hosts []string // aliases wiring this key, in manifest order
// Vault is the 1Password vault holding the private key, "" for a key on
// disk. When set, PrivatePath is never expected to exist.
Vault string
Deployments []inventory.Deployment
Status string // query.NoKey | query.NeedsRedeploy | query.Deployed
}
Row is one key: what the manifest declares, what the inventory recorded, and what is actually on disk.
func (Row) InOnePassword ¶
InOnePassword reports whether the private key lives in 1Password.
type Selection ¶
Selection names the keys a bulk command acts on: some selectors (each a profile, host alias, key name or profile/key), every key in a category, or every key. All excludes the others, so "--all work" cannot quietly mean all.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service answers key-centric questions about one ~/.ssh tree.
func (*Service) Detail ¶
Detail returns one key's row plus the fingerprint of its public key on disk. Only the public half is ever read.
func (*Service) Rows ¶
Rows returns one row per key the manifest owns, in KeyRefs order (profile in manifest order, host-derived keys before declared-only ones). selector filters by profile, host alias, key name, or the composite "profile/key" form; empty means every key. An unmatched selector is an error, so a typo never looks like an empty result.