manifest

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package manifest is the authama manifest domain model. The manifest is the single source of truth; this package loads/validates it and exposes the per-host key resolution the renderer and reconciler depend on (per_service default, shared opt-in).

Index

Constants

View Source
const (
	GitModeProfile = "profile"
	GitModeSSH     = "ssh"
	GitModeHTTPS   = "https"
)

Git remote modes. A checkout's origin points at GitHub one of three ways: through a profile's own SSH alias (git@github-<profile>:owner/repo.git), through plain SSH to github.com (the key bound to the rendered `Host github.com`), or over HTTPS (the gh-app credential helper).

View Source
const (
	HypervisorParallels = "parallels"
	HypervisorVMPal     = "vmpal"
	HypervisorVMware    = "vmware"
	HypervisorUTM       = "utm"
	HypervisorLima      = "lima"
	HypervisorOrbStack  = "orbstack"
	HypervisorPodman    = "podman"
)

Hypervisors authama can resolve a devbox's address through.

View Source
const (
	KeyStoreFile        = "file"
	KeyStoreOnePassword = "1password"
)

Key stores. The empty string is the file store, so it never has to be written; anything else must be named here, because a typo would otherwise silently fall back to looking for private keys on disk.

View Source
const DefaultKeyComment = "{profile}/{alias} {date}"

DefaultKeyComment is the comment authama writes when neither the profile nor the defaults set key_comment: the one every release before key_comment wrote.

View Source
const DefaultKeyRoot = "profiles"

DefaultKeyRoot is the directory under ~/.ssh that holds the profile directories when defaults.key_root is unset: ~/.ssh/profiles/.

View Source
const ProxyCloudflared = "cloudflared"

ProxyCloudflared reaches a host through Cloudflare Access: ssh runs `cloudflared access ssh --hostname %h`, which opens the tunnel after a browser sign-in, so no SSH port has to be open to the internet.

Variables

View Source
var DefaultGlobalOptions = map[string]string{
	"AddKeysToAgent": "yes", "IgnoreUnknown": "UseKeychain", "UseKeychain": "yes",
	"IdentitiesOnly": "yes", "ServerAliveInterval": "60",
}

DefaultGlobalOptions are the canonical Host* defaults used by Starter.

GitModes lists the modes in the order they are documented.

Hypervisors lists the built-in hypervisors.

View Source
var ProxyKinds = []string{ProxyCloudflared}

ProxyKinds are the proxies authama can render. raw_options may not set a ProxyCommand (it would run any command ssh is given), so each supported proxy is a field authama writes itself, as it does for VM hosts.

Functions

func AdoptedPath added in v0.1.6

func AdoptedPath(m *Manifest, ref KeyRef) string

AdoptedPath is the key's adopted path relative to ~/.ssh, or "" when the key lives in its profile directory.

func ArchiveDir added in v0.1.6

func ArchiveDir(m *Manifest, sshDir string, ref KeyRef) string

ArchiveDir is where a key's rotated-out predecessors go: the profile's old/, for an adopted key too, so adopting never adds a directory beside the user's own files.

func CategoryConfigFileIn added in v0.1.6

func CategoryConfigFileIn(root, category string) string

CategoryConfigFileIn is the ~ form path the root config Includes for a category, matching how IdentityFile paths render.

func CategoryConfigRelIn added in v0.1.6

func CategoryConfigRelIn(root, category string) string

CategoryConfigRelIn is the forward-slash path, relative to ~/.ssh, of the file holding a category's Host blocks under the key root.

func CheckAdoptedPath added in v0.1.6

func CheckAdoptedPath(p string) error

CheckAdoptedPath reports why p cannot name an adopted key: it must be a relative, forward-slash path inside ~/.ssh, with no "..", not a .pub, and not a file ssh itself owns.

func CheckKeyRoot added in v0.1.6

func CheckKeyRoot(root string) error

CheckKeyRoot reports whether root can be defaults.key_root: one directory name directly under ~/.ssh, not hidden and not one of ssh's own files. "" is the default. A nested root ("a/b") and "." (profile directories loose in ~/.ssh, beside the user's own) are refused: a scan of every directory in ~/.ssh would take the user's folders for profiles.

func CheckSelectionName added in v0.1.6

func CheckSelectionName(name string) error

CheckSelectionName says why name cannot name a saved selection, or nil.

func GlobKeyTree added in v0.1.6

func GlobKeyTree(sshDir, root string, tail ...string) []string

GlobKeyTree matches the pattern tail inside every profile directory under ~/.ssh/<root>, in both layouts: <root>/<profile>/<tail> and <root>/<category>/<profile>/<tail>. It needs no manifest, because the scans that use it (doctor, snapshots, keyaudit) also look for what the manifest has forgotten.

A two-level match whose middle segment is "old" or dot-prefixed is dropped: that is a flat profile's rotation archive or staging directory, not a categorized profile, and a flat-only glob never saw inside them either. The result is sorted.

func IsBuiltinHypervisor added in v0.1.3

func IsBuiltinHypervisor(name string) bool

IsBuiltinHypervisor reports whether name is one of the built-in drivers.

func IsDangerousOption

func IsDangerousOption(key string) bool

IsDangerousOption reports whether an SSH option key can execute commands / pull in config (dropped on import, rejected by validation). Case-insensitive.

func KeyComment

func KeyComment(m *Manifest, ref KeyRef, alias, date string) string

KeyComment expands the profile's key_comment for one key. alias is the host the key serves (callers pass the key name for an unwired key) and date the mint day.

func KeyCommentTemplate

func KeyCommentTemplate(m *Manifest, profile string) string

KeyCommentTemplate resolves the key_comment template for a profile: the profile's own, else the defaults', else DefaultKeyComment. It and KeyComment are functions, not Manifest methods, to keep that type from regrowing into a facade (cmd/authama's layering test caps its method count).

func KeyRoot added in v0.1.6

func KeyRoot(m *Manifest) string

KeyRoot is the directory under ~/.ssh that holds the profile directories: defaults.key_root, or DefaultKeyRoot when it is unset or m is nil. It is the one place the root is decided; every path into the key tree is built from it, and a guard test fails on a "profiles" literal anywhere else.

func KeyRootAt added in v0.1.6

func KeyRootAt(path string) string

KeyRootAt is the key root of the manifest at path, for the scans that start from ~/.ssh alone (doctor, snapshots, the key audit, permissions). A manifest that is missing or does not load gives DefaultKeyRoot: those scans look for what a manifest has forgotten, so they never fail for want of one.

func KnownHypervisors added in v0.1.3

func KnownHypervisors() []string

KnownHypervisors is the built-in hypervisors followed by the custom ones.

func ManagedHostOption

func ManagedHostOption(key string) (useInstead string, ok bool)

ManagedHostOption reports whether a raw_options key duplicates a line the renderer writes for every host, and what to set instead. Case-insensitive, as ssh reads keywords.

func NamingRules added in v0.1.6

func NamingRules(m *Manifest) naming.Rules

NamingRules are m's naming rules with the defaults filled in. A nil m has the defaults.

func NamingViolation added in v0.1.6

func NamingViolation(m *Manifest, profileName, alias string) string

NamingViolation says why a host's alias does not follow m's rules, or "".

func OwnSSHRefusal added in v0.1.6

func OwnSSHRefusal(hypervisor string) string

OwnSSHRefusal is why an OrbStack or Podman machine cannot be a VM host, and where its Docker is instead. `authama ssh vm docker-context` is not the answer: it needs a VM host, which these machines never are.

func ProfileCode added in v0.1.6

func ProfileCode(m *Manifest, profile string) string

ProfileCode is a profile's {code}: its own code, or what the rules' code fallback gives it ("" for none).

func ProfileForOwner

func ProfileForOwner(m *Manifest, owner string) (string, error)

ProfileForOwner picks the profile a GitHub owner uses: Orgs, then Profile, then the only profile with a GitHub host. It fails rather than guess between several.

func ProfileNamingRules added in v0.1.6

func ProfileNamingRules(m *Manifest, profile string) naming.Rules

ProfileNamingRules are the rules a profile's servers are named by: the manifest's, with the profile's own naming over them.

func RawOptionOverlaps

func RawOptionOverlaps(m *Manifest) []string

RawOptionOverlaps lists, as "profile/alias: ..." lines in manifest order, each raw_options key that duplicates a managed line. The renderer emits only the managed value (bar a raw Port at the default port), so these keys read as if they applied when they do not.

func Reserve added in v0.1.6

func Reserve(m *Manifest, name string, r ReservedKey)

Reserve adds or replaces a reservation.

func ReservedKeyNames added in v0.1.6

func ReservedKeyNames(m *Manifest) []string

ReservedKeyNames returns the reserved key names, sorted.

func SelectionNames added in v0.1.6

func SelectionNames(m *Manifest) []string

SelectionNames are m's saved selections, sorted. A function, not a method: Manifest stays under its method ceiling.

func SetCustomHypervisors added in v0.1.3

func SetCustomHypervisors(names []string)

SetCustomHypervisors replaces the registered custom hypervisor names.

func SetSelection added in v0.1.6

func SetSelection(m *Manifest, name string, raw json.RawMessage)

SetSelection keeps raw as m's saved selection name, or removes it when raw is nil. An empty export section is dropped, so a manifest that never saved one is written as before.

func Unreserve added in v0.1.6

func Unreserve(m *Manifest, name string) bool

Unreserve removes a reservation, reporting whether there was one.

func UsesOnePassword

func UsesOnePassword(m *Manifest) bool

UsesOnePassword reports whether any profile keeps its keys in 1Password. A function rather than a method: Manifest carries a method ceiling (see TestNoTypeHasBecomeTheFacadeAgain), and this needs nothing private.

func ValidReservedKeyName added in v0.1.6

func ValidReservedKeyName(name string) error

ValidReservedKeyName reports whether name can be a reserved key: a file name directly in ~/.ssh, not a .pub and not one of ssh's own files.

func ValidateHost

func ValidateHost(profile string, h Host) error

ValidateHost reports whether one host of the named profile would pass the manifest's validation, so a caller assembling hosts (import) can leave out the one that fails rather than the whole batch.

Types

type Defaults

type Defaults struct {
	KeyType         string         `json:"key_type"`
	KeyScope        string         `json:"key_scope"`
	RotateAfterDays int            `json:"rotate_after_days"`
	WarnBeforeDays  []int          `json:"warn_before_days"`
	ExpiryCheck     ExpiryCheck    `json:"expiry_check"`
	GlobalOptions   OrderedOptions `json:"global_options"`
	// OnePasswordAgent overrides the 1Password SSH agent socket a profile with
	// key_store "1password" renders as its IdentityAgent. Empty = the
	// platform's standard path (see OnePasswordAgentSocket).
	OnePasswordAgent string `json:"onepassword_agent,omitempty"`
	// KeyComment is the ssh-keygen -C template every profile inherits; empty
	// means DefaultKeyComment.
	KeyComment string `json:"key_comment,omitempty"`
	// Git configures `authama ssh git` and the rendered `Host github.com` block.
	Git *GitDefaults `json:"git,omitempty"`
	// KeyRoot is the directory under ~/.ssh holding the profile directories;
	// empty means DefaultKeyRoot ("profiles"). Read it through KeyRoot.
	KeyRoot string `json:"key_root,omitempty"`
	// Naming holds the rules servers and keys are named by; nil is the
	// defaults (see NamingRules).
	Naming *Naming `json:"naming,omitempty"`
	// Export holds what `authama export` keeps in the manifest: saved
	// selections; nil when none are saved.
	Export *ExportDefaults `json:"export,omitempty"`
}

Defaults are manifest-wide defaults.

func (Defaults) MarshalJSON

func (d Defaults) MarshalJSON() ([]byte, error)

MarshalJSON emits warn_before_days as [] when empty (not null) and global_options as {} via OrderedOptions, in declaration order.

func (Defaults) OnePasswordAgentSocket

func (d Defaults) OnePasswordAgentSocket() string

OnePasswordAgentSocket is the IdentityAgent a 1Password profile renders: the defaults override when set, else the platform's standard socket (checked against 1password.dev/ssh/get-started, 2026-10-19). "" on Windows, where Microsoft OpenSSH talks to one fixed pipe and per-host agents do not apply.

func (*Defaults) UnmarshalJSON

func (d *Defaults) UnmarshalJSON(b []byte) error

type ExpiryCheck

type ExpiryCheck struct {
	Enabled       bool `json:"enabled"`
	DebounceHours int  `json:"debounce_hours"`
	DesktopNotify bool `json:"desktop_notify"`
}

ExpiryCheck is the notifier policy.

func (*ExpiryCheck) UnmarshalJSON

func (e *ExpiryCheck) UnmarshalJSON(b []byte) error

type ExportDefaults added in v0.1.6

type ExportDefaults struct {
	// Selections are saved selections by name, each the selection JSON the
	// export pipeline reads, with its own version inside. The manifest checks
	// the names and that each is a JSON object; the pipeline checks the rest
	// when it reads one.
	Selections map[string]json.RawMessage `json:"selections,omitempty"`
}

ExportDefaults is what `authama export` keeps in the manifest, so it travels with it: selections saved for every machine that shares it.

type GitDefaults

type GitDefaults struct {
	// Mode is the default remote mode; empty means profile.
	Mode string `json:"mode,omitempty"`
	// Profile is the default identity: its GitHub key is bound to `Host github.com`
	// (ssh mode), and it is used for an owner Orgs does not list.
	Profile string `json:"profile,omitempty"`
	// Orgs maps a GitHub owner to the profile whose key it uses.
	Orgs map[string]string `json:"orgs,omitempty"`
}

GitDefaults configures `authama ssh git`. Absent, the mode is profile and no `Host github.com` block is rendered, so a manifest without it renders as before.

func (*GitDefaults) EffectiveMode

func (g *GitDefaults) EffectiveMode() string

EffectiveMode is Mode, or profile when unset.

type Host

type Host struct {
	Alias       string         `json:"alias"`
	Hostname    string         `json:"hostname"`
	User        string         `json:"user"`
	Port        int            `json:"port"`
	Provider    *string        `json:"provider,omitempty"`
	TokenEnv    *string        `json:"token_env,omitempty"`
	KeyName     *string        `json:"key_name,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	RequiresVPN bool           `json:"requires_vpn"`
	VPNName     *string        `json:"vpn_name,omitempty"`
	VPNURL      *string        `json:"vpn_url,omitempty"`
	RawOptions  OrderedOptions `json:"raw_options,omitempty"`
	// VM marks a local VM whose address the hypervisor supplies at connect time.
	VM *VMSpec `json:"vm,omitempty"`
	// Proxy routes connections through a proxy command, e.g. Cloudflare Access.
	Proxy *ProxySpec `json:"proxy,omitempty"`
}

Host is a single SSH host entry.

func GitHubHostOf

func GitHubHostOf(m *Manifest, profile string) (Host, bool)

GitHubHostOf returns the profile's GitHub host: the first one whose hostname is github.com. A profile with none has no profile-mode alias.

func VMHost

func VMHost(m *Manifest, alias string) (Host, error)

VMHost finds the host alias in m, which must have a vm spec.

func (Host) MarshalJSON

func (h Host) MarshalJSON() ([]byte, error)

MarshalJSON emits every field in declaration order (null for unset pointers, [] for no tags), matching the files v1 and v2 wrote. raw_options serializes {} when empty via OrderedOptions.

func (*Host) UnmarshalJSON

func (h *Host) UnmarshalJSON(b []byte) error

type KeyRef

type KeyRef struct {
	Profile string
	KeyName string
}

KeyRef names one key: the profile that owns it plus the file name inside that profile's directory. Key names are unique per profile, not globally - a person working under two orgs uses the same file name in both profile directories.

func (KeyRef) String

func (r KeyRef) String() string

String renders the composite "profile/key" selector form.

type KeySpec

type KeySpec struct {
	Name string `json:"name"`
	// Unset (rather than defaulted-on-load) so re-saving a manifest does not
	// bake today's defaults into every key, freezing them against a later
	// change to defaults.key_type / defaults.rotate_after_days.
	Type            *string `json:"type,omitempty"`
	RotateAfterDays *int    `json:"rotate_after_days,omitempty"`
	// Path adopts a key where it already is: the private key's path relative
	// to ~/.ssh, in forward-slash form ("id_ed25519", "work/deploy_key").
	// authama references it there and never moves, renames or deletes it;
	// empty keeps the key in its profile directory. Rotation archives the old
	// pair in the profile's old/ and mints the successor at the same path.
	Path string `json:"path,omitempty"`
}

KeySpec declares a key as a first-class member of its profile, independent of any host that uses it. Type and rotate_after_days are optional and inherit the manifest defaults when unset (see KeyTypeFor / RotateAfterDaysFor).

Declaring is optional in both directions: a host whose key_name names a key absent from the list still implicitly declares it, so every pre-`keys` manifest loads and renders unchanged. The list exists so a profile can own a key no host references yet - a second identity for the same org, or a key minted ahead of the host it will serve - which previously could not be expressed at all, since a key existed only as a property of a host.

func (*KeySpec) UnmarshalJSON

func (k *KeySpec) UnmarshalJSON(b []byte) error

type Manifest

type Manifest struct {
	Version  int                `json:"version"`
	Defaults Defaults           `json:"defaults"`
	Profiles map[string]Profile `json:"profiles"`
	// ReservedKeys are loose ~/.ssh keys kept on purpose, by file name (0.1.4).
	ReservedKeys map[string]ReservedKey `json:"reserved_keys,omitempty"`
	// contains filtered or unexported fields
}

Manifest is the whole manifest.

func Load

func Load(path string) (*Manifest, error)

Load reads and validates a manifest from path.

func Starter

func Starter(emitUseKeychain bool) *Manifest

Starter returns a minimal valid manifest for `authama init` - defaults and no profiles. Off macOS, the UseKeychain option is dropped. Mirrors Manifest.starter.

func (*Manifest) Categories

func (m *Manifest) Categories() []string

Categories returns the distinct categories in use, in first-seen manifest (file) order, so the root config Includes them in a stable order.

func (*Manifest) DeleteProfile

func (m *Manifest) DeleteProfile(name string)

DeleteProfile removes a profile and its order entry.

func (*Manifest) HostsForKey

func (m *Manifest) HostsForKey(ref KeyRef) ([]Host, error)

HostsForKey returns the hosts that use one key, scoped to its own profile.

func (*Manifest) IdentityFile

func (m *Manifest) IdentityFile(profileName, keyName string) string

IdentityFile is the rendered ~ form path for a key (always forward slashes). It names the private key. For a 1Password profile the private key is never on disk, so the renderer points ssh at its .pub instead; inventory records and every other caller keep this one, so a key has the same identity in both stores.

func (*Manifest) IterResolved

func (m *Manifest) IterResolved() ([]ResolvedKey, error)

IterResolved returns every host with its resolved key, in manifest (file) order - the order v1 resolved them in. Order is observable in order-preserving consumers like doctor's unpinned-host list; the rendered config is order-independent (the root config uses Include).

func (*Manifest) KeyPath

func (m *Manifest) KeyPath(sshDir string, ref KeyRef) string

KeyPath is the absolute path to a key's private half under sshDir: its adopted path when it has one, else its file in the profile directory.

func (*Manifest) KeyRefs

func (m *Manifest) KeyRefs() ([]KeyRef, error)

KeyRefs lists every distinct key in the manifest - the union of the keys each profile declares and the keys its hosts resolve to - deduplicated per profile so that hosts sharing one key yield a single ref. Refs are grouped by profile in manifest (file) order; within a profile, host-derived keys come first in host order, then any declared key no host uses.

The union is what makes a declared key real: it has no Host block, so walking IterResolved alone (which iterates hosts) leaves it invisible to reconcile, validate, doctor, list and expiry - present in the manifest, never minted, never checked.

func (*Manifest) KeySpecFor

func (m *Manifest) KeySpecFor(ref KeyRef) (KeySpec, bool)

KeySpecFor returns the profile's declaration for one key, if it has one. A key that only exists because a host names it has no spec and inherits every default.

func (*Manifest) KeyTypeFor

func (m *Manifest) KeyTypeFor(ref KeyRef) string

KeyTypeFor resolves the algorithm to mint a key with: the declared type when the profile declares one, else the manifest default.

func (*Manifest) KnownHostsFile

func (m *Manifest) KnownHostsFile() string

KnownHostsFile is the single, user-wide host-key trust store path. Every rendered host block points at this same file: splitting it per profile gave up cross-profile duplicate detection for no isolation ssh itself enforces (any profile's ssh invocation can read any other profile's known_hosts), so there is exactly one store, tagged and reference-counted per line instead of separated by directory.

func (Manifest) MarshalJSON

func (m Manifest) MarshalJSON() ([]byte, error)

MarshalJSON emits {version, defaults, profiles[, reserved_keys]} with profiles in manifest (file) order - a Go map would otherwise marshal its keys sorted. Compact output; Save re-indents it to two spaces, the indentation those files used.

func (*Manifest) NonEmptyProfiles

func (m *Manifest) NonEmptyProfiles() []string

NonEmptyProfiles lists profiles that have at least one host, in manifest (file) order - the order v1 listed non-empty profiles in.

func (*Manifest) ProfileDir

func (m *Manifest) ProfileDir(sshDir, profileName string) string

ProfileDir is ProfileRel as an absolute path under sshDir.

func (*Manifest) ProfileNames

func (m *Manifest) ProfileNames() []string

ProfileNames returns profile names in manifest (file) order. Falls back to name order for a programmatically built manifest with no captured order.

func (*Manifest) ProfileRel

func (m *Manifest) ProfileRel(profileName string) string

ProfileRel is a profile's key directory relative to ~/.ssh, in forward-slash form: <root>/<category>/<profile> when the profile has a category, else <root>/<profile>, where <root> is KeyRoot ("profiles" unless defaults.key_root names another). An undeclared profile resolves to the flat form, which is where every key lived before categories existed.

This is the one place the layout is decided. Every path to a key, its .pub, or its old/ directory goes through ProfileRel or ProfileDir; a hand-built filepath.Join(sshDir, "profiles", profile) is the defect a categorized profile exposes, because it silently points one directory too high.

func (*Manifest) ResolveKeySelector

func (m *Manifest) ResolveKeySelector(selector string) (KeyRef, error)

ResolveKeySelector turns a user-supplied key selector into a single KeyRef. It accepts the composite "profile/key" form, or a bare key name when exactly one profile uses it. A bare name matched by several profiles is an error listing the candidates, because the caller would otherwise operate on one profile's files while touching another's hosts.

func (*Manifest) ResolvedKeyName

func (m *Manifest) ResolvedKeyName(profileName string, host Host) (string, error)

ResolvedKeyName resolves a host's key name (per_service derives it; shared uses the profile key_name).

func (*Manifest) RotateAfterDaysFor

func (m *Manifest) RotateAfterDaysFor(ref KeyRef) int

RotateAfterDaysFor resolves a key's rotation interval the same way.

func (*Manifest) Save

func (m *Manifest) Save(path string) error

Save writes the manifest as indented JSON, atomically.

Via a temp file and a rename, not os.WriteFile: WriteFile truncates the target first, so a crash or a full disk mid-write leaves a truncated manifest - and the manifest is the only description of every profile, host and key, with nothing to rebuild it from. It also keeps whatever mode the file already had, while this re-asserts 0600 on every write.

func (*Manifest) SetProfile

func (m *Manifest) SetProfile(name string, p Profile)

SetProfile adds or replaces a profile, preserving file order (a new profile is appended, as v1 did).

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(b []byte) error

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate re-runs the manifest validators (so a bad edit can't be persisted).

type Naming added in v0.1.6

type Naming struct {
	// Alias is the alias template: {code}-{env}-{role}-{nn} by default.
	Alias string `json:"alias,omitempty"`
	// KeyName is the key-name template: {profile}_{alias}-{algo} by default,
	// the name every release before templates derived.
	KeyName string `json:"key_name,omitempty"`
	// Envs and Roles, when set, are the values {env} and {role} may take.
	Envs  []string `json:"envs,omitempty"`
	Roles []string `json:"roles,omitempty"`
	// Enforce is what adding a host whose alias breaks the rules does: off
	// (the default), warn, or error. Hosts already there are only reported.
	Enforce string `json:"enforce,omitempty"`
	// Start is the first number a generated alias takes: 0 (00, the
	// default) or 1 (01).
	Start int `json:"start,omitempty"`
	// CodeFallback is the {code} of a profile with no code of its own: none
	// (the default) or profile, its name.
	CodeFallback string `json:"code_fallback,omitempty"`
}

Naming is defaults.naming: how servers and their keys are named. Every field is optional; NamingRules fills the defaults.

type OrderedOptions

type OrderedOptions struct {
	// contains filtered or unexported fields
}

OrderedOptions is an SSH-option map that preserves JSON key order (the renderer emits options in that order) and stringifies values the way v1 did.

func NewOrderedOptions

func NewOrderedOptions(pairs [][2]string) OrderedOptions

NewOrderedOptions builds an OrderedOptions from ordered key/value pairs (later duplicates overwrite the value but keep the first position).

func (OrderedOptions) Get

func (o OrderedOptions) Get(k string) string

func (OrderedOptions) Keys

func (o OrderedOptions) Keys() []string

func (OrderedOptions) Len

func (o OrderedOptions) Len() int

Len, Keys, and Get expose the options in order.

func (OrderedOptions) MarshalJSON

func (o OrderedOptions) MarshalJSON() ([]byte, error)

MarshalJSON emits the options in their preserved order.

func (*OrderedOptions) UnmarshalJSON

func (o *OrderedOptions) UnmarshalJSON(b []byte) error

type Profile

type Profile struct {
	Category string `json:"category,omitempty"`
	// Code is the organisation's code name, the first part of its servers'
	// aliases under the naming rules (simtabi's is simbi: simbi-prd-web-00).
	Code string `json:"code,omitempty"`
	// Naming, when set, overrides defaults.naming for this profile, field by
	// field: a client with a convention of its own.
	Naming   *Naming `json:"naming,omitempty"`
	KeyStore string  `json:"key_store,omitempty"`
	OPVault  string  `json:"op_vault,omitempty"`
	KeyScope string  `json:"key_scope"`
	KeyName  *string `json:"key_name,omitempty"`
	// KeyComment is the ssh-keygen -C template for keys minted in this
	// profile; empty inherits defaults.key_comment (see KeyCommentTemplate).
	KeyComment string    `json:"key_comment,omitempty"`
	Keys       []KeySpec `json:"keys,omitempty"`
	Hosts      []Host    `json:"hosts"`
}

Profile groups hosts that share an identity, plus the keys it owns.

Category optionally files the profile under a grouping directory - profiles/<category>/<profile>/ instead of profiles/<profile>/ - and moves its Host blocks out of the root config into profiles/<category>/config, which the root config Includes. Empty keeps the flat layout and inline rendering, so a manifest written before categories existed behaves exactly as it did.

KeyStore says where the profile's private keys live: "file" (the default, written as an omitted field) keeps them under ~/.ssh; "1password" keeps them as SSH Key items in OPVault, with only the public half on disk.

func (Profile) InOnePassword

func (p Profile) InOnePassword() bool

InOnePassword reports whether the profile keeps its private keys in 1Password.

func (Profile) MarshalJSON

func (p Profile) MarshalJSON() ([]byte, error)

MarshalJSON emits key_scope, key_name (null when unset), and hosts ([] when none) in declaration order, matching those files. category and keys are emitted only when set: both are v2 additions with no counterpart there, and omitting them keeps a manifest that uses neither - i.e. every manifest written before these fields existed - byte-identical across a load/save cycle.

func (*Profile) UnmarshalJSON

func (p *Profile) UnmarshalJSON(b []byte) error

type ProxySpec

type ProxySpec struct {
	Kind string `json:"kind"`
}

ProxySpec routes a host's connections through a proxy command.

type ReservedKey added in v0.1.6

type ReservedKey struct {
	// For says what the key is kept for ("devbox", "docker devbox"); free text.
	For string `json:"for,omitempty"`
	// Note is anything else worth remembering about it.
	Note string `json:"note,omitempty"`
	// Fingerprint is the public key's SHA256 fingerprint when it was reserved,
	// so a key replaced under the same name is noticed.
	Fingerprint string `json:"fingerprint,omitempty"`
	// Since is the day it was reserved (YYYY-MM-DD).
	Since string `json:"since,omitempty"`
}

ReservedKey is a key file directly in ~/.ssh that is kept on purpose although no host uses it yet - a standby key for a devbox that does not exist, say. doctor reports it as information rather than a loose key, and `vm adopt-key` and `vm sync` release the reservation when they adopt the key. authama never touches the file: the reservation is the manifest's note about it.

type ResolvedKey

type ResolvedKey struct {
	Profile      string
	Host         Host
	KeyName      string
	IdentityFile string
}

ResolvedKey pairs a host with its resolved key name + IdentityFile path.

type VMSpec

type VMSpec struct {
	Hypervisor string `json:"hypervisor"`
	Name       string `json:"name"`
}

VMSpec marks a host as a local VM: its address comes from the hypervisor at connect time (`authama ssh vm proxy`), because a VM's IP changes and a static HostName goes stale.

Jump to

Keyboard shortcuts

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