Skip to content

Commit f16a26e

Browse files
authored
Merge branch 'NginxProxyManager:develop' into develop
2 parents 114d37a + 54d463a commit f16a26e

File tree

21 files changed

+137
-102
lines changed

21 files changed

+137
-102
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.12.4
1+
2.12.6

Jenkinsfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,17 @@ pipeline {
241241
}
242242
steps {
243243
script {
244-
npmGithubPrComment("""Docker Image for build ${BUILD_NUMBER} is available on
245-
[DockerHub](https://cloud.docker.com/repository/docker/nginxproxymanager/${IMAGE}-dev)
246-
as `nginxproxymanager/${IMAGE}-dev:${BRANCH_LOWER}`
244+
npmGithubPrComment("""Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/nginxproxymanager/${IMAGE}-dev):
245+
```
246+
nginxproxymanager/${IMAGE}-dev:${BRANCH_LOWER}
247+
```
247248
248-
**Note:** ensure you backup your NPM instance before testing this image! Especially if there are database changes
249-
**Note:** this is a different docker image namespace than the official image
249+
> [!NOTE]
250+
> Ensure you backup your NPM instance before testing this image! Especially if there are database changes.
251+
> This is a different docker image namespace than the official image.
252+
253+
> [!WARNING]
254+
> Changes and additions to DNS Providers require verification by at least 2 members of the community!
250255
""", true)
251256
}
252257
}

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.12.4-green.svg?style=for-the-badge">
4+
<img src="https://img.shields.io/badge/version-2.12.6-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>

backend/lib/certbot.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const certbot = {
1111
/**
1212
* @param {array} pluginKeys
1313
*/
14-
installPlugins: async function (pluginKeys) {
14+
installPlugins: async (pluginKeys) => {
1515
let hasErrors = false;
1616

1717
return new Promise((resolve, reject) => {
@@ -21,7 +21,7 @@ const certbot = {
2121
}
2222

2323
batchflow(pluginKeys).sequential()
24-
.each((i, pluginKey, next) => {
24+
.each((_i, pluginKey, next) => {
2525
certbot.installPlugin(pluginKey)
2626
.then(() => {
2727
next();
@@ -51,7 +51,7 @@ const certbot = {
5151
* @param {string} pluginKey
5252
* @returns {Object}
5353
*/
54-
installPlugin: async function (pluginKey) {
54+
installPlugin: async (pluginKey) => {
5555
if (typeof dnsPlugins[pluginKey] === 'undefined') {
5656
// throw Error(`Certbot plugin ${pluginKey} not found`);
5757
throw new error.ItemNotFoundError(pluginKey);
@@ -63,8 +63,15 @@ const certbot = {
6363
plugin.version = plugin.version.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
6464
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
6565

66-
const cmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir ' + plugin.dependencies + ' ' + plugin.package_name + plugin.version + ' ' + ' && deactivate';
67-
return utils.exec(cmd)
66+
// SETUPTOOLS_USE_DISTUTILS is required for certbot plugins to install correctly
67+
// in new versions of Python
68+
let env = Object.assign({}, process.env, {SETUPTOOLS_USE_DISTUTILS: 'stdlib'});
69+
if (typeof plugin.env === 'object') {
70+
env = Object.assign(env, plugin.env);
71+
}
72+
73+
const cmd = `. /opt/certbot/bin/activate && pip install --no-cache-dir ${plugin.dependencies} ${plugin.package_name}${plugin.version} && deactivate`;
74+
return utils.exec(cmd, {env})
6875
.then((result) => {
6976
logger.complete(`Installed ${pluginKey}`);
7077
return result;

backend/lib/utils.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const _ = require('lodash');
2-
const exec = require('child_process').exec;
3-
const execFile = require('child_process').execFile;
2+
const exec = require('node:child_process').exec;
3+
const execFile = require('node:child_process').execFile;
44
const { Liquid } = require('liquidjs');
55
const logger = require('../logger').global;
66
const error = require('./error');
77

88
module.exports = {
99

10-
exec: async function(cmd, options = {}) {
10+
exec: async (cmd, options = {}) => {
1111
logger.debug('CMD:', cmd);
1212

1313
const { stdout, stderr } = await new Promise((resolve, reject) => {
@@ -31,11 +31,11 @@ module.exports = {
3131
* @param {Array} args
3232
* @returns {Promise}
3333
*/
34-
execFile: function (cmd, args) {
34+
execFile: (cmd, args) => {
3535
// logger.debug('CMD: ' + cmd + ' ' + (args ? args.join(' ') : ''));
3636

3737
return new Promise((resolve, reject) => {
38-
execFile(cmd, args, function (err, stdout, /*stderr*/) {
38+
execFile(cmd, args, (err, stdout, /*stderr*/) => {
3939
if (err && typeof err === 'object') {
4040
reject(err);
4141
} else {
@@ -51,7 +51,7 @@ module.exports = {
5151
* @param {Array} omissions
5252
* @returns {Function}
5353
*/
54-
omitRow: function (omissions) {
54+
omitRow: (omissions) => {
5555
/**
5656
* @param {Object} row
5757
* @returns {Object}
@@ -67,7 +67,7 @@ module.exports = {
6767
* @param {Array} omissions
6868
* @returns {Function}
6969
*/
70-
omitRows: function (omissions) {
70+
omitRows: (omissions) => {
7171
/**
7272
* @param {Array} rows
7373
* @returns {Object}
@@ -83,9 +83,9 @@ module.exports = {
8383
/**
8484
* @returns {Object} Liquid render engine
8585
*/
86-
getRenderEngine: function () {
86+
getRenderEngine: () => {
8787
const renderEngine = new Liquid({
88-
root: __dirname + '/../templates/'
88+
root: `${__dirname}/../templates/`
8989
});
9090

9191
/**

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,53 @@ log_info 'Setting ownership ...'
88
# root
99
chown root /tmp/nginx
1010

11-
# npm user and group
12-
chown -R "$PUID:$PGID" /data
13-
chown -R "$PUID:$PGID" /etc/letsencrypt
14-
chown -R "$PUID:$PGID" /run/nginx
15-
chown -R "$PUID:$PGID" /tmp/nginx
16-
chown -R "$PUID:$PGID" /var/cache/nginx
17-
chown -R "$PUID:$PGID" /var/lib/logrotate
18-
chown -R "$PUID:$PGID" /var/lib/nginx
19-
chown -R "$PUID:$PGID" /var/log/nginx
20-
21-
# Don't chown entire /etc/nginx folder as this causes crashes on some systems
22-
chown -R "$PUID:$PGID" /etc/nginx/nginx
23-
chown -R "$PUID:$PGID" /etc/nginx/nginx.conf
24-
chown -R "$PUID:$PGID" /etc/nginx/conf.d
25-
26-
# Certbot directories - optimized approach
27-
CERT_INIT_FLAG="/opt/certbot/.ownership_initialized"
28-
29-
if [ ! -f "$CERT_INIT_FLAG" ]; then
30-
# Prevents errors when installing python certbot plugins when non-root
31-
chown "$PUID:$PGID" /opt/certbot /opt/certbot/bin
32-
33-
# Handle all site-packages directories efficiently
34-
find /opt/certbot/lib -type d -name "site-packages" | while read -r SITE_PACKAGES_DIR; do
35-
chown -R "$PUID:$PGID" "$SITE_PACKAGES_DIR"
36-
done
37-
38-
# Create a flag file to skip this step on subsequent runs
39-
touch "$CERT_INIT_FLAG"
40-
chown "$PUID:$PGID" "$CERT_INIT_FLAG"
41-
fi
11+
locations=(
12+
"/data"
13+
"/etc/letsencrypt"
14+
"/run/nginx"
15+
"/tmp/nginx"
16+
"/var/cache/nginx"
17+
"/var/lib/logrotate"
18+
"/var/lib/nginx"
19+
"/var/log/nginx"
20+
"/etc/nginx/nginx"
21+
"/etc/nginx/nginx.conf"
22+
"/etc/nginx/conf.d"
23+
)
24+
25+
chownit() {
26+
local dir="$1"
27+
local recursive="${2:-true}"
28+
29+
local have
30+
have="$(stat -c '%u:%g' "$dir")"
31+
echo "- $dir ... "
32+
33+
if [ "$have" != "$PUID:$PGID" ]; then
34+
if [ "$recursive" = 'true' ] && [ -d "$dir" ]; then
35+
chown -R "$PUID:$PGID" "$dir"
36+
else
37+
chown "$PUID:$PGID" "$dir"
38+
fi
39+
echo " DONE"
40+
else
41+
echo " SKIPPED"
42+
fi
43+
}
44+
45+
for loc in "${locations[@]}"; do
46+
chownit "$loc"
47+
done
48+
49+
if [ "$(is_true "${SKIP_CERTBOT_OWNERSHIP:-}")" = '1' ]; then
50+
log_info 'Skipping ownership change of certbot directories'
51+
else
52+
log_info 'Changing ownership of certbot directories, this may take some time ...'
53+
chownit "/opt/certbot" false
54+
chownit "/opt/certbot/bin" false
55+
56+
# Handle all site-packages directories efficiently
57+
find /opt/certbot/lib -type d -name "site-packages" | while read -r SITE_PACKAGES_DIR; do
58+
chownit "$SITE_PACKAGES_DIR"
59+
done
60+
fi

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ set -e
55

66
log_info 'Dynamic resolvers ...'
77

8-
DISABLE_IPV6=$(echo "${DISABLE_IPV6:-}" | tr '[:upper:]' '[:lower:]')
9-
108
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
119
# thanks @tfmm
12-
if [ "$DISABLE_IPV6" == "true" ] || [ "$DISABLE_IPV6" == "on" ] || [ "$DISABLE_IPV6" == "1" ] || [ "$DISABLE_IPV6" == "yes" ];
13-
then
10+
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
1411
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
1512
else
1613
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ set -e
88

99
log_info 'IPv6 ...'
1010

11-
# Lowercase
12-
DISABLE_IPV6=$(echo "${DISABLE_IPV6:-}" | tr '[:upper:]' '[:lower:]')
13-
1411
process_folder () {
1512
FILES=$(find "$1" -type f -name "*.conf")
1613
SED_REGEX=
1714

18-
if [ "$DISABLE_IPV6" == "true" ] || [ "$DISABLE_IPV6" == "on" ] || [ "$DISABLE_IPV6" == "1" ] || [ "$DISABLE_IPV6" == "yes" ]; then
15+
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
1916
# IPV6 is disabled
2017
echo "Disabling IPV6 in hosts in: $1"
2118
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'

docker/rootfs/usr/bin/common.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ get_group_id () {
5656
getent group "$1" | cut -d: -f3
5757
fi
5858
}
59+
60+
# param $1: value
61+
is_true () {
62+
VAL=$(echo "${1:-}" | tr '[:upper:]' '[:lower:]')
63+
if [ "$VAL" == 'true' ] || [ "$VAL" == 'on' ] || [ "$VAL" == '1' ] || [ "$VAL" == 'yes' ]; then
64+
echo '1'
65+
else
66+
echo '0'
67+
fi
68+
}

docker/scripts/install-s6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BLUE='\E[1;34m'
88
GREEN='\E[1;32m'
99
RESET='\E[0m'
1010

11-
S6_OVERLAY_VERSION=3.2.0.2
11+
S6_OVERLAY_VERSION=3.2.1.0
1212
TARGETPLATFORM=${1:-linux/amd64}
1313

1414
# Determine the correct binary file for the architecture given

0 commit comments

Comments
 (0)