diff --git a/lib/config/configuration.go b/lib/config/configuration.go index 03b78b121cf67..181bef014ff9c 100644 --- a/lib/config/configuration.go +++ b/lib/config/configuration.go @@ -2911,11 +2911,16 @@ func ConfigureOpenSSH(clf *CommandLineFlags, cfg *servicecfg.Config) error { lib.SetInsecureDevMode(clf.InsecureMode) // Apply command line --debug flag to override logger severity. + level := slog.LevelError if clf.Debug { cfg.SetLogLevel(slog.LevelDebug) + level = slog.LevelDebug cfg.Debug = clf.Debug } + // Ensure that the logging level is respected by the logger. + utils.InitLogger(utils.LoggingForDaemon, level) + if clf.AuthToken != "" { // store the value of the --token flag: cfg.SetToken(clf.AuthToken) diff --git a/lib/openssh/sshd.go b/lib/openssh/sshd.go index 4f40760e425d3..cdf5c5006ceab 100644 --- a/lib/openssh/sshd.go +++ b/lib/openssh/sshd.go @@ -284,7 +284,7 @@ func defaultRestart() error { } const activeService = "ActiveState=active" - if !bytes.Equal([]byte(activeService), out) { + if !bytes.Equal([]byte(activeService), bytes.TrimSpace(out)) { slog.DebugContext(context.Background(), "skipping inactive OpenSSH service", "service", service) continue }