简体   繁体   中英

How do I configure NPM to use the system certificate authorities in CentOS/RHEL?

How can I configure NPM to use the system certificate bundle in an Enterprise Linux based OS (CentOS/RedHat/etc)?

Additionally, how can I add a custom certificate to this store?

Configuring NPM to use System CAs

For Enterprise Linux-based systems your certificate store is located at /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem .

You can configure NPM to globally use this certificate store using:

npm config set cafile "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" -g

Adding a Root Certificate to System CA Bundle

You can install a custom root certificate using the following commands:

> sudo update-ca-trust

Copy the .crt file you want to add to /etc/pki/ca-trust/source/anchors/

ONLY if running a 6.x Enterprise Linux variant run the following command: sudo update-ca-trust enable

Finally, for all variants update the bundle: sudo update-ca-trust extract

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM