Carl Tashian 4 лет назад
Родитель
Сommit
90cb6315b1
2 измененных файлов с 14 добавлено и 10 удалено
  1. 10 6
      authority/authority.go
  2. 4 4
      ca/ca.go

+ 10 - 6
authority/authority.go

@@ -83,8 +83,8 @@ type Authority struct {
 type AuthorityInfo struct {
 type AuthorityInfo struct {
 	StartTime time.Time
 	StartTime time.Time
 	RootX509Certs           []*x509.Certificate
 	RootX509Certs           []*x509.Certificate
-	SSHCAUserCerts          []ssh.PublicKey
-	SSHCAHostCerts          []ssh.PublicKey
+	SSHCAUserPublicKey      []byte
+	SSHCAHostPublicKey      []byte
 }
 }
 
 
 
 
@@ -568,13 +568,17 @@ func (a *Authority) GetAdminDatabase() admin.DB {
 }
 }
 
 
 func (a *Authority) GetAuthorityInfo() *AuthorityInfo {
 func (a *Authority) GetAuthorityInfo() *AuthorityInfo {
-	return &AuthorityInfo{
+	ai := &AuthorityInfo{
 		StartTime: a.startTime,
 		StartTime: a.startTime,
 		RootX509Certs: a.rootX509Certs,
 		RootX509Certs: a.rootX509Certs,
-		SSHCAUserCerts: a.sshCAUserCerts,
-		SSHCAHostCerts: a.sshCAHostCerts,
 	}
 	}
-
+	if a.sshCAUserCertSignKey != nil {
+		ai.SSHCAUserPublicKey = ssh.MarshalAuthorizedKey(a.sshCAUserCertSignKey.PublicKey())
+	}
+	if a.sshCAHostCertSignKey != nil {
+		ai.SSHCAHostPublicKey = ssh.MarshalAuthorizedKey(a.sshCAHostCertSignKey.PublicKey())
+	}
+	return ai
 }
 }
 
 
 // IsAdminAPIEnabled returns a boolean indicating whether the Admin API has
 // IsAdminAPIEnabled returns a boolean indicating whether the Admin API has

+ 4 - 4
ca/ca.go

@@ -305,11 +305,11 @@ func (ca *CA) Run() error {
 			 sum := sha256.Sum256(crt.Raw)
 			 sum := sha256.Sum256(crt.Raw)
 			 log.Printf("X.509 Root Fingerprint: %s", hex.EncodeToString(sum[:]))
 			 log.Printf("X.509 Root Fingerprint: %s", hex.EncodeToString(sum[:]))
 		}
 		}
-		if ca.config.SSH != nil {
-			log.Printf("SSH Host CA Key: %s\n", ca.config.SSH.HostKey)
+		if authorityInfo.SSHCAHostPublicKey != nil {
+			log.Printf("SSH Host CA Key: %s\n", authorityInfo.SSHCAHostPublicKey)
 		}
 		}
-		if ca.config.SSH != nil {
-			log.Printf("SSH User CA Key: %s\n", ca.config.SSH.UserKey)
+		if authorityInfo.SSHCAUserPublicKey != nil {
+			log.Printf("SSH User CA Key: %s\n", authorityInfo.SSHCAUserPublicKey)
 		}
 		}
 		log.Printf("Documentation: https://u.step.sm/docs/ca")
 		log.Printf("Documentation: https://u.step.sm/docs/ca")
 		log.Printf("Community Discord: https://u.step.sm/discord")
 		log.Printf("Community Discord: https://u.step.sm/discord")