Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use custom CA in README (#1229) #1236

Merged
merged 3 commits into from Oct 31, 2014

Conversation

hypesystem
Copy link
Contributor

Fixes #1229

request.get({
url: 'https://api.some-server.com/',
agentOptions: {
'ca': fs.readFileSync("ca.cert.pem")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a really minor nitpick, but mind changing 'ca' to just ca? No apostrophes needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am following the convention laid out in previous examples.

From the first SSL/TLS example:

var options = {
    url: 'https://api.some-server.com/',
    agentOptions: {
        'cert': fs.readFileSync(certFile),
        'key': fs.readFileSync(keyFile),
        // Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format:
        // 'pfx': fs.readFileSync(pfxFilePath),
        'passphrase': 'password',
        'securityOptions': 'SSL_OP_NO_SSLv3'
    }
};

This could definitely be corrected, but I don't think a change of style has anything to do with this pull request :)

@mmalecki
Copy link
Member

lgtm, besides that minor nitpick!

@nylen
Copy link
Member

nylen commented Oct 30, 2014

I'm in favor of going ahead and removing the quotes in the other example too, but that's not a big deal to me.

More importantly, what does a custom CA actually do? I think users will want to see something like this:

To make request accept other SSL certificates (for example, self-signed certificates from your company), specify the certificate authority (CA) that signed the certificate by sending the contents of the authority's certificate file as ca:

Awkward wording, definitely could be done better.

Also, does specifying a custom CA override Node's built-in CAs? I think that's worth clarifying too.

@hypesystem
Copy link
Contributor Author

I have tried to accomodate the requested changes (which are all very valid).

I dont know if the text is the best it gets, but the use case is now clearer.

It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs). This can be useful, for example, when using self-signed certificates. To allow a different certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the agentOptions:

@nylen
Copy link
Member

nylen commented Oct 31, 2014

Looks good to me, thanks @hypesystem!

nylen added a commit that referenced this pull request Oct 31, 2014
@nylen nylen merged commit bc733a0 into request:master Oct 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cover in README how to allow cas for self-signed certificates
3 participants