Skip to content

SFTP client cert auth #141

@codermapuche

Description

@codermapuche

Hello, i want to make a sftp server with client cert auth, current i doing:

server = new ftpd.FtpServer(config.ip, {
        getInitialCwd:        function() { return '/';          },
        getRoot:              function() { return self.current; },
        pasvPortRangeStart:   config.pasv[0],
        pasvPortRangeEnd:     config.pasv[1],
        tlsOptions:           {          
                                key: fs.readFileSync(config.key), 
                                cert: fs.readFileSync(config.cert), 
                                ca: fs.readFileSync(config.ca), 
                                requestCert: true, 
                                rejectUnauthorized: true
                              },
        allowUnauthorizedTls: true,
        useWriteFile:         false,
        useReadFile:          false,
        uploadMaxSlurpSize:   7000
      });

With the same tlsOptions i success make an https server with client cert auth, so the keys are ok and valid, but when i try to connect with the sftp server, i have this log from filezilla client:

Estado: Conectando a 192.168.1.131:7003...
Respuesta: fzSftp started, protocol_version=8
Comando: keyfile "E:\virtual\certs\client1-key.pem"
Comando: open "cef@192.168.1.131" 7003
Error: Connection timed out after 20 seconds of inactivity
Error: No se pudo conectar al servidor

Debuugin i see that client send the command:

SSH-2.0-FileZilla_3.30.0

and here stop the connection, with winscp the command is

SSH-2.0-WinSCP_release_5.13.2

after some time of this command, the server show this error:

Client connection error: { Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

i not have idea how to fix it, can help me please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions