change log level for server

tls
dingjun 6 years ago
parent 1a4351c626
commit db1a4f8605

@ -95,9 +95,9 @@ func main() {
AuthLogCallback: func(c ssh.ConnMetadata, method string, err error) {
if err != nil {
log.Debugf("%s", err.Error())
log.Debugf("%s auth failed for %s from %s", method, c.User(), c.RemoteAddr())
log.Errorf("%s auth failed for %s from %s", method, c.User(), c.RemoteAddr())
} else {
log.Debugf("Accepted %s for user %s from %s", method, c.User(), c.RemoteAddr())
log.Printf("Accepted %s for user %s from %s", method, c.User(), c.RemoteAddr())
}
},
}
@ -141,7 +141,7 @@ func main() {
return
}
log.Debugf("accept tcp connection from %s", c.RemoteAddr())
log.Infof("accept tcp connection from %s", c.RemoteAddr())
go func(c net.Conn) {
defer c.Close()

@ -79,7 +79,7 @@ func (sc *Server) handleNewChannelRequest(ch <-chan ssh.NewChannel) {
continue
}
log.Debugf("reject channel request %s", newch.ChannelType())
log.Errorf("reject channel request %s", newch.ChannelType())
newch.Reject(ssh.UnknownChannelType, "unknown channel type")
}
@ -189,7 +189,7 @@ func (sc *Server) handleSession(newch ssh.NewChannel) {
case "exec":
ret = true
if err = ssh.Unmarshal(r.Payload, &_cmd); err == nil {
log.Debugln("execute command", _cmd.Arg)
log.Infoln("execute command", _cmd.Arg)
if runtime.GOOS == "windows" {
cmd = exec.Command("powershell", "-Command", _cmd.Arg)
} else {
@ -234,7 +234,7 @@ func handleShell(cmd *exec.Cmd, ch ssh.Channel) {
var _pty io.ReadWriteCloser
var err error
log.Debugln("start shell")
log.Infoln("start shell")
//_pty, err = pty.Start(cmd)
if runtime.GOOS == "unix" || runtime.GOOS == "linux" {
@ -321,7 +321,7 @@ func handleDirectTcpip(newch ssh.NewChannel) {
err := ssh.Unmarshal(data, &r)
if err != nil {
log.Debugf("invalid ssh parameter")
log.Errorln("invalid ssh parameter")
newch.Reject(ssh.ConnectionFailed, "invalid argument")
return
}
@ -426,7 +426,7 @@ func (sc *Server) handleTcpipForward(req *ssh.Request) {
}
a1 := l.Addr()
log.Debugf("Listening port %s", a1)
log.Infof("Listening port %s", a1)
p := struct {
Port uint32
}{
@ -445,7 +445,7 @@ func (sc *Server) handleTcpipForward(req *ssh.Request) {
log.Debugf("%s", err.Error())
return
}
log.Debugf("accept connection from %s", c.RemoteAddr())
log.Infof("accept connection from %s", c.RemoteAddr())
go func(c net.Conn) {
laddr := c.LocalAddr()
raddr := c.RemoteAddr()

Loading…
Cancel
Save