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:
Nicola Murino
2020-05-16 23:26:44 +02:00
parent 469d36d979
commit a08dd85efd
7 changed files with 70 additions and 37 deletions

View File

@@ -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)