From 150eee70df9a6381bef1713fc0d38d42d46e074f Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 5 Apr 2022 10:59:25 -0700 Subject: [PATCH] Updates based on Herman's feedback --- authority/authority.go | 6 +++--- ca/ca.go | 10 +++++++--- commands/app.go | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/authority/authority.go b/authority/authority.go index 8c5eb9c4..b6071060 100644 --- a/authority/authority.go +++ b/authority/authority.go @@ -80,7 +80,7 @@ type Authority struct { adminMutex sync.RWMutex } -type AuthorityInfo struct { +type Info struct { StartTime time.Time RootX509Certs []*x509.Certificate SSHCAUserPublicKey []byte @@ -567,8 +567,8 @@ func (a *Authority) GetAdminDatabase() admin.DB { return a.adminDB } -func (a *Authority) GetInfo() AuthorityInfo { - ai := AuthorityInfo{ +func (a *Authority) GetInfo() Info { + ai := Info{ StartTime: a.startTime, RootX509Certs: a.rootX509Certs, DNSNames: a.config.DNSNames, diff --git a/ca/ca.go b/ca/ca.go index fce80e00..0d4f1578 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -301,14 +301,18 @@ func (ca *CA) Run() error { if !ca.opts.quiet { authorityInfo := ca.auth.GetInfo() - log.Printf("Welcome to step-ca.") + log.Printf("Starting %s", step.Version()) log.Printf("Documentation: https://u.step.sm/docs/ca") log.Printf("Community Discord: https://u.step.sm/discord") - log.Printf("Current context: %s", step.Contexts().GetCurrent().Name) + if step.Contexts().GetCurrent() != nil { + log.Printf("Current context: %s", step.Contexts().GetCurrent().Name) + } log.Printf("Config file: %s", ca.opts.configFile) - log.Printf("The primary server URL is https://%s%s", + baseURL := fmt.Sprintf("https://%s%s", authorityInfo.DNSNames[0], ca.config.Address[strings.LastIndex(ca.config.Address, ":"):]) + log.Printf("The primary server URL is %s", baseURL) + log.Printf("Root certificates are available at %s/roots.pem", baseURL) if len(authorityInfo.DNSNames) > 1 { log.Printf("Additional configured hostnames: %s", strings.Join(authorityInfo.DNSNames[1:], ", ")) diff --git a/commands/app.go b/commands/app.go index 6297581f..c3eacd02 100644 --- a/commands/app.go +++ b/commands/app.go @@ -61,6 +61,7 @@ certificate issuer private key used in the RA mode.`, cli.BoolFlag{ Name: "quiet", Usage: "disable startup information", + EnvVar: "STEP_CA_QUIET", }, cli.StringFlag{ Name: "context",