mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
sftpd: deprecate keys and add a new host_keys config param
host_key defines the private host keys as plain list of strings. Remove the other deprecated config params from the default config too. Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -1738,24 +1738,13 @@ func TestProxyProtocolVersion(t *testing.T) {
|
||||
|
||||
func TestLoadHostKeys(t *testing.T) {
|
||||
c := Configuration{}
|
||||
c.Keys = []Key{
|
||||
{
|
||||
PrivateKey: ".",
|
||||
},
|
||||
{
|
||||
PrivateKey: "missing file",
|
||||
},
|
||||
}
|
||||
c.HostKeys = []string{".", "missing file"}
|
||||
err := c.checkAndLoadHostKeys("..", &ssh.ServerConfig{})
|
||||
assert.Error(t, err)
|
||||
testfile := filepath.Join(os.TempDir(), "invalidkey")
|
||||
err = ioutil.WriteFile(testfile, []byte("some bytes"), 0666)
|
||||
assert.NoError(t, err)
|
||||
c.Keys = []Key{
|
||||
{
|
||||
PrivateKey: testfile,
|
||||
},
|
||||
}
|
||||
c.HostKeys = []string{testfile}
|
||||
err = c.checkAndLoadHostKeys("..", &ssh.ServerConfig{})
|
||||
assert.Error(t, err)
|
||||
err = os.Remove(testfile)
|
||||
|
||||
Reference in New Issue
Block a user