Installations
npm install gilboom-acme-client
Releases
Unable to fetch releases
Developer
publishlab
Developer Guide
Module System
CommonJS
Min. Node Version
>= 10
Typescript Support
Yes
Node Version
14.17.3
NPM Version
6.14.13
Statistics
272 Stars
306 Commits
55 Forks
17 Watching
7 Branches
8 Contributors
Updated on 01 Nov 2024
Languages
JavaScript (98.92%)
TypeScript (1.08%)
Total Downloads
Cumulative downloads
Total Downloads
762
Last day
0%
1
Compared to previous day
Last week
-72.7%
3
Compared to previous week
Last month
81%
38
Compared to previous month
Last year
125.8%
280
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
acme-client
A simple and unopinionated ACME client.
This module is written to handle communication with a Boulder/Let's Encrypt-style ACME API.
- RFC 8555 - Automatic Certificate Management Environment (ACME): https://datatracker.ietf.org/doc/html/rfc8555
- Boulder divergences from ACME: https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md
Compatibility
acme-client | Node.js | |
---|---|---|
v5.x | >= v16 | Upgrade guide |
v4.x | >= v10 | Changelog |
v3.x | >= v8 | Changelog |
v2.x | >= v4 | Changelog |
v1.x | >= v4 | Changelog |
Table of contents
Installation
1$ npm install acme-client
Usage
1const acme = require('acme-client'); 2 3const accountPrivateKey = '<PEM encoded private key>'; 4 5const client = new acme.Client({ 6 directoryUrl: acme.directory.letsencrypt.staging, 7 accountKey: accountPrivateKey, 8});
Directory URLs
1acme.directory.buypass.staging; 2acme.directory.buypass.production; 3 4acme.directory.google.staging; 5acme.directory.google.production; 6 7acme.directory.letsencrypt.staging; 8acme.directory.letsencrypt.production; 9 10acme.directory.zerossl.production;
External account binding
To enable external account binding when creating your ACME account, provide your KID and HMAC key to the client constructor.
1const client = new acme.Client({
2 directoryUrl: 'https://acme-provider.example.com/directory-url',
3 accountKey: accountPrivateKey,
4 externalAccountBinding: {
5 kid: 'YOUR-EAB-KID',
6 hmacKey: 'YOUR-EAB-HMAC-KEY',
7 },
8});
Specifying the account URL
During the ACME account creation process, the server will check the supplied account key and either create a new account if the key is unused, or return the existing ACME account bound to that key.
In some cases, for example with some EAB providers, this account creation step may be prohibited and might require you to manually specify the account URL beforehand. This can be done through accountUrl
in the client constructor.
1const client = new acme.Client({
2 directoryUrl: acme.directory.letsencrypt.staging,
3 accountKey: accountPrivateKey,
4 accountUrl: 'https://acme-v02.api.letsencrypt.org/acme/acct/12345678',
5});
You can fetch the clients current account URL, either after creating an account or supplying it through the constructor, using getAccountUrl()
:
1const myAccountUrl = client.getAccountUrl();
Cryptography
For key pairs acme-client
utilizes native Node.js cryptography APIs, supporting signing and generation of both RSA and ECDSA keys. The module @peculiar/x509 is used to generate and parse Certificate Signing Requests.
These utility methods are exposed through .crypto
.
- Documentation: docs/crypto.md
1const privateRsaKey = await acme.crypto.createPrivateRsaKey(); 2const privateEcdsaKey = await acme.crypto.createPrivateEcdsaKey(); 3 4const [certificateKey, certificateCsr] = await acme.crypto.createCsr({ 5 altNames: ['example.com', '*.example.com'], 6});
Legacy .forge
interface
The legacy node-forge
crypto interface is still available for backward compatibility, however this interface is now considered deprecated and will be removed in a future major version of acme-client
.
You should consider migrating to the new .crypto
API at your earliest convenience. More details can be found in the acme-client v5 upgrade guide.
- Documentation: docs/forge.md
Auto mode
For convenience an auto()
method is included in the client that takes a single config object. This method will handle the entire process of getting a certificate for one or multiple domains.
- Documentation: docs/client.md#AcmeClient+auto
- Full example: examples/auto.js
1const autoOpts = { 2 csr: '<PEM encoded CSR>', 3 email: 'test@example.com', 4 termsOfServiceAgreed: true, 5 challengeCreateFn: async (authz, challenge, keyAuthorization) => {}, 6 challengeRemoveFn: async (authz, challenge, keyAuthorization) => {}, 7}; 8 9const certificate = await client.auto(autoOpts);
Challenge priority
When ordering a certificate using auto mode, acme-client
uses a priority list when selecting challenges to respond to. Its default value is ['http-01', 'dns-01']
which translates to "use http-01
if any challenges exist, otherwise fall back to dns-01
".
While most challenges can be validated using the method of your choosing, please note that wildcard certificates can only be validated through dns-01
. More information regarding Let's Encrypt challenge types can be found here.
To modify challenge priority, provide a list of challenge types in challengePriority
:
1await client.auto({ 2 ..., 3 challengePriority: ['http-01', 'dns-01'], 4});
Internal challenge verification
When using auto mode, acme-client
will first validate that challenges are satisfied internally before completing the challenge at the ACME provider. In some cases (firewalls, etc) this internal challenge verification might not be possible to complete.
If internal challenge validation needs to travel through an HTTP proxy, see HTTP client defaults.
To completely disable acme-client
s internal challenge verification, enable skipChallengeVerification
:
1await client.auto({ 2 ..., 3 skipChallengeVerification: true, 4});
API
For more fine-grained control you can interact with the ACME API using the methods documented below.
- Documentation: docs/client.md
- Full example: examples/api.js
1const account = await client.createAccount({
2 termsOfServiceAgreed: true,
3 contact: ['mailto:test@example.com'],
4});
5
6const order = await client.createOrder({
7 identifiers: [
8 { type: 'dns', value: 'example.com' },
9 { type: 'dns', value: '*.example.com' },
10 ],
11});
HTTP client defaults
This module uses axios when communicating with the ACME HTTP API, and exposes the client instance through .axios
.
For example, should you need to change the default axios configuration to route requests through an HTTP proxy, this can be achieved as follows:
1const acme = require('acme-client'); 2 3acme.axios.defaults.proxy = { 4 host: '127.0.0.1', 5 port: 9000, 6};
A complete list of axios options and documentation can be found at:
- https://github.com/axios/axios#request-config
- https://github.com/axios/axios#custom-instance-defaults
Debugging
To get a better grasp of what acme-client
is doing behind the scenes, you can either pass it a logger function, or enable debugging through an environment variable.
Setting a logger function may for example be useful for passing messages on to another logging system, or just dumping them to the console.
1acme.setLogger((message) => { 2 console.log(message); 3});
Debugging to the console can also be enabled through debug by setting an environment variable.
1DEBUG=acme-client node index.js
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/tests.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/publishlab/node-acme-client/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/publishlab/node-acme-client/tests.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/tests.yml:88
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 1 are checked with a SAST tool
Score
3.8
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to gilboom-acme-client
acme-client
Simple and unopinionated ACME client
@root/acme
Free SSL certificates for Node.js and Browsers. Issued via Let's Encrypt
@maxim_mazurok/gapi.client.acmedns-v1
TypeScript typings for ACME DNS API v1
acme-dns-01-cli
A manual (interactive CLI) dns-based strategy for Greenlock / Let's Encrypt / ACME DNS-01 challenges