From ffa39a17f48ee9847cc85819d8134b5eb9482b77 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 29 Oct 2021 08:31:26 +0300 Subject: explicitly use dlog.Server for server packages and dlog.Clent for client packages for logging --- internal/ssh/server/hostkey.go | 10 +++++----- internal/ssh/server/publickeycallback.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'internal/ssh/server') diff --git a/internal/ssh/server/hostkey.go b/internal/ssh/server/hostkey.go index 4844d36..be23d85 100644 --- a/internal/ssh/server/hostkey.go +++ b/internal/ssh/server/hostkey.go @@ -18,25 +18,25 @@ func PrivateHostKey() []byte { _, err := os.Stat(hostKeyFile) if os.IsNotExist(err) { - dlog.Common.Info("Generating private server RSA host key") + dlog.Server.Info("Generating private server RSA host key") privateKey, err := ssh.GeneratePrivateRSAKey(config.Server.HostKeyBits) if err != nil { - dlog.Common.FatalPanic("Failed to generate private server RSA host key", err) + dlog.Server.FatalPanic("Failed to generate private server RSA host key", err) } pem := ssh.EncodePrivateKeyToPEM(privateKey) if err := ioutil.WriteFile(hostKeyFile, pem, 0600); err != nil { - dlog.Common.Error("Unable to write private server RSA host key to file", + dlog.Server.Error("Unable to write private server RSA host key to file", hostKeyFile, err) } return pem } - dlog.Common.Info("Reading private server RSA host key from file", hostKeyFile) + dlog.Server.Info("Reading private server RSA host key from file", hostKeyFile) pem, err := ioutil.ReadFile(hostKeyFile) if err != nil { - dlog.Common.FatalPanic("Failed to load private server RSA host key", err) + dlog.Server.FatalPanic("Failed to load private server RSA host key", err) } return pem } diff --git a/internal/ssh/server/publickeycallback.go b/internal/ssh/server/publickeycallback.go index 585469f..c661419 100644 --- a/internal/ssh/server/publickeycallback.go +++ b/internal/ssh/server/publickeycallback.go @@ -23,9 +23,9 @@ func PublicKeyCallback(c gossh.ConnMetadata, return nil, err } - dlog.Common.Info(user, "Incoming authorization") + dlog.Server.Info(user, "Incoming authorization") if config.ServerRelaxedAuthEnable { - dlog.Common.Fatal(user, "Granting permissions via relaxed-auth") + dlog.Server.Fatal(user, "Granting permissions via relaxed-auth") return nil, nil } @@ -34,7 +34,7 @@ func PublicKeyCallback(c gossh.ConnMetadata, return nil, err } - dlog.Common.Info(user, "Reading", authorizedKeysFile) + dlog.Server.Info(user, "Reading", authorizedKeysFile) authorizedKeysBytes, err := ioutil.ReadFile(authorizedKeysFile) if err != nil { return nil, fmt.Errorf("Unable to read authorized keys file|%s|%s|%s", @@ -56,11 +56,11 @@ func verifyAuthorizedKeys(user *user.User, authorizedKeysBytes []byte, } authorizedKeysMap[string(authorizedPubKey.Marshal())] = true authorizedKeysBytes = restBytes - dlog.Common.Debug(user, "Authorized public key fingerprint", + dlog.Server.Debug(user, "Authorized public key fingerprint", gossh.FingerprintSHA256(authorizedPubKey)) } - dlog.Common.Debug(user, "Offered public key fingerprint", gossh.FingerprintSHA256(offeredPubKey)) + dlog.Server.Debug(user, "Offered public key fingerprint", gossh.FingerprintSHA256(offeredPubKey)) if authorizedKeysMap[string(offeredPubKey.Marshal())] { return &gossh.Permissions{ Extensions: map[string]string{"pubkey-fp": gossh.FingerprintSHA256(offeredPubKey)}, -- cgit v1.2.3