Skip to content

Commit 7a2a6b4

Browse files
authored
Merge branch 'NginxProxyManager:develop' into stream-ssl
2 parents 7307515 + 63d06da commit 7a2a6b4

File tree

10 files changed

+61
-31
lines changed

10 files changed

+61
-31
lines changed

.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.11.2
1+
2.11.3

README.md

+1-2
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.11.2-green.svg?style=for-the-badge">
4+
<img src="https://img.shields.io/badge/version-2.11.3-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>
@@ -56,7 +56,6 @@ I won't go in to too much detail here but here are the basics for someone new to
5656
2. Create a docker-compose.yml file similar to this:
5757

5858
```yml
59-
version: '3.8'
6059
services:
6160
app:
6261
image: 'docker.io/jc21/nginx-proxy-manager:latest'

backend/internal/certificate.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,8 @@ const internalCertificate = {
861861
logger.info(`Requesting Let'sEncrypt certificates via ${dnsPlugin.name} for Cert #${certificate.id}: ${certificate.domain_names.join(', ')}`);
862862

863863
const credentialsLocation = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
864-
// Escape single quotes and backslashes
865-
const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
866-
const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
864+
fs.mkdirSync('/etc/letsencrypt/credentials', { recursive: true });
865+
fs.writeFileSync(credentialsLocation, certificate.meta.dns_provider_credentials, {mode: 0o600});
867866

868867
// Whether the plugin has a --<name>-credentials argument
869868
const hasConfigArg = certificate.meta.dns_provider !== 'route53';
@@ -898,17 +897,15 @@ const internalCertificate = {
898897
mainCmd = mainCmd + ' --dns-duckdns-no-txt-restore';
899898
}
900899

901-
logger.info('Command:', `${credentialsCmd} && && ${mainCmd}`);
900+
logger.info('Command:', mainCmd);
902901

903902
try {
904-
await utils.exec(credentialsCmd);
905903
const result = await utils.exec(mainCmd);
906904
logger.info(result);
907905
return result;
908906
} catch (err) {
909-
// Don't fail if file does not exist
910-
const delete_credentialsCmd = `rm -f '${credentialsLocation}' || true`;
911-
await utils.exec(delete_credentialsCmd);
907+
// Don't fail if file does not exist, so no need for action in the callback
908+
fs.unlink(credentialsLocation, () => {});
912909
throw err;
913910
}
914911
},

backend/lib/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const generateKeys = () => {
9393
try {
9494
fs.writeFileSync(keysFile, JSON.stringify(keys, null, 2));
9595
} catch (err) {
96-
logger.error('Could not write JWT key pair to config file: ' + keysFile + ': ' . err.message);
96+
logger.error('Could not write JWT key pair to config file: ' + keysFile + ': ' + err.message);
9797
process.exit(1);
9898
}
9999
logger.info('Wrote JWT key pair to config file: ' + keysFile);

backend/setup.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ const setupDefaultUser = () => {
2121
.then((row) => {
2222
if (!row.count) {
2323
// Create a new user and set password
24-
logger.info('Creating a new user: admin@example.com with password: changeme');
24+
let email = process.env.INITIAL_ADMIN_EMAIL || 'admin@example.com';
25+
let password = process.env.INITIAL_ADMIN_PASSWORD || 'changeme';
26+
27+
logger.info('Creating a new user: ' + email + ' with password: ' + password);
2528

2629
let data = {
2730
is_deleted: 0,
28-
email: 'admin@example.com',
31+
email: email,
2932
name: 'Administrator',
3033
nickname: 'Admin',
3134
avatar: '',
@@ -41,7 +44,7 @@ const setupDefaultUser = () => {
4144
.insert({
4245
user_id: user.id,
4346
type: 'password',
44-
secret: 'changeme',
47+
secret: password,
4548
meta: {},
4649
})
4750
.then(() => {

backend/yarn.lock

+11-11
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ brace-expansion@^1.1.7:
448448
concat-map "0.0.1"
449449

450450
braces@~3.0.2:
451-
version "3.0.2"
452-
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
453-
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
451+
version "3.0.3"
452+
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
453+
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
454454
dependencies:
455-
fill-range "^7.0.1"
455+
fill-range "^7.1.1"
456456

457457
buffer-crc32@^0.2.1, buffer-crc32@^0.2.13:
458458
version "0.2.13"
@@ -1206,10 +1206,10 @@ file-entry-cache@^6.0.1:
12061206
dependencies:
12071207
flat-cache "^3.0.4"
12081208

1209-
fill-range@^7.0.1:
1210-
version "7.0.1"
1211-
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
1212-
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
1209+
fill-range@^7.1.1:
1210+
version "7.1.1"
1211+
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
1212+
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
12131213
dependencies:
12141214
to-regex-range "^5.0.1"
12151215

@@ -1402,9 +1402,9 @@ glob-parent@^6.0.2:
14021402
is-glob "^4.0.3"
14031403

14041404
glob-parent@~5.1.0:
1405-
version "5.1.1"
1406-
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
1407-
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
1405+
version "5.1.2"
1406+
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
1407+
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
14081408
dependencies:
14091409
is-glob "^4.0.1"
14101410

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
2+
log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
3+
4+
access_log /data/logs/fallback_access.log proxy;

docker/rootfs/etc/nginx/nginx.conf

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ error_log /data/logs/fallback_error.log warn;
1414
# Includes files with directives to load dynamic modules.
1515
include /etc/nginx/modules/*.conf;
1616

17+
# Custom
18+
include /data/nginx/custom/root_top[.]conf;
19+
1720
events {
1821
include /data/nginx/custom/events[.]conf;
1922
}
@@ -43,10 +46,8 @@ http {
4346
proxy_cache_path /var/lib/nginx/cache/public levels=1:2 keys_zone=public-cache:30m max_size=192m;
4447
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
4548

46-
log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
47-
log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
48-
49-
access_log /data/logs/fallback_access.log proxy;
49+
# Log format and fallback log file
50+
include /etc/nginx/conf.d/include/log.conf;
5051

5152
# Dynamically generated resolvers file
5253
include /etc/nginx/conf.d/include/resolvers.conf;

docs/src/advanced-config/index.md

+10
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ NPM has the ability to include different custom configuration snippets in differ
173173

174174
You can add your custom configuration snippet files at `/data/nginx/custom` as follow:
175175

176+
- `/data/nginx/custom/root_top.conf`: Included at the top of nginx.conf
176177
- `/data/nginx/custom/root.conf`: Included at the very end of nginx.conf
177178
- `/data/nginx/custom/http_top.conf`: Included at the top of the main http block
178179
- `/data/nginx/custom/http.conf`: Included at the end of the main http block
@@ -212,3 +213,12 @@ You can customise the logrotate configuration through a mount (if your custom co
212213
```
213214

214215
For reference, the default configuration can be found [here](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/logrotate.d/nginx-proxy-manager).
216+
217+
## Enabling the geoip2 module
218+
219+
To enable the geoip2 module, you can create the custom configuration file `/data/nginx/custom/root_top.conf` and include the following snippet:
220+
221+
```
222+
load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so;
223+
load_module /usr/lib/nginx/modules/ngx_stream_geoip2_module.so;
224+
```

global/certbot-dns-plugins.json

+17-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"package_name": "certbot-dns-cloudflare",
3737
"version": "=={{certbot-version}}",
3838
"dependencies": "cloudflare==2.19.* acme=={{certbot-version}}",
39-
"credentials": "# Cloudflare API token\ndns_cloudflare_api_token = 0123456789abcdef0123456789abcdef01234567",
39+
"credentials": "# Cloudflare API token\ndns_cloudflare_api_token=0123456789abcdef0123456789abcdef01234567",
4040
"full_plugin_name": "dns-cloudflare"
4141
},
4242
"cloudns": {
@@ -239,6 +239,14 @@
239239
"credentials": "dns_hetzner_api_token = 0123456789abcdef0123456789abcdef",
240240
"full_plugin_name": "dns-hetzner"
241241
},
242+
"hover": {
243+
"name": "Hover",
244+
"package_name": "certbot-dns-hover",
245+
"version": "~=1.2.1",
246+
"dependencies": "",
247+
"credentials": "dns_hover_hoverurl = https://www.hover.com\ndns_hover_username = hover-admin-username\ndns_hover_password = hover-admin-password\ndns_hover_totpsecret = 2fa-totp-secret",
248+
"full_plugin_name": "dns-hover"
249+
},
242250
"infomaniak": {
243251
"name": "Infomaniak",
244252
"package_name": "certbot-dns-infomaniak",
@@ -454,5 +462,13 @@
454462
"dependencies": "",
455463
"credentials": "dns_websupport_identifier = <api_key>\ndns_websupport_secret_key = <secret>",
456464
"full_plugin_name": "dns-websupport"
465+
},
466+
"wedos":{
467+
"name": "Wedos",
468+
"package_name": "certbot-dns-wedos",
469+
"version": "~=2.2",
470+
"dependencies": "",
471+
"credentials": "dns_wedos_user = <wedos_registration>\ndns_wedos_auth = <wapi_sha256_password>",
472+
"full_plugin_name": "dns-wedos"
457473
}
458474
}

0 commit comments

Comments
 (0)