相关疑难解决方法(0)

错误:无法验证nodejs中的第一个证书

我正在尝试使用url从jira服务器下载文件,但是我收到了一个错误.如何在代码中包含证书以验证 错误:

Error: unable to verify the first certificate in nodejs

at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:929:36)

  at TLSSocket.emit (events.js:104:17)

at TLSSocket._finishInit (_tls_wrap.js:460:8)
Run Code Online (Sandbox Code Playgroud)

我的Nodejs代码:

var https = require("https");
var fs = require('fs');
var options = {
    host: 'jira.example.com',
    path: '/secure/attachment/206906/update.xlsx'
};

https.get(options, function (http_res) {

    var data = "";


    http_res.on("data", function (chunk) {

        data += chunk;
    });


    http_res.on("end", function () {

        var file = fs.createWriteStream("file.xlsx");
        data.pipe(file);

    });
});
Run Code Online (Sandbox Code Playgroud)

jira ssl-certificate node.js

105
推荐指数
9
解决办法
18万
查看次数

NodeJS UNABLE_TO_VERIFY_LEAF_SIGNATURE

我们尝试使用Node.js(和Mocha)作为测试框架,通过https测试针对内部服务器的API调用.我们使用以下节点模块:Mocha,Restify和Should来执行这些测试.

当我们运行mocha testFileName.js时,我们得到的主要错误是:

[2013-06-19 14:16:28.105] [ERROR] console - FAIL:  Received error!  [Error:        UNABLE_TO_VERIFY_LEAF_SIGNATURE]
Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
at SecurePair.<anonymous> (tls.js:1283:32)
at SecurePair.EventEmitter.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:896:10)
at CleartextStream.read [as _read] (tls.js:430:15)
at CleartextStream.Readable.read (_stream_readable.js:320:10)
at EncryptedStream.write [as _write] (tls.js:344:25)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at EncryptedStream.Writable.write (_stream_writable.js:180:11)
at write (_stream_readable.js:573:24)
at flow (_stream_readable.js:582:7)
at Socket.pipeOnReadable (_stream_readable.js:614:5)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:511:21)
Run Code Online (Sandbox Code Playgroud)

搜索谷歌和stackexchange后,似乎我们有证书问题.从那里我们安装了内部CA'公共'证书,以及我们的应用正在使用的实例特定认证(有多个重定向要通过),到

  /usr/local/etc/openssl/certs, legacy: /System/Library/Keychains/X509Anchors, /Library/Keychains/System.keychain, as well …
Run Code Online (Sandbox Code Playgroud)

ssl node.js

18
推荐指数
3
解决办法
5万
查看次数

使用SSL UNABLE_TO_VERIFY_LEAF_SIGNATURE的Node.js错误

系统:Windows 7

NodeJS版本:0.10.2

WS模块:ws,最后一个版本

错误:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
    at SecurePair. (tls.js:1283:32)
    at SecurePair.EventEmitter.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:896:10)
    at CleartextStream.read [as _read] (tls.js:430:15)
    at CleartextStream.Readable.read (_stream_readable.js:294:10)
    at EncryptedStream.write [as _write] (tls.js:344:25)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)
    at EncryptedStream.Writable.write (_stream_writable.js:172:11)
    at write (_stream_readable.js:547:24)

服务器:

(function(){

    "use strict";

    var fs = require('fs');

    // you'll probably load configuration from config
    var cfg = {
        ssl: true,
        port: 8080,
        ssl_key: 'crt/server1.key',
        ssl_cert: 'crt/server1.crt'
    };

    var httpServ = …
Run Code Online (Sandbox Code Playgroud)

javascript windows ssl openssl node.js

14
推荐指数
3
解决办法
2万
查看次数

Node.js HTTPS 400错误 - 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'

我正在编写一个Node.js应用程序,它必须从我们的一个内部API请求一些数据.棘手的部分是我请求数据的服务器有一些限制:

  • 请求必须在HTTPS协议(不是HTTP)上进行
  • 必须使用LAN IP地址进行请求,因为域名在内部不起作用
  • 该请求必须看起来是从外部域名请求,因为这是为虚拟主机设置的.

为了做到这一点,我运行了一些看起来像这样的代码:

var headers = {
    Host: externalHostname,
    Hostname: externalHostname,
};

var options = {
    host: InternalIP,
    path: path,
    method: 'GET',
    headers: headers
};

var req = https.request(options, function(res) {
    res.setEncoding('utf8');

    var data = "";

    res.on('data', function(chunk) {
        data += chunk;
    });

    res.on('end', function() {
        //Do something with that data
    });

    res.on('error', function(err) {
            console.log("Error during HTTP request");
            console.log(err);
    });
});

req.end();
Run Code Online (Sandbox Code Playgroud)

不幸的是,我得到一个400(你的浏览器发送了一个请求,这个服务器无法理解)错误作为响应.我已经检查过主机名,IP地址和路径名都是正确的(我可以在我的浏览器中测试它们,并且一切都很好).

我做了我的响应变量(res)的输出,并且我收到的authorizationError值为UNABLE_TO_VERIFY_LEAF_SIGNATURE.我不确定那是什么,或者这是我的问题,但它是我能找到的唯一有用的信息.

在这里输出了我的响应变量的完整输出.

关于可能导致这种情况的任何想法?

更新:我想通了!我试图通过传递?PHPSESSID=asdad GET变量来验证服务器,但是他们已经禁用了.我能够通过设置PHPSESSID …

ssl https node.js

9
推荐指数
2
解决办法
1万
查看次数

无法验证第一个证书 - Nodejs TLS

我正在使用节点模块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)

ssl ftps node.js tls1.2

6
推荐指数
1
解决办法
2120
查看次数

节点Js:错误 - 安装Express Framework时无法验证叶签名

我需要为我的应用程序安装Express Framework.
这是我得到的错误.我尝试将我的计算机的环境varaibales设置为npm,http:// username:password @ proxy:port for http和https.

另外,我已经尝试过诸如此类的代码

npm config set proxy http://username:password@proxy:port -g
npm config set https-proxy http://username:password@proxy:port -g
npm config set strict-ssl false.
Run Code Online (Sandbox Code Playgroud)

即便如此,我收到以下错误.

 npm ERR! node v0.12.7
    npm ERR! npm  v2.11.3
    npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE

    npm ERR! unable to verify the first certificate
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR!     <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
Run Code Online (Sandbox Code Playgroud)

有关安装Express Framework的任何帮助将不胜感激.

node.js express

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

node.js ×6

ssl ×4

express ×1

ftps ×1

https ×1

javascript ×1

jira ×1

openssl ×1

ssl-certificate ×1

tls1.2 ×1

windows ×1