Skip to content

Commit 2154fe5

Browse files
committed
Add support for custom certificate key types via environment variables
This change allows users to specify custom key types and elliptic curves for SSL certificates through CERT_KEY_TYPE and CERT_ELLIPTIC_CURVE environment variables. This enables support for ECDSA P-256 certificates and other key types. When these environment variables are empty or not set, the current default behavior is preserved, ensuring backward compatibility. The environment variables are passed as arguments to certbot when generating or renewing certificates for both HTTP and DNS challenges.
1 parent 487fa6d commit 2154fe5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

backend/internal/certificate.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,13 @@ const internalCertificate = {
857857
certificate.domain_names.join(','),
858858
];
859859

860+
if (process.env.CERT_KEY_TYPE) {
861+
args.push('--key-type', process.env.CERT_KEY_TYPE);
862+
}
863+
if (process.env.CERT_ELLIPTIC_CURVE) {
864+
args.push('--elliptic-curve', process.env.CERT_ELLIPTIC_CURVE);
865+
}
866+
860867
const adds = internalCertificate.getAdditionalCertbotArgs(certificate.id);
861868
args.push(...adds.args);
862869

@@ -907,6 +914,13 @@ const internalCertificate = {
907914
dnsPlugin.full_plugin_name,
908915
];
909916

917+
if (process.env.CERT_KEY_TYPE) {
918+
args.push('--key-type', process.env.CERT_KEY_TYPE);
919+
}
920+
if (process.env.CERT_ELLIPTIC_CURVE) {
921+
args.push('--elliptic-curve', process.env.CERT_ELLIPTIC_CURVE);
922+
}
923+
910924
if (hasConfigArg) {
911925
args.push(`--${dnsPlugin.full_plugin_name}-credentials`, credentialsLocation);
912926
}

docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ ENV SUPPRESS_NO_CONFIG_WARNING=1 \
2323
NPM_BUILD_VERSION="${BUILD_VERSION}" \
2424
NPM_BUILD_COMMIT="${BUILD_COMMIT}" \
2525
NPM_BUILD_DATE="${BUILD_DATE}" \
26-
NODE_OPTIONS="--openssl-legacy-provider"
26+
NODE_OPTIONS="--openssl-legacy-provider" \
27+
CERT_KEY_TYPE="" \
28+
CERT_ELLIPTIC_CURVE=""
2729

2830
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
2931
&& apt-get update \

0 commit comments

Comments
 (0)