root certificate update for ssl

Asked 1 years ago, Updated 1 years ago, 61 views

I am sending a request to an api of https (language is node and I use request module)
I received a request from the server operator to add the root certificate because I updated the SSL server certificate.

Here are two questions.

1) In the first place, we are not currently working to add a root certificate.However, the request is now successful.Why is that?
node.js has a default list of built-in ca, so is it used??

https://stackoverflow.com/questions/20658120/nodejs-unable-to-read-default-cas-in-ubuntu
https://github.com/nodejs/node/blob/v4.2.0/src/node_root_certs.h

2) How do I write ca in the request module?
The readme of the request module seems to be able to specify a certificate by doing the following, but how do I specify multiple certificates (current and upcoming certificates)?

https://github.com/request/request#using-optionsagentoptions

 request.get({
    url: 'https://api.some-server.com/',
    agentOptions: {
        ca:fs.readFileSync('ca.cert.pem')
    }
});

Please let me know either of the above two points.
Thank you for your cooperation.

node.js ssl https

2022-09-30 18:29

1 Answers

You asked me to add a root certificate because I updated the SSL server certificate, which means that you need to add a root certificate is what we call an Ore certificate.If you are a regular operator, you will not be able to use the Ore certificate, which is a security problem and requires a lot of effort.I think you should check your request again and contact the operator if you still say you need to add a root certificate. If it's a fake email, I don't know what's in it.

1) Node.js seems to use the built-in list of ca, as you can see in the question.There is no doubt that HTTPS is based on the root certificate of the trusted certificate authority (the list of built-in ca) to check reliability.

2) I think the easiest way is to set the PATH for the root certificate in the environment variable NODE_EXTRA_CA_CERTS.(Reference: English Questions How to add custom certificate authority (CA) to nodejs)

exportNODE_EXTRA_CA_CERTS=file

Also, if you want to specify ca for the request module, it would be nice if there was a way to specify more than one, but if not, you should write ca for the error handling of the current request module.


2022-09-30 18:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.