Skip to content

Commit 79a4128

Browse files
authored
Merge branch 'develop' into develop
2 parents 387f8d9 + fc1adb6 commit 79a4128

49 files changed

Lines changed: 1111 additions & 750 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ test/node_modules
88
*/node_modules
99
docker/dev/dnsrouter-config.json.tmp
1010
docker/dev/resolv.conf
11+
.claude
12+

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.14.0
1+
2.15.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<img src="https://nginxproxymanager.com/github.png">
33
<br><br>
4-
<img src="https://img.shields.io/badge/version-2.14.0-green.svg?style=for-the-badge">
4+
<img src="https://img.shields.io/badge/version-2.15.0-green.svg?style=for-the-badge">
55
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
66
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
77
</a>

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Older versions are not actively maintained.
77

88
| Version | Supported |
99
| ------- | --------- |
10-
| 2.14.x (latest) | :white_check_mark: |
11-
| < 2.14.0 | :x: |
10+
| 2.15.x (latest) | :white_check_mark: |
11+
| < 2.15.0 | :x: |
1212

1313
Docker images: `jc21/nginx-proxy-manager:latest`, `jc21/nginx-proxy-manager:2`
1414

backend/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ app.use("/", mainRoutes);
6262
app.use((err, req, res, _) => {
6363
const payload = {
6464
error: {
65-
code: err.status,
65+
code: err.status || 500,
6666
message: err.public ? err.message : "Internal Error",
6767
},
6868
};

backend/certbot/dns-plugins.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@
335335
"package_name": "certbot-dns-hetzner-cloud",
336336
"version": "~=1.0.4"
337337
},
338+
"hostinger": {
339+
"credentials": "dns_hostinger_api_token = 0123456789abcdef0123456789abcdef",
340+
"dependencies": "",
341+
"full_plugin_name": "dns-hostinger",
342+
"name": "Hostinger.com",
343+
"package_name": "certbot-dns-hostinger",
344+
"version": "~=0.1.3"
345+
},
338346
"hostingnl": {
339347
"credentials": "dns_hostingnl_api_key = 0123456789abcdef0123456789abcdef",
340348
"dependencies": "",
@@ -545,7 +553,7 @@
545553
},
546554
"powerdns": {
547555
"credentials": "dns_powerdns_api_url = https://api.mypowerdns.example.org\ndns_powerdns_api_key = AbCbASsd!@34",
548-
"dependencies": "PyYAML==5.3.1",
556+
"dependencies": "acme=={{certbot-version}}",
549557
"full_plugin_name": "dns-powerdns",
550558
"name": "PowerDNS",
551559
"package_name": "certbot-dns-powerdns",

backend/internal/certificate.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ const internalCertificate = {
614614
const certificate = await internalCertificate.update(access, {
615615
id: data.id,
616616
expires_on: moment(validations.certificate.dates.to, "X").format("YYYY-MM-DD HH:mm:ss"),
617-
domain_names: [validations.certificate.cn],
617+
domain_names: validations.certificate.cn ? [validations.certificate.cn] : [],
618618
meta: _.clone(row.meta), // Prevent the update method from changing this value that we'll use later
619619
});
620620

@@ -683,13 +683,15 @@ const internalCertificate = {
683683

684684
try {
685685
const result = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-subject", "-noout"]);
686+
686687
// Examples:
687688
// subject=CN = *.jc21.com
688689
// subject=CN = something.example.com
689-
const regex = /(?:subject=)?[^=]+=\s+(\S+)/gim;
690+
// subject=CN=*.jc21.com
691+
const regex = /(?:subject=)?[^=]+=\s*(\S+)/gim;
690692
const match = regex.exec(result);
691693
if (match && typeof match[1] !== "undefined") {
692-
certData.cn = match[1];
694+
certData.cn = match[1].trim();
693695
}
694696

695697
const result2 = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-issuer", "-noout"]);
@@ -779,6 +781,7 @@ const internalCertificate = {
779781

780782
const args = [
781783
"certonly",
784+
"-n", // non-interactive
782785
"--config",
783786
letsencryptConfig,
784787
"--work-dir",
@@ -834,6 +837,7 @@ const internalCertificate = {
834837

835838
const args = [
836839
"certonly",
840+
"-n", // non-interactive
837841
"--config",
838842
letsencryptConfig,
839843
"--work-dir",

backend/lib/certbot.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { certbot as logger } from "../logger.js";
44
import errs from "./error.js";
55
import utils from "./utils.js";
66

7-
const CERTBOT_VERSION_REPLACEMENT = "$(certbot --version | grep -Eo '[0-9](\\.[0-9]+)+')";
8-
97
/**
108
* Installs a cerbot plugin given the key for the object from
119
* ../certbot/dns-plugins.json
@@ -15,24 +13,32 @@ const CERTBOT_VERSION_REPLACEMENT = "$(certbot --version | grep -Eo '[0-9](\\.[0
1513
*/
1614
const installPlugin = async (pluginKey) => {
1715
if (typeof dnsPlugins[pluginKey] === "undefined") {
18-
// throw Error(`Certbot plugin ${pluginKey} not found`);
1916
throw new errs.ItemNotFoundError(pluginKey);
2017
}
2118

2219
const plugin = dnsPlugins[pluginKey];
2320
logger.start(`Installing ${pluginKey}...`);
2421

25-
plugin.version = plugin.version.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
26-
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
22+
plugin.version = plugin.version.replace(/{{certbot-version}}/g, process.env.CERTBOT_VERSION);
23+
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, process.env.CERTBOT_VERSION);
2724

28-
// SETUPTOOLS_USE_DISTUTILS is required for certbot plugins to install correctly
29-
// in new versions of Python
30-
let env = Object.assign({}, process.env, { SETUPTOOLS_USE_DISTUTILS: "stdlib" });
25+
// SETUPTOOLS_USE_DISTUTILS=local uses setuptools' own bundled distutils.
26+
// "stdlib" breaks Python 3.13+ where distutils was removed from the standard library.
27+
let env = Object.assign({}, process.env, { SETUPTOOLS_USE_DISTUTILS: "local" });
3128
if (typeof plugin.env === "object") {
3229
env = Object.assign(env, plugin.env);
3330
}
3431

35-
const cmd = `. /opt/certbot/bin/activate && pip install --no-cache-dir ${plugin.dependencies} ${plugin.package_name}${plugin.version} && deactivate`;
32+
const quotedDeps = plugin.dependencies.trim()
33+
? plugin.dependencies
34+
.trim()
35+
.split(/\s+/)
36+
.filter(Boolean)
37+
.map((d) => `'${d}'`)
38+
.join(" ")
39+
: "";
40+
41+
const cmd = `. /opt/certbot/bin/activate && pip install --no-cache-dir ${quotedDeps} '${plugin.package_name}${plugin.version}' && deactivate`;
3642
return utils
3743
.exec(cmd, { env })
3844
.then((result) => {
@@ -73,14 +79,12 @@ const installPlugins = async (pluginKeys) => {
7379
})
7480
.end(() => {
7581
if (hasErrors) {
76-
reject(
77-
new errs.CommandError("Some plugins failed to install. Please check the logs above", 1),
78-
);
82+
reject(new errs.CommandError("Some plugins failed to install. Please check the logs above", 1));
7983
} else {
8084
resolve();
8185
}
8286
});
8387
});
8488
};
8589

86-
export { installPlugins, installPlugin };
90+
export { installPlugin, installPlugins };

backend/lib/express/log-request.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import chalk from "chalk";
2+
import { debug, express as logger } from "../../logger.js";
3+
4+
export default (req, _res, next) => {
5+
debug(logger, `[${chalk.yellow(req.method.toUpperCase())}] ${chalk.green(req.path)}`);
6+
next();
7+
};

backend/lib/utils.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { dirname } from "node:path";
33
import { fileURLToPath } from "node:url";
44
import { Liquid } from "liquidjs";
55
import _ from "lodash";
6-
import { debug, global as logger } from "../logger.js";
76
import errs from "./error.js";
87

98
const __filename = fileURLToPath(import.meta.url);
109
const __dirname = dirname(__filename);
1110

1211
const exec = async (cmd, options = {}) => {
13-
debug(logger, "CMD:", cmd);
1412
const { stdout, stderr } = await new Promise((resolve, reject) => {
1513
const child = nodeExec(cmd, options, (isError, stdout, stderr) => {
1614
if (isError) {
@@ -34,7 +32,6 @@ const exec = async (cmd, options = {}) => {
3432
* @returns {Promise}
3533
*/
3634
const execFile = (cmd, args, options) => {
37-
debug(logger, `CMD: ${cmd} ${args ? args.join(" ") : ""}`);
3835
const opts = options || {};
3936

4037
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)