🔱: [acme] sync upgrade with 10 commits [trident-sync]

Bump v5.1.0
Bump dep axios@1.6.5
Bump dep jsrsasign@11.0.0
Bump dev deps, typo in editorconfig
Replace uuid devdep with crypto.randomUUID
LICENSE, docs formatting, remove upgrade notice
Fix package.json typo
Replace deprecated dtslint with tsd, bump types
Add Node v20 to matrix, bump misc CI stuff
pull/29/head
GitHub Actions Bot 2024-01-20 19:24:14 +00:00
parent f64ea78c44
commit d22a25d260
17 changed files with 52 additions and 118 deletions

View File

@ -91,7 +91,7 @@ commands:
name: Install CoreDNS name: Install CoreDNS
command: sudo -E /bin/bash ./scripts/test-suite-install-coredns.sh command: sudo -E /bin/bash ./scripts/test-suite-install-coredns.sh
environment: environment:
COREDNS_VERSION: 1.8.6 COREDNS_VERSION: 1.11.1
PEBBLECTS_DNS_PORT: 8053 PEBBLECTS_DNS_PORT: 8053
- run: - run:
@ -117,10 +117,12 @@ commands:
ACME_HTTPS_PORT: 5003 ACME_HTTPS_PORT: 5003
jobs: jobs:
v16: { docker: [{ image: cimg/node:16.16 }], steps: [ pre, install-cts, install-pebble, install-coredns, test ]} v16: { docker: [{ image: cimg/node:16.20 }], steps: [ pre, install-cts, install-pebble, install-coredns, test ]}
v18: { docker: [{ image: cimg/node:18.4 }], steps: [ pre, install-cts, install-pebble, install-coredns, test ]} v18: { docker: [{ image: cimg/node:18.19 }], steps: [ pre, install-cts, install-pebble, install-coredns, test ]}
eab-v16: { docker: [{ image: cimg/node:16.16 }], steps: [ pre, enable-eab, install-cts, install-pebble, install-coredns, test ]} v20: { docker: [{ image: cimg/node:20.11 }], steps: [ pre, install-cts, install-pebble, install-coredns, test ]}
eab-v18: { docker: [{ image: cimg/node:18.4 }], steps: [ pre, enable-eab, install-cts, install-pebble, install-coredns, test ]} eab-v16: { docker: [{ image: cimg/node:16.20 }], steps: [ pre, enable-eab, install-cts, install-pebble, install-coredns, test ]}
eab-v18: { docker: [{ image: cimg/node:18.19 }], steps: [ pre, enable-eab, install-cts, install-pebble, install-coredns, test ]}
eab-v20: { docker: [{ image: cimg/node:20.11 }], steps: [ pre, enable-eab, install-cts, install-pebble, install-coredns, test ]}
# step-v12: { docker: [{ image: cimg/node:12.22 }], steps: [ pre, install-cts, install-step, install-coredns, test ]} # step-v12: { docker: [{ image: cimg/node:12.22 }], steps: [ pre, install-cts, install-step, install-coredns, test ]}
workflows: workflows:
@ -128,6 +130,8 @@ workflows:
jobs: jobs:
- v16 - v16
- v18 - v18
- v20
- eab-v16 - eab-v16
- eab-v18 - eab-v18
- eab-v20
# - step-v12 # - step-v12

View File

@ -5,7 +5,7 @@
root = true root = true
[*] [*]
indent_style = spaces indent_style = space
indent_size = 4 indent_size = 4
trim_trailing_whitespace = true trim_trailing_whitespace = true

View File

@ -1,11 +1,9 @@
# Changelog # Changelog
## Important upgrade notice ## v5.1.0 (2024-01-20)
On September 15, 2022, Let's Encrypt will stop accepting Certificate Signing Requests signed using the obsolete SHA-1 hash. This change affects all `acme-client` versions lower than `3.3.2` and `4.2.4`. Please upgrade ASAP to ensure that your certificates can still be issued following this date.
A more detailed explanation can be found [at the Let's Encrypt forums](https://community.letsencrypt.org/t/rejecting-sha-1-csrs-and-validation-using-tls-1-0-1-1-urls/175144).
* `fixed` Upgrade `jsrsasign@11.0.0` - [GHSA-rh63-9qcf-83gf](https://github.com/kjur/jsrsasign/security/advisories/GHSA-rh63-9qcf-83gf)
* `fixed` Upgrade `axios@1.6.5` - [CVE-2023-45857](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2023-45857)
## v5.0.0 (2022-07-28) ## v5.0.0 (2022-07-28)
@ -16,39 +14,32 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `changed` Replace `bluebird` dependency with native promise APIs * `changed` Replace `bluebird` dependency with native promise APIs
* `changed` Replace `backo2` dependency with internal utility * `changed` Replace `backo2` dependency with internal utility
## v4.2.5 (2022-03-21) ## v4.2.5 (2022-03-21)
* `fixed` Upgrade `axios@0.26.1` * `fixed` Upgrade `axios@0.26.1`
* `fixed` Upgrade `node-forge@1.3.0` - [CVE-2022-24771](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24771), [CVE-2022-24772](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24772), [CVE-2022-24773](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24773) * `fixed` Upgrade `node-forge@1.3.0` - [CVE-2022-24771](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24771), [CVE-2022-24772](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24772), [CVE-2022-24773](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24773)
## 4.2.4 (2022-03-19) ## 4.2.4 (2022-03-19)
* `fixed` Use SHA-256 when signing CSRs * `fixed` Use SHA-256 when signing CSRs
## v3.3.2 (2022-03-19) ## v3.3.2 (2022-03-19)
* `backport` Use SHA-256 when signing CSRs * `backport` Use SHA-256 when signing CSRs
## v4.2.3 (2022-01-11) ## v4.2.3 (2022-01-11)
* `added` Directory URLs for ACME providers [Buypass](https://www.buypass.com) and [ZeroSSL](https://zerossl.com) * `added` Directory URLs for ACME providers [Buypass](https://www.buypass.com) and [ZeroSSL](https://zerossl.com)
* `fixed` Skip already valid authorizations when using `client.auto()` * `fixed` Skip already valid authorizations when using `client.auto()`
## v4.2.2 (2022-01-10) ## v4.2.2 (2022-01-10)
* `fixed` Upgrade `node-forge@1.2.0` * `fixed` Upgrade `node-forge@1.2.0`
## v4.2.1 (2022-01-10) ## v4.2.1 (2022-01-10)
* `fixed` ZeroSSL `duplicate_domains_in_array` error when using `client.auto()` * `fixed` ZeroSSL `duplicate_domains_in_array` error when using `client.auto()`
## v4.2.0 (2022-01-06) ## v4.2.0 (2022-01-06)
* `added` Support for external account binding - [RFC 8555 Section 7.3.4](https://tools.ietf.org/html/rfc8555#section-7.3.4) * `added` Support for external account binding - [RFC 8555 Section 7.3.4](https://tools.ietf.org/html/rfc8555#section-7.3.4)
@ -59,27 +50,22 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `fixed` Error verbosity when failing to read ACME directory * `fixed` Error verbosity when failing to read ACME directory
* `fixed` Correctly recognize `ready` and `processing` states - [RFC 8555 Section 7.1.6](https://tools.ietf.org/html/rfc8555#section-7.1.6) * `fixed` Correctly recognize `ready` and `processing` states - [RFC 8555 Section 7.1.6](https://tools.ietf.org/html/rfc8555#section-7.1.6)
## v4.1.4 (2021-12-23) ## v4.1.4 (2021-12-23)
* `fixed` Upgrade `axios@0.21.4` - [CVE-2021-3749](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3749) * `fixed` Upgrade `axios@0.21.4` - [CVE-2021-3749](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3749)
## v4.1.3 (2021-02-22) ## v4.1.3 (2021-02-22)
* `fixed` Upgrade `axios@0.21.1` - [CVE-2020-28168](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28168) * `fixed` Upgrade `axios@0.21.1` - [CVE-2020-28168](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28168)
## v4.1.2 (2020-11-16) ## v4.1.2 (2020-11-16)
* `fixed` Bug when encoding PEM payloads, potentially causing malformed requests * `fixed` Bug when encoding PEM payloads, potentially causing malformed requests
## v4.1.1 (2020-11-13) ## v4.1.1 (2020-11-13)
* `fixed` Missing TypeScript definitions * `fixed` Missing TypeScript definitions
## v4.1.0 (2020-11-12) ## v4.1.0 (2020-11-12)
* `added` Option `preferredChain` added to `client.getCertificate()` and `client.auto()` to indicate which certificate chain is preferred if a CA offers multiple * `added` Option `preferredChain` added to `client.getCertificate()` and `client.auto()` to indicate which certificate chain is preferred if a CA offers multiple
@ -90,17 +76,14 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `fixed` Missing URL augmentation in `client.finalizeOrder()` and `client.deactivateAuthorization()` * `fixed` Missing URL augmentation in `client.finalizeOrder()` and `client.deactivateAuthorization()`
* `fixed` Add certificate issuer to response from `forge.readCertificateInfo()` * `fixed` Add certificate issuer to response from `forge.readCertificateInfo()`
## v4.0.2 (2020-10-09) ## v4.0.2 (2020-10-09)
* `fixed` Explicitly set default `axios` HTTP adapter - [axios/axios#1180](https://github.com/axios/axios/issues/1180) * `fixed` Explicitly set default `axios` HTTP adapter - [axios/axios#1180](https://github.com/axios/axios/issues/1180)
## v4.0.1 (2020-09-15) ## v4.0.1 (2020-09-15)
* `fixed` Upgrade `node-forge@0.10.0` - [CVE-2020-7720](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7720) * `fixed` Upgrade `node-forge@0.10.0` - [CVE-2020-7720](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7720)
## v4.0.0 (2020-05-29) ## v4.0.0 (2020-05-29)
* `breaking` Remove support for Node v8 * `breaking` Remove support for Node v8
@ -108,23 +91,19 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `fixed` Incorrect TypeScript `CertificateInfo` definitions * `fixed` Incorrect TypeScript `CertificateInfo` definitions
* `fixed` Allow trailing whitespace character in `http-01` challenge response * `fixed` Allow trailing whitespace character in `http-01` challenge response
## v3.3.1 (2020-01-07) ## v3.3.1 (2020-01-07)
* `fixed` Improvements to TypeScript definitions * `fixed` Improvements to TypeScript definitions
## v3.3.0 (2019-12-19) ## v3.3.0 (2019-12-19)
* `added` TypeScript definitions * `added` TypeScript definitions
* `fixed` Allow missing ACME directory meta field - [RFC 8555 Section 7.1.1](https://tools.ietf.org/html/rfc8555#section-7.1.1) * `fixed` Allow missing ACME directory meta field - [RFC 8555 Section 7.1.1](https://tools.ietf.org/html/rfc8555#section-7.1.1)
## v3.2.1 (2019-11-14) ## v3.2.1 (2019-11-14)
* `added` New option `skipChallengeVerification` added to `client.auto()` to bypass internal challenge verification * `added` New option `skipChallengeVerification` added to `client.auto()` to bypass internal challenge verification
## v3.2.0 (2019-08-26) ## v3.2.0 (2019-08-26)
* `added` More extensive testing using [letsencrypt/pebble](https://github.com/letsencrypt/pebble) * `added` More extensive testing using [letsencrypt/pebble](https://github.com/letsencrypt/pebble)
@ -135,64 +114,53 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `fixed` Ensure subject common name is present in SAN when creating a CSR - [CAB v1.2.3 Section 9.2.2](https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf) * `fixed` Ensure subject common name is present in SAN when creating a CSR - [CAB v1.2.3 Section 9.2.2](https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf)
* `fixed` Send empty JSON body when responding to challenges - [RFC 8555 Section 7.5.1](https://tools.ietf.org/html/rfc8555#section-7.5.1) * `fixed` Send empty JSON body when responding to challenges - [RFC 8555 Section 7.5.1](https://tools.ietf.org/html/rfc8555#section-7.5.1)
## v2.3.1 (2019-08-26) ## v2.3.1 (2019-08-26)
* `backport` Minor bugs related to `POST-as-GET` when calling `client.updateAccount()` * `backport` Minor bugs related to `POST-as-GET` when calling `client.updateAccount()`
* `backport` Send empty JSON body when responding to challenges * `backport` Send empty JSON body when responding to challenges
## v3.1.0 (2019-08-21) ## v3.1.0 (2019-08-21)
* `added` UTF-8 support when generating a CSR subject using forge - [RFC 5280](https://tools.ietf.org/html/rfc5280) * `added` UTF-8 support when generating a CSR subject using forge - [RFC 5280](https://tools.ietf.org/html/rfc5280)
* `fixed` Implement `POST-as-GET` for all ACME API requests - [RFC 8555 Section 6.3](https://tools.ietf.org/html/rfc8555#section-6.3) * `fixed` Implement `POST-as-GET` for all ACME API requests - [RFC 8555 Section 6.3](https://tools.ietf.org/html/rfc8555#section-6.3)
## v2.3.0 (2019-08-21) ## v2.3.0 (2019-08-21)
* `backport` Implement `POST-as-GET` for all ACME API requests * `backport` Implement `POST-as-GET` for all ACME API requests
## v3.0.0 (2019-07-13) ## v3.0.0 (2019-07-13)
* `added` Expose `axios` instance to allow manipulating HTTP client defaults * `added` Expose `axios` instance to allow manipulating HTTP client defaults
* `breaking` Remove support for Node v4 and v6 * `breaking` Remove support for Node v4 and v6
* `breaking` Remove Babel transpilation * `breaking` Remove Babel transpilation
## v2.2.3 (2019-01-25) ## v2.2.3 (2019-01-25)
* `added` DNS CNAME detection when verifying `dns-01` challenges * `added` DNS CNAME detection when verifying `dns-01` challenges
## v2.2.2 (2019-01-07) ## v2.2.2 (2019-01-07)
* `added` Support for `tls-alpn-01` challenge key authorization * `added` Support for `tls-alpn-01` challenge key authorization
## v2.2.1 (2019-01-04) ## v2.2.1 (2019-01-04)
* `fixed` Handle and throw errors from OpenSSL process * `fixed` Handle and throw errors from OpenSSL process
## v2.2.0 (2018-11-06) ## v2.2.0 (2018-11-06)
* `added` New [node-forge](https://www.npmjs.com/package/node-forge) crypto interface, removes OpenSSL CLI dependency * `added` New [node-forge](https://www.npmjs.com/package/node-forge) crypto interface, removes OpenSSL CLI dependency
* `added` Support native `crypto.generateKeyPair()` API when generating key pairs * `added` Support native `crypto.generateKeyPair()` API when generating key pairs
## v2.1.0 (2018-10-21) ## v2.1.0 (2018-10-21)
* `added` Ability to set and get current account URL * `added` Ability to set and get current account URL
* `fixed` Replace HTTP client `request` with `axios` * `fixed` Replace HTTP client `request` with `axios`
* `fixed` Auto-mode no longer tries to create account when account URL exists * `fixed` Auto-mode no longer tries to create account when account URL exists
## v2.0.1 (2018-08-17) ## v2.0.1 (2018-08-17)
* `fixed` Key rollover in compliance with [draft-ietf-acme-13](https://tools.ietf.org/html/draft-ietf-acme-acme-13) * `fixed` Key rollover in compliance with [draft-ietf-acme-13](https://tools.ietf.org/html/draft-ietf-acme-acme-13)
## v2.0.0 (2018-04-02) ## v2.0.0 (2018-04-02)
* `breaking` ACMEv2 * `breaking` ACMEv2
@ -200,23 +168,19 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* `breaking` Rewrite to ES6 * `breaking` Rewrite to ES6
* `breaking` Promises instead of callbacks * `breaking` Promises instead of callbacks
## v1.0.0 (2017-10-20) ## v1.0.0 (2017-10-20)
* API stable * API stable
## v0.2.1 (2017-09-27) ## v0.2.1 (2017-09-27)
* `fixed` Bug causing invalid anti-replay nonce * `fixed` Bug causing invalid anti-replay nonce
## v0.2.0 (2017-09-21) ## v0.2.0 (2017-09-21)
* `breaking` OpenSSL method `readCsrDomains` and `readCertificateInfo` now return domains as an object * `breaking` OpenSSL method `readCsrDomains` and `readCertificateInfo` now return domains as an object
* `fixed` Added and fixed some tests * `fixed` Added and fixed some tests
## v0.1.0 (2017-09-14) ## v0.1.0 (2017-09-14)
* `acme-client` released * `acme-client` released

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2017-2022 Publish Lab Copyright (c) 2017-2024 Labrador CMS AS
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -7,15 +7,7 @@ This module is written to handle communication with a Boulder/Let's Encrypt-styl
* RFC 8555 - Automatic Certificate Management Environment (ACME): [https://tools.ietf.org/html/rfc8555](https://tools.ietf.org/html/rfc8555) * RFC 8555 - Automatic Certificate Management Environment (ACME): [https://tools.ietf.org/html/rfc8555](https://tools.ietf.org/html/rfc8555)
* Boulder divergences from ACME: [https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md](https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md) * Boulder divergences from ACME: [https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md](https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md)
## Compatibility
## Important upgrade notice
On September 15, 2022, Let's Encrypt will stop accepting Certificate Signing Requests signed using the obsolete SHA-1 hash. This change affects all `acme-client` versions lower than `3.3.2` and `4.2.4`. Please upgrade ASAP to ensure that your certificates can still be issued following this date.
A more detailed explanation can be found [at the Let's Encrypt forums](https://community.letsencrypt.org/t/rejecting-sha-1-csrs-and-validation-using-tls-1-0-1-1-urls/175144).
### Compatibility
| acme-client | Node.js | | | acme-client | Node.js | |
| ------------- | --------- | ----------------------------------------- | | ------------- | --------- | ----------------------------------------- |
@ -25,8 +17,7 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
| v2.x | >= v4 | [Changelog](CHANGELOG.md#v200-2018-04-02) | | v2.x | >= v4 | [Changelog](CHANGELOG.md#v200-2018-04-02) |
| v1.x | >= v4 | [Changelog](CHANGELOG.md#v100-2017-10-20) | | v1.x | >= v4 | [Changelog](CHANGELOG.md#v100-2017-10-20) |
## Table of contents
### Table of contents
* [Installation](#installation) * [Installation](#installation)
* [Usage](#usage) * [Usage](#usage)
@ -43,14 +34,12 @@ A more detailed explanation can be found [at the Let's Encrypt forums](https://c
* [Debugging](#debugging) * [Debugging](#debugging)
* [License](#license) * [License](#license)
## Installation ## Installation
```bash ```bash
$ npm install acme-client $ npm install acme-client
``` ```
## Usage ## Usage
```js ```js
@ -64,7 +53,6 @@ const client = new acme.Client({
}); });
``` ```
### Directory URLs ### Directory URLs
```js ```js
@ -77,7 +65,6 @@ acme.directory.letsencrypt.production;
acme.directory.zerossl.production; acme.directory.zerossl.production;
``` ```
### External account binding ### External account binding
To enable [external account binding](https://tools.ietf.org/html/rfc8555#section-7.3.4) when creating your ACME account, provide your KID and HMAC key to the client constructor. To enable [external account binding](https://tools.ietf.org/html/rfc8555#section-7.3.4) when creating your ACME account, provide your KID and HMAC key to the client constructor.
@ -93,7 +80,6 @@ const client = new acme.Client({
}); });
``` ```
### Specifying the account URL ### 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. 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.
@ -114,14 +100,13 @@ You can fetch the clients current account URL, either after creating an account
const myAccountUrl = client.getAccountUrl(); const myAccountUrl = client.getAccountUrl();
``` ```
## Cryptography ## Cryptography
For key pairs `acme-client` utilizes native Node.js cryptography APIs, supporting signing and generation of both RSA and ECDSA keys. The module [jsrsasign](https://www.npmjs.com/package/jsrsasign) is used to generate and parse Certificate Signing Requests. For key pairs `acme-client` utilizes native Node.js cryptography APIs, supporting signing and generation of both RSA and ECDSA keys. The module [jsrsasign](https://www.npmjs.com/package/jsrsasign) is used to generate and parse Certificate Signing Requests.
These utility methods are exposed through `.crypto`. These utility methods are exposed through `.crypto`.
* __Documentation: [docs/crypto.md](docs/crypto.md)__ * **Documentation: [docs/crypto.md](docs/crypto.md)**
```js ```js
const privateRsaKey = await acme.crypto.createPrivateRsaKey(); const privateRsaKey = await acme.crypto.createPrivateRsaKey();
@ -133,22 +118,20 @@ const [certificateKey, certificateCsr] = await acme.crypto.createCsr({
}); });
``` ```
### Legacy `.forge` interface ### 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`. 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](docs/upgrade-v5.md). 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](docs/upgrade-v5.md).
* __Documentation: [docs/forge.md](docs/forge.md)__ * **Documentation: [docs/forge.md](docs/forge.md)**
## Auto mode ## 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. 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](docs/client.md#AcmeClient+auto)__ * **Documentation: [docs/client.md#AcmeClient+auto](docs/client.md#AcmeClient+auto)**
* __Full example: [examples/auto.js](examples/auto.js)__ * **Full example: [examples/auto.js](examples/auto.js)**
```js ```js
const autoOpts = { const autoOpts = {
@ -162,12 +145,11 @@ const autoOpts = {
const certificate = await client.auto(autoOpts); const certificate = await client.auto(autoOpts);
``` ```
### Challenge priority ### 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`". 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](https://letsencrypt.org/docs/challenge-types/). 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](https://letsencrypt.org/docs/challenge-types/).
To modify challenge priority, provide a list of challenge types in `challengePriority`: To modify challenge priority, provide a list of challenge types in `challengePriority`:
@ -178,7 +160,6 @@ await client.auto({
}); });
``` ```
### Internal challenge verification ### 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. 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.
@ -194,13 +175,12 @@ await client.auto({
}); });
``` ```
## API ## API
For more fine-grained control you can interact with the ACME API using the methods documented below. For more fine-grained control you can interact with the ACME API using the methods documented below.
* __Documentation: [docs/client.md](docs/client.md)__ * **Documentation: [docs/client.md](docs/client.md)**
* __Full example: [examples/api.js](examples/api.js)__ * **Full example: [examples/api.js](examples/api.js)**
```js ```js
const account = await client.createAccount({ const account = await client.createAccount({
@ -216,7 +196,6 @@ const order = await client.createOrder({
}); });
``` ```
## HTTP client defaults ## HTTP client defaults
This module uses [axios](https://github.com/axios/axios) when communicating with the ACME HTTP API, and exposes the client instance through `.axios`. This module uses [axios](https://github.com/axios/axios) when communicating with the ACME HTTP API, and exposes the client instance through `.axios`.
@ -237,7 +216,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#request-config) * [https://github.com/axios/axios#request-config](https://github.com/axios/axios#request-config)
* [https://github.com/axios/axios#custom-instance-defaults](https://github.com/axios/axios#custom-instance-defaults) * [https://github.com/axios/axios#custom-instance-defaults](https://github.com/axios/axios#custom-instance-defaults)
## Debugging ## 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. 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.
@ -256,7 +234,6 @@ Debugging to the console can also be enabled through [debug](https://www.npmjs.c
DEBUG=acme-client node index.js DEBUG=acme-client node index.js
``` ```
## License ## License
[MIT](LICENSE) [MIT](LICENSE)

View File

@ -4,7 +4,6 @@ This document outlines the breaking changes introduced in v5 of `acme-client`, w
First off this release drops support for Node LTS v10, v12 and v14, and the reason for that is a new native crypto interface - more on that below. Since Node v14 is still currently in maintenance mode, `acme-client` v4 will continue to receive security updates and bugfixes until (at least) Node v14 reaches its end-of-line. First off this release drops support for Node LTS v10, v12 and v14, and the reason for that is a new native crypto interface - more on that below. Since Node v14 is still currently in maintenance mode, `acme-client` v4 will continue to receive security updates and bugfixes until (at least) Node v14 reaches its end-of-line.
## New native crypto interface ## New native crypto interface
A new crypto interface has been introduced with v5, which you can find under `acme.crypto`. It uses native Node.js cryptography APIs to generate private keys, JSON Web Keys and signatures, and finally enables support for ECC/ECDSA (P-256, P384 and P521), both for account private keys and certificates. The [jsrsasign](https://www.npmjs.com/package/jsrsasign) module is used to handle generation and parsing of Certificate Signing Requests. A new crypto interface has been introduced with v5, which you can find under `acme.crypto`. It uses native Node.js cryptography APIs to generate private keys, JSON Web Keys and signatures, and finally enables support for ECC/ECDSA (P-256, P384 and P521), both for account private keys and certificates. The [jsrsasign](https://www.npmjs.com/package/jsrsasign) module is used to handle generation and parsing of Certificate Signing Requests.
@ -17,9 +16,9 @@ Below you will find a table summarizing the current `acme.forge` methods, and th
*Note: The now deprecated `acme.forge` interface is still available for use in v5, and will not be removed until a future major version, most likely v6. Should you not wish to change to the new interface right away, the following breaking changes will not immediately affect you.* *Note: The now deprecated `acme.forge` interface is still available for use in v5, and will not be removed until a future major version, most likely v6. Should you not wish to change to the new interface right away, the following breaking changes will not immediately affect you.*
- :green_circle: = API functionality unchanged between `acme.forge` and `acme.crypto` * :green_circle: = API functionality unchanged between `acme.forge` and `acme.crypto`
- :orange_circle: = Slight API changes, like depromising or renaming, action may be required * :orange_circle: = Slight API changes, like depromising or renaming, action may be required
- :red_circle: = Breaking API changes or removal, action required if using these methods * :red_circle: = Breaking API changes or removal, action required if using these methods
| Deprecated `.forge` API | New `.crypto` API | State | | Deprecated `.forge` API | New `.crypto` API | State |
| ----------------------------- | ----------------------------- | --------------------- | | ----------------------------- | ----------------------------- | --------------------- |
@ -33,7 +32,6 @@ Below you will find a table summarizing the current `acme.forge` methods, and th
| `await readCertificateInfo()` | `readCertificateInfo()` | :orange_circle: (4) | | `await readCertificateInfo()` | `readCertificateInfo()` | :orange_circle: (4) |
| `await createCsr()` | `await createCsr()` | :green_circle: | | `await createCsr()` | `await createCsr()` | :green_circle: |
### 1. `createPublicKey` renamed and depromised ### 1. `createPublicKey` renamed and depromised
* The method `createPublicKey()` has been renamed to `getPublicKey()` * The method `createPublicKey()` has been renamed to `getPublicKey()`
@ -49,7 +47,6 @@ const publicKey = await acme.forge.createPublicKey(privateKey);
const publicKey = acme.crypto.getPublicKey(privateKey); const publicKey = acme.crypto.getPublicKey(privateKey);
``` ```
### 2. `getPemBody` renamed, now returns Base64URL ### 2. `getPemBody` renamed, now returns Base64URL
* Method `getPemBody()` has been renamed to `getPemBodyAsB64u()` * Method `getPemBody()` has been renamed to `getPemBodyAsB64u()`
@ -64,7 +61,6 @@ const body = acme.forge.getPemBody(pem);
const body = acme.crypto.getPemBodyAsB64u(pem); const body = acme.crypto.getPemBodyAsB64u(pem);
``` ```
### 3. `getModulus` and `getPublicExponent` merged into `getJwk` ### 3. `getModulus` and `getPublicExponent` merged into `getJwk`
* Methods `getModulus()` and `getPublicExponent()` have been removed * Methods `getModulus()` and `getPublicExponent()` have been removed
@ -80,7 +76,6 @@ const exp = await acme.forge.getPublicExponent(key);
const { e, n } = acme.crypto.getJwk(key); const { e, n } = acme.crypto.getJwk(key);
``` ```
### 4. `readCsrDomains` and `readCertificateInfo` depromised ### 4. `readCsrDomains` and `readCertificateInfo` depromised
* Methods `readCsrDomains()` and `readCertificateInfo()` no longer return promises, but their resulting payloads directly * Methods `readCsrDomains()` and `readCertificateInfo()` no longer return promises, but their resulting payloads directly

View File

@ -2,9 +2,9 @@
"name": "acme-client", "name": "acme-client",
"description": "Simple and unopinionated ACME client", "description": "Simple and unopinionated ACME client",
"author": "nmorsman", "author": "nmorsman",
"version": "5.0.0", "version": "5.1.0",
"main": "src/index.js", "main": "src/index.js",
"types": "types", "types": "types/index.d.ts",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/publishlab/node-acme-client", "homepage": "https://github.com/publishlab/node-acme-client",
"engines": { "engines": {
@ -15,29 +15,27 @@
"types" "types"
], ],
"dependencies": { "dependencies": {
"axios": "0.27.2", "axios": "^1.6.5",
"debug": "^4.1.1", "debug": "^4.1.1",
"jsrsasign": "^10.5.26", "jsrsasign": "^11.0.0",
"node-forge": "^1.3.1" "node-forge": "^1.3.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.6.1", "@types/node": "^20.11.5",
"chai": "^4.3.6", "chai": "^4.4.1",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"dtslint": "^4.2.1", "eslint": "^8.56.0",
"eslint": "^8.11.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4", "eslint-plugin-import": "^2.29.1",
"jsdoc-to-markdown": "^7.1.1", "jsdoc-to-markdown": "^8.0.0",
"mocha": "^10.0.0", "mocha": "^10.2.0",
"nock": "^13.2.4", "nock": "^13.5.0",
"typescript": "^4.6.2", "tsd": "^0.30.4"
"uuid": "^8.3.2"
}, },
"scripts": { "scripts": {
"build-docs": "jsdoc2md src/client.js > docs/client.md && jsdoc2md src/crypto/index.js > docs/crypto.md && jsdoc2md src/crypto/forge.js > docs/forge.md", "build-docs": "jsdoc2md src/client.js > docs/client.md && jsdoc2md src/crypto/index.js > docs/crypto.md && jsdoc2md src/crypto/forge.js > docs/forge.md",
"lint": "eslint .", "lint": "eslint .",
"lint-types": "dtslint types", "lint-types": "tsd",
"prepublishOnly": "npm run build-docs", "prepublishOnly": "npm run build-docs",
"test": "mocha -t 60000 \"test/setup.js\" \"test/**/*.spec.js\"", "test": "mocha -t 60000 \"test/setup.js\" \"test/**/*.spec.js\"",
"test-local": "/bin/bash scripts/run-tests.sh" "test-local": "/bin/bash scripts/run-tests.sh"

View File

@ -6,8 +6,8 @@ set -eu
JOBS=("$@") JOBS=("$@")
CIRCLECI_CLI_URL="https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.16947/circleci-cli_0.1.16947_linux_amd64.tar.gz" CIRCLECI_CLI_URL="https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.29936/circleci-cli_0.1.29936_linux_amd64.tar.gz"
CIRCLECI_CLI_SHASUM="c6f9a3276445c69ae40439acfed07e2c53502216a96bfacc4556e1d862d1019a" CIRCLECI_CLI_SHASUM="fdc8da76111facae4a10f3717502eeb5d78db0256ef94a2f8d53078978175d40"
CIRCLECI_CLI_PATH="/tmp/circleci-cli" CIRCLECI_CLI_PATH="/tmp/circleci-cli"
CIRCLECI_CLI_BIN="${CIRCLECI_CLI_PATH}/circleci" CIRCLECI_CLI_BIN="${CIRCLECI_CLI_PATH}/circleci"
@ -19,8 +19,10 @@ if [[ ${#JOBS[@]} -eq 0 ]]; then
JOBS=( JOBS=(
"v16" "v16"
"v18" "v18"
"v20"
"eab-v16" "eab-v16"
"eab-v18" "eab-v18"
"eab-v20"
) )
fi fi
@ -33,8 +35,9 @@ if [[ ! -f "${CIRCLECI_CLI_BIN}" ]]; then
tar zxvf "${CIRCLECI_CLI_PATH}/circleci-cli.tar.gz" -C "${CIRCLECI_CLI_PATH}" --strip-components=1 tar zxvf "${CIRCLECI_CLI_PATH}/circleci-cli.tar.gz" -C "${CIRCLECI_CLI_PATH}" --strip-components=1
fi fi
# Skip CircleCI update checks # Disable CircleCI update checks and telemetry
export CIRCLECI_CLI_SKIP_UPDATE_CHECK="true" export CIRCLECI_CLI_SKIP_UPDATE_CHECK="true"
export CIRCLECI_CLI_TELEMETRY_OPTOUT="1"
# Run test suite # Run test suite
echo "[-] Running test suite" echo "[-] Running test suite"
@ -43,7 +46,7 @@ $CIRCLECI_CLI_BIN config validate -c "${CONFIG_PATH}"
for job in "${JOBS[@]}"; do for job in "${JOBS[@]}"; do
echo "[-] Running job: ${job}" echo "[-] Running job: ${job}"
$CIRCLECI_CLI_BIN local execute -c "${CONFIG_PATH}" --job "${job}" --skip-checkout $CIRCLECI_CLI_BIN local execute -c "${CONFIG_PATH}" "${job}"
echo "[+] ${job} completed successfully" echo "[+] ${job} completed successfully"
done done

View File

@ -3,7 +3,6 @@
*/ */
const axios = require('axios'); const axios = require('axios');
const adapter = require('axios/lib/adapters/http');
const pkg = require('./../package.json'); const pkg = require('./../package.json');
@ -30,7 +29,7 @@ instance.defaults.acmeSettings = {
* https://stackoverflow.com/questions/42677387 * https://stackoverflow.com/questions/42677387
*/ */
instance.defaults.adapter = adapter; instance.defaults.adapter = 'http';
/** /**

View File

@ -3,8 +3,8 @@
*/ */
const dns = require('dns').promises; const dns = require('dns').promises;
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai'); const { assert } = require('chai');
const { v4: uuid } = require('uuid');
const cts = require('./challtestsrv'); const cts = require('./challtestsrv');
const axios = require('./../src/axios'); const axios = require('./../src/axios');

View File

@ -2,8 +2,8 @@
* HTTP client tests * HTTP client tests
*/ */
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai'); const { assert } = require('chai');
const { v4: uuid } = require('uuid');
const nock = require('nock'); const nock = require('nock');
const axios = require('./../src/axios'); const axios = require('./../src/axios');
const HttpClient = require('./../src/http'); const HttpClient = require('./../src/http');

View File

@ -2,8 +2,8 @@
* Challenge verification tests * Challenge verification tests
*/ */
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai'); const { assert } = require('chai');
const { v4: uuid } = require('uuid');
const cts = require('./challtestsrv'); const cts = require('./challtestsrv');
const verify = require('./../src/verify'); const verify = require('./../src/verify');

View File

@ -2,8 +2,8 @@
* ACME client tests * ACME client tests
*/ */
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai'); const { assert } = require('chai');
const { v4: uuid } = require('uuid');
const cts = require('./challtestsrv'); const cts = require('./challtestsrv');
const getCertIssuers = require('./get-cert-issuers'); const getCertIssuers = require('./get-cert-issuers');
const spec = require('./spec'); const spec = require('./spec');

View File

@ -2,8 +2,8 @@
* ACME client.auto tests * ACME client.auto tests
*/ */
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai'); const { assert } = require('chai');
const { v4: uuid } = require('uuid');
const cts = require('./challtestsrv'); const cts = require('./challtestsrv');
const getCertIssuers = require('./get-cert-issuers'); const getCertIssuers = require('./get-cert-issuers');
const spec = require('./spec'); const spec = require('./spec');

View File

@ -1,6 +0,0 @@
{
"extends": "dtslint/dtslint.json",
"rules": {
"no-consecutive-blank-lines": [true, 2]
}
}