model

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 1 Imported by: 0

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.

func (Account) String

func (a Account) String() string

String returns a user-friendly representation of the account. It formats as "Label (user@host)" if a label is present, otherwise just "user@host".

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 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.

func (PublicKey) String

func (k PublicKey) String() string

String returns the full public key line suitable for an authorized_keys file.

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.

Jump to

Keyboard shortcuts

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