我正在使用节点模块basic-ftp尝试通过TLS/ SSL建立安全连接。服务器使用通配符 CA 签名证书作为主机名。我似乎无法找到 followig 错误代码的答案。
Connected to 1.1.1.1:21
< 220 Welcome to ftp.foo.com
> AUTH TLS
< 234 Using authentication type TLS
{ Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34)
at TLSSocket.emit (events.js:189:13)
at TLSSocket._finishInit (_tls_wrap.js:633:8) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
Run Code Online (Sandbox Code Playgroud)
您可以在下面找到示例代码:
const ftp = require("basic-ftp");
async establishFtpsConnection() {
const client = new ftp.Client();
client.ftp.verbose = true;
try {
await client.access({
host: "ftp.foo.com",
user: "bar",
password: "1234",
port: 21,
secure: true
});
const list …Run Code Online (Sandbox Code Playgroud)