quickstart

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package quickstart provisions a fresh data directory for the opinionated Docker quick-start: a generated admin, sample users, a demo service, an MFA key, a self-signed cert, a MOTD, and a human-readable credentials file.

Index

Constants

View Source
const (
	PlainAddr = ":2323"
	TLSAddr   = ":2324"

	AdminUser       = "ADMIN"
	DemoGroup       = "DEMO"
	DemoServiceName = "DEMO"
	DemoBackendHost = "dummy3270"
	DemoBackendPort = 3300

	CertValidDays = 825
)
View Source
const PasswordCharset = "ABCDEFGHJKMNPQRSTVWXYZ23456789"

PasswordCharset is the 3270-typeable unambiguous alphanumeric set used for one-time passwords: uppercase letters excluding I, L, O; digits excluding 0 and 1. Eliminates common transcription errors on physical 3270 keyboards.

Variables

View Source
var CertHosts = []string{"localhost", "127.0.0.1", "::1"}

CertHosts are the SAN entries for the generated self-signed cert.

View Source
var ErrAlreadyProvisioned = errors.New("quickstart: data dir already provisioned")

ErrAlreadyProvisioned signals that the data dir already has a config file and must not be touched (the normal post-first-boot path).

View Source
var SampleUsers = []string{"OPERATOR", "GUEST"}

SampleUsers are the non-admin demo accounts seeded on first run.

Functions

func DefaultBranding

func DefaultBranding() string

DefaultBranding is the example login art seeded on first run. It is authored pre-centered (the login screen renders columns 0-79 verbatim, no auto-indent) and sized to fit inside the MOD 2 branding region (18 rows). Rendered through the login screen body (see internal/screens/login.go).

func DefaultMOTD

func DefaultMOTD() string

DefaultMOTD is the welcome text shown on first 3270 login. Rendered through the chrome-less MOTD/NEWS path (see internal/screens/news.go).

func GenPassword

func GenPassword() (string, error)

GenPassword returns a random password in XXXX-XXXX-XXXX form using passwordCharset (12 characters grouped for readability).

func GenerateSelfSignedCert

func GenerateSelfSignedCert(hosts []string, validDays int) (certPEM, keyPEM []byte, err error)

GenerateSelfSignedCert returns PEM-encoded cert and private key for a self-signed leaf valid for validDays, with hosts split into DNS and IP SANs. Pure Go (no openssl). Intended for the quick-start TLS listener only.

Types

type Cred

type Cred struct {
	Username string
	Password string
	Groups   []string
}

Cred is a generated account credential, surfaced once in SETUP-DEFAULTS.TXT.

type Layout

type Layout struct {
	Dir       string
	DB        string
	Config    string
	MFAKey    string
	CertDir   string
	Cert      string
	Key       string
	MOTD      string
	Branding  string
	SetupFile string
}

Layout maps a data directory to every artifact quickstart manages.

func NewLayout

func NewLayout(dir string) Layout

NewLayout derives all artifact paths under dir.

type Result

type Result struct {
	DataDir     string
	Admin       Cred
	Samples     []Cred
	PlainAddr   string
	TLSAddr     string
	DemoService string
}

Result is everything a provisioning run generated, for the SETUP file and tests.

func Provision

func Provision(ctx context.Context, dir string) (*Result, error)

Provision classifies dir and, when fresh, generates every quick-start artifact, writing the config file last as the commit point. Returns ErrAlreadyProvisioned when a config file is already present, or a partial-dir error when proxy.db exists without a config.

Jump to

Keyboard shortcuts

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