More info on startup

This commit is contained in:
Carl Tashian 2022-04-04 12:16:37 -07:00
parent 7ebb2e4c74
commit 43f2c655b9
2 changed files with 13 additions and 4 deletions

View file

@ -85,6 +85,7 @@ type AuthorityInfo struct {
RootX509Certs []*x509.Certificate
SSHCAUserPublicKey []byte
SSHCAHostPublicKey []byte
DNSNames []string
}
// New creates and initiates a new Authority type.
@ -570,6 +571,7 @@ func (a *Authority) GetInfo() AuthorityInfo {
ai := AuthorityInfo{
StartTime: a.startTime,
RootX509Certs: a.rootX509Certs,
DNSNames: a.config.DNSNames,
}
if a.sshCAUserCertSignKey != nil {
ai.SSHCAUserPublicKey = ssh.MarshalAuthorizedKey(a.sshCAUserCertSignKey.PublicKey())

View file

@ -1,15 +1,14 @@
package ca
import (
"crypto/sha256"
"crypto/tls"
"crypto/x509"
"encoding/hex"
"fmt"
"log"
"net/http"
"net/url"
"reflect"
"strings"
"sync"
"github.com/go-chi/chi"
@ -28,6 +27,7 @@ import (
scepAPI "github.com/smallstep/certificates/scep/api"
"github.com/smallstep/certificates/server"
"github.com/smallstep/nosql"
"go.step.sm/crypto/x509util"
)
type options struct {
@ -300,12 +300,19 @@ func (ca *CA) Run() error {
if !ca.opts.quiet {
authorityInfo := ca.auth.GetInfo()
log.Printf("Address: %s", ca.config.Address)
log.Printf("Welcome to step-ca.")
log.Printf("The primary server URL is https://%s%s",
authorityInfo.DNSNames[0],
ca.config.Address[strings.LastIndex(ca.config.Address, ":"):])
if len(authorityInfo.DNSNames) > 1 {
log.Printf("Additional configured hostnames: %s",
strings.Join(authorityInfo.DNSNames[1:], ", "))
}
for _, crt := range authorityInfo.RootX509Certs {
log.Printf("X.509 Root Fingerprint: %s", x509util.Fingerprint(crt))
}
if authorityInfo.SSHCAHostPublicKey != nil {
log.Printf("SSH Host CA Key: %s\n", authorityInfo.SSHCAHostPublicKey)
log.Printf("SSH Host CA Key is %s\n", authorityInfo.SSHCAHostPublicKey)
}
if authorityInfo.SSHCAUserPublicKey != nil {
log.Printf("SSH User CA Key: %s\n", authorityInfo.SSHCAUserPublicKey)