sftpd: improve logging if filesystem creation fails
This commit is contained in:
parent
e9dd4ecdf0
commit
1cde50f050
2 changed files with 11 additions and 0 deletions
|
@ -456,6 +456,8 @@ func (c *Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.Serve
|
|||
channel: channel,
|
||||
}
|
||||
go c.handleSftpConnection(channel, &connection)
|
||||
} else {
|
||||
logger.Debug(logSender, connID, "unable to create filesystem: %v", err)
|
||||
}
|
||||
}
|
||||
case "exec":
|
||||
|
@ -469,6 +471,8 @@ func (c *Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.Serve
|
|||
channel: channel,
|
||||
}
|
||||
ok = processSSHCommand(req.Payload, &connection, c.EnabledSSHCommands)
|
||||
} else {
|
||||
logger.Debug(sshCommandLogSender, connID, "unable to create filesystem: %v", err)
|
||||
}
|
||||
}
|
||||
if req.WantReply {
|
||||
|
|
|
@ -1070,12 +1070,19 @@ func TestSFTPFsLoginWrongFingerprint(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
out, err := runSSHCommand("md5sum", sftpUser, usePubKey)
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, string(out), "d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
sftpUser.FsConfig.SFTPConfig.Fingerprints = []string{"wrong"}
|
||||
_, _, err = httpdtest.UpdateUser(sftpUser, http.StatusOK, "")
|
||||
assert.NoError(t, err)
|
||||
_, err = getSftpClient(sftpUser, usePubKey)
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = runSSHCommand("md5sum", sftpUser, usePubKey)
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = httpdtest.RemoveUser(sftpUser, http.StatusOK)
|
||||
assert.NoError(t, err)
|
||||
_, err = httpdtest.RemoveUser(localUser, http.StatusOK)
|
||||
|
|
Loading…
Reference in a new issue