Documentation
¶
Overview ¶
package model defines the core data structures used throughout Keymaster. These structs represent the entities stored in the database and used by the application logic, such as accounts, keys, and audit logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID int // The primary key for the account.
Username string // The SSH username for the account.
Hostname string // The hostname or IP address of the target machine.
Label string // A user-friendly alias for the account (e.g., "prod-web-01").
Tags string // Comma-separated key:value pairs for organization.
// Serial is the serial number of the SystemKey last deployed to this account.
// A value of 0 indicates the account has never been deployed to.
Serial int
// IsActive determines if the account is included in bulk operations like 'deploy' and 'audit'.
IsActive bool
}
Account represents a user on a specific host (e.g., deploy@server-01). This is the core entity for which we manage access.
type AccountKey ¶ added in v1.4.0
AccountKey represents the many-to-many relationship between accounts and public keys.
type AuditLogEntry ¶
type AuditLogEntry struct {
ID int // The primary key for the log entry.
Timestamp string // The timestamp of the event (as a string for display simplicity).
Username string // The OS user who performed the action.
Action string // A category for the event (e.g., "DEPLOY_SUCCESS", "ADD_ACCOUNT").
Details string // A free-text description of the event.
}
AuditLogEntry represents a single event in the audit log.
type BackupData ¶ added in v1.4.0
type BackupData struct {
// SchemaVersion helps in handling migrations during restore.
SchemaVersion int `json:"schema_version"`
// Data from each table.
Accounts []Account `json:"accounts"`
PublicKeys []PublicKey `json:"public_keys"`
AccountKeys []AccountKey `json:"account_keys"`
SystemKeys []SystemKey `json:"system_keys"`
KnownHosts []KnownHost `json:"known_hosts"`
AuditLogEntries []AuditLogEntry `json:"audit_log_entries"`
BootstrapSessions []BootstrapSession `json:"bootstrap_sessions"`
}
BackupData is a container for all data to be exported for a backup. It holds slices of all the core models in Keymaster.
type BootstrapSession ¶ added in v1.4.0
type BootstrapSession struct {
ID string // Unique session identifier.
Username string // Username for the pending account.
Hostname string // Hostname for the pending account.
Label string // Optional label for the pending account.
Tags string // Optional tags for the pending account.
TempPublicKey string // Temporary public key for initial access.
CreatedAt time.Time // When the session was created.
ExpiresAt time.Time // When the session expires.
Status string // Current status (active, committing, completed, failed, orphaned).
}
BootstrapSession represents an ongoing bootstrap operation for a new host. Sessions track temporary keys and pending account information during the bootstrap workflow.
type PublicKey ¶
type PublicKey struct {
ID int // The primary key for the public key.
Algorithm string // The key algorithm (e.g., "ssh-ed25519").
KeyData string // The base64-encoded key data.
Comment string // The unique comment associated with the key, used as an identifier.
// IsGlobal indicates if the key should be deployed to all active accounts by default.
IsGlobal bool
}
PublicKey represents a single SSH public key stored in the database.
type SystemKey ¶
type SystemKey struct {
ID int // The primary key for the system key.
Serial int // A unique, auto-incrementing number identifying this key version.
PublicKey string // The public part of the key in authorized_keys format.
PrivateKey string // The private part of the key in PEM format.
// IsActive indicates if this is the current key for new deployments. Only one key can be active.
IsActive bool
}
SystemKey represents a key pair used by Keymaster itself for deployment. The private key is stored to allow for agentless operation.