FTP: add support for client certificate authentication

This commit is contained in:
Nicola Murino
2020-12-29 09:20:09 +01:00
parent 141ca6777c
commit 40e759c983
10 changed files with 62 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
package ftpd
import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
@@ -164,6 +165,15 @@ func TestInitialization(t *testing.T) {
assert.NoError(t, err)
certMgr = oldMgr
binding = Binding{
Port: 2121,
ClientAuthType: 1,
}
server = NewServer(c, configDir, binding, 0)
cfg, err := server.GetTLSConfig()
assert.NoError(t, err)
assert.Equal(t, tls.RequireAndVerifyClientCert, cfg.ClientAuth)
}
func TestServerGetSettings(t *testing.T) {