aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-12-28 21:45:33 +0000
committerNiall Sheridan <nsheridan@gmail.com>2016-12-28 21:45:33 +0000
commitd9f4e83e87acb5f099e612e3693a37aceead6315 (patch)
treee7a038a7a4b285e27852a16f83053041fd2a0c4e
parentf1fcf2a45b326a51ebc4056ca3be6ca7208035a2 (diff)
Log SHA256 fingerprints
-rw-r--r--server/signer/signer.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/server/signer/signer.go b/server/signer/signer.go
index 5ee170a..a4cf919 100644
--- a/server/signer/signer.go
+++ b/server/signer/signer.go
@@ -1,11 +1,9 @@
package signer
import (
- "crypto/md5"
"crypto/rand"
"fmt"
"log"
- "strings"
"time"
"go4.org/wkfs"
@@ -49,7 +47,7 @@ func (s *KeySigner) SignUserKey(req *lib.SignRequest, username string) (*ssh.Cer
if err := cert.SignCert(rand.Reader, s.ca); err != nil {
return nil, err
}
- log.Printf("Issued cert id: %s principals: %s fp: %s valid until: %s\n", cert.KeyId, cert.ValidPrincipals, fingerprint(pubkey), time.Unix(int64(cert.ValidBefore), 0).UTC())
+ log.Printf("Issued cert id: %s principals: %s fp: %s valid until: %s\n", cert.KeyId, cert.ValidPrincipals, ssh.FingerprintSHA256(pubkey), time.Unix(int64(cert.ValidBefore), 0).UTC())
return cert, nil
}
@@ -107,10 +105,3 @@ func New(conf *config.SSH) (*KeySigner, error) {
permissions: makeperms(conf.Permissions),
}, nil
}
-
-func fingerprint(pubkey ssh.PublicKey) string {
- md5String := md5.New()
- md5String.Write(pubkey.Marshal())
- fp := fmt.Sprintf("% x", md5String.Sum(nil))
- return strings.Replace(fp, " ", ":", -1)
-}