More info on startup

pull/862/head
Carl Tashian 2 years ago
parent 7ebb2e4c74
commit 43f2c655b9

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

@ -1,15 +1,14 @@
package ca package ca
import ( import (
"crypto/sha256"
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"encoding/hex"
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
"reflect" "reflect"
"strings"
"sync" "sync"
"github.com/go-chi/chi" "github.com/go-chi/chi"
@ -28,6 +27,7 @@ import (
scepAPI "github.com/smallstep/certificates/scep/api" scepAPI "github.com/smallstep/certificates/scep/api"
"github.com/smallstep/certificates/server" "github.com/smallstep/certificates/server"
"github.com/smallstep/nosql" "github.com/smallstep/nosql"
"go.step.sm/crypto/x509util"
) )
type options struct { type options struct {
@ -300,12 +300,19 @@ func (ca *CA) Run() error {
if !ca.opts.quiet { if !ca.opts.quiet {
authorityInfo := ca.auth.GetInfo() 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 { for _, crt := range authorityInfo.RootX509Certs {
log.Printf("X.509 Root Fingerprint: %s", x509util.Fingerprint(crt)) log.Printf("X.509 Root Fingerprint: %s", x509util.Fingerprint(crt))
} }
if authorityInfo.SSHCAHostPublicKey != nil { 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 { if authorityInfo.SSHCAUserPublicKey != nil {
log.Printf("SSH User CA Key: %s\n", authorityInfo.SSHCAUserPublicKey) log.Printf("SSH User CA Key: %s\n", authorityInfo.SSHCAUserPublicKey)

Loading…
Cancel
Save