mirror of
https://github.com/outbackdingo/incus-os.git
synced 2026-01-27 10:19:24 +00:00
incus-osd: Display an application's TLS certificate fingerprint, if it has one
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
This commit is contained in:
@@ -3,6 +3,8 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
@@ -534,6 +536,14 @@ func startInitializeApplication(ctx context.Context, s *state.State, appName str
|
||||
s.Applications[appName] = appInfo
|
||||
}
|
||||
|
||||
// If the application has a TLS certificate, print its fingerprint so the user can verify it when initially connecting.
|
||||
cert, err := app.GetCertificate()
|
||||
if err == nil {
|
||||
rawFp := sha256.Sum256(cert.Certificate[0])
|
||||
|
||||
slog.InfoContext(ctx, "Application TLS certificate fingerprint", "name", appName, "fingerprint", hex.EncodeToString(rawFp[:]))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user