Skip to content

Commit 2c2f403

Browse files
authored
Merge branch 'jlesage:master' into crowdsec_rework
2 parents 0c09a42 + 488141f commit 2c2f403

File tree

7 files changed

+123
-5
lines changed

7 files changed

+123
-5
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ARG LIBMAXMINDDB_URL=https://github.com/maxmind/libmaxminddb/releases/download/$
2626
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
2727

2828
# Get Python cryptography wheel. It is needed for certbot.
29-
FROM moonbuggy2000/python-musl-wheels:cryptography38.0.1-py3.10-${TARGETARCH}${TARGETVARIANT} AS mod_cryptography
29+
FROM moonbuggy2000/python-musl-wheels:cryptography41.0.3-py3.10-${TARGETARCH}${TARGETVARIANT} AS mod_cryptography
3030

3131
# Build UPX.
3232
FROM --platform=$BUILDPLATFORM alpine:3.16 AS upx
@@ -73,7 +73,7 @@ COPY --from=mod_cryptography / /wheels
7373
RUN \
7474
apk --no-cache add build-base curl python3 && \
7575
curl -# -L "https://bootstrap.pypa.io/get-pip.py" | python3 && \
76-
pip install --no-cache-dir --root=/tmp/certbot-install --prefix=/usr --find-links /wheels/ --prefer-binary certbot && \
76+
pip install --no-cache-dir --root=/tmp/certbot-install --prefix=/usr --find-links /wheels/ --prefer-binary --only-binary=:all: certbot && \
7777
find /tmp/certbot-install/usr/lib/python3.10/site-packages -type f -name "*.so" -exec strip {} ';' && \
7878
find /tmp/certbot-install/usr/lib/python3.10/site-packages -type f -name "*.h" -delete && \
7979
find /tmp/certbot-install/usr/lib/python3.10/site-packages -type f -name "*.c" -delete && \
@@ -89,7 +89,7 @@ COPY src/cs-openresty-bouncer /build
8989
RUN /build/build.sh "$CROWDSEC_OPENRESTY_BOUNCER_URL"
9090

9191
# Pull base image.
92-
FROM jlesage/baseimage:alpine-3.16-v3.4.7
92+
FROM jlesage/baseimage:alpine-3.16-v3.5.2
9393

9494
ARG NGINX_PROXY_MANAGER_VERSION
9595
ARG DOCKER_IMAGE_VERSION

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
9595
|`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` |
9696
|`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` |
9797
|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (no value) |
98-
|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, the default umask value is `0022`, meaning that newly created files are readable by everyone, but only writable by the owner. See the online umask calculator at http://wintelguy.com/umask-calc.pl. | `0022` |
98+
|`UMASK`| Mask that controls how permissions are set for newly created files and folders. The value of the mask is in octal notation. By default, the default umask value is `0022`, meaning that newly created files and folders are readable by everyone, but only writable by the owner. See the online umask calculator at http://wintelguy.com/umask-calc.pl. | `0022` |
9999
|`LANG`| Set the [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)), which defines the application's language, **if supported**. Format of the locale is `language[_territory][.codeset]`, where language is an [ISO 639 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), territory is an [ISO 3166 country code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and codeset is a character set, like `UTF-8`. For example, Australian English using the UTF-8 encoding is `en_AU.UTF-8`. | `en_US.UTF-8` |
100100
|`TZ`| [TimeZone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) used by the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` |
101101
|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted when it crashes or terminates. | `0` |
102102
|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. The default niceness value is 0. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | `0` |
103-
|`INSTALL_PACKAGES`| Space-separated list of packages to install during the startup of the container. Packages are installed from the repository of the Linux distribution this container is based on. **ATTENTION**: Container functionality can be affected when installing a package that overrides existing container files (e.g. binaries). | (no value) |
103+
|`INSTALL_PACKAGES`| Space-separated list of packages to install during the startup of the container. List of available packages can be found at https://mirrors.alpinelinux.org. **ATTENTION**: Container functionality can be affected when installing a package that overrides existing container files (e.g. binaries). | (no value) |
104+
|`PACKAGES_MIRROR`| Mirror of the repository to use when installing packages. List of mirrors is available at https://mirrors.alpinelinux.org. | (no value) |
104105
|`CONTAINER_DEBUG`| Set to `1` to enable debug logging. | `0` |
105106
|`DISABLE_IPV6`| When set to `1`, IPv6 support is disabled. This is needed when IPv6 is not enabled/supported on the host. | `0` |
106107

appdefs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ app:
1212
name: nginx-proxy-manager
1313
friendly_name: Nginx Proxy Manager
1414
gui_type: web
15+
base_os: alpine
1516
gui_port: 8181
1617
project:
1718
description: |-
@@ -97,6 +98,22 @@ app:
9798
- `CONTAINER_NAME` is the name of the running container.
9899
- `USER_EMAIL` is the email of the address to reset the password.
99100
changelog:
101+
- version: 23.12.2
102+
date: 2023-12-20
103+
changes:
104+
- 'Fixed warning message about uninitialized variable.'
105+
- version: 23.12.1
106+
date: 2023-12-15
107+
changes:
108+
- 'Fixed PowerDNS DNS provider plugin installation.'
109+
- 'Fixed issue where HTTP2 support would always be enabled.'
110+
- 'Fixed server reachability test.'
111+
- 'Updated baseimage to version 3.5.2, which brings the following changes:'
112+
- '2:Mirror for packages installation can be set via the `PACKAGES_MIRROR` environment variable.'
113+
- '2:Improved the way the `take-ownership` script is working.'
114+
- '2:Readiness and minimum running time checks should not be done for a service defined with an interval.'
115+
- '2:Raise an error when a synched service fails to start.'
116+
- '2:Minimum running time check of a service was using an incorrect way to verify if process is still alive.'
100117
- version: 23.08.1
101118
date: 2023-08-04
102119
changes:

src/nginx-proxy-manager/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ sed -i "s/\"version\": \"0.0.0\",/\"version\": \"${NGINX_PROXY_MANAGER_VERSION}\
7676
log "Patching Nginx Proxy Manager backend..."
7777
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/pip-install.patch
7878
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/remove-certbot-dns-oci.patch
79+
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/powerdns-fix.patch
80+
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/http2-support-fix.patch
81+
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/reachability-test-fix.patch
7982

8083
cp -r /tmp/nginx-proxy-manager /app
8184

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- a/backend/templates/_listen.conf 2023-12-09 10:51:50.551616517 -0500
2+
+++ b/backend/templates/_listen.conf 2023-12-09 10:52:16.259672036 -0500
3+
@@ -5,9 +5,9 @@
4+
#listen [::]:80;
5+
{% endif %}
6+
{% if certificate -%}
7+
- listen 443 ssl{% if http2_support %} http2{% endif %};
8+
+ listen 443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
9+
{% if ipv6 -%}
10+
- listen [::]:443 ssl{% if http2_support %} http2{% endif %};
11+
+ listen [::]:443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
12+
{% else -%}
13+
#listen [::]:443;
14+
{% endif %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Workaround for PowerDNS plugin, where its PyYAML dependency nstallation fails.
2+
See https://github.com/yaml/pyyaml/issues/736
3+
--- a/global/certbot-dns-plugins.js 2023-12-09 10:19:09.655563943 -0500
4+
+++ b/global/certbot-dns-plugins.js 2023-12-09 10:19:28.471600576 -0500
5+
@@ -486,7 +486,7 @@
6+
display_name: 'PowerDNS',
7+
package_name: 'certbot-dns-powerdns',
8+
version_requirement: '~=0.2.0',
9+
- dependencies: '',
10+
+ dependencies: 'pyyaml==5.3.1',
11+
credentials: `dns_powerdns_api_url = https://api.mypowerdns.example.org
12+
dns_powerdns_api_key = AbCbASsd!@34`,
13+
full_plugin_name: 'dns-powerdns',
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Fixes for the server reachability test.
2+
- Do not apply HTTPs redirection for challenge used by the test.
3+
- Set the `User-Agent` to avoid 403 answer from site24x7.com.
4+
- Handle JSON parsing failure of the received body.
5+
- Better handling of different error cases.
6+
7+
diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js
8+
index f68ef30..ecbb4bf 100644
9+
--- a/backend/internal/certificate.js
10+
+++ b/backend/internal/certificate.js
11+
@@ -1167,6 +1167,7 @@ const internalCertificate = {
12+
const options = {
13+
method: 'POST',
14+
headers: {
15+
+ 'User-Agent': 'Mozilla/5.0',
16+
'Content-Type': 'application/x-www-form-urlencoded',
17+
'Content-Length': Buffer.byteLength(formBody)
18+
}
19+
@@ -1179,12 +1180,22 @@ const internalCertificate = {
20+
21+
res.on('data', (chunk) => responseBody = responseBody + chunk);
22+
res.on('end', function () {
23+
- const parsedBody = JSON.parse(responseBody + '');
24+
- if (res.statusCode !== 200) {
25+
- logger.warn(`Failed to test HTTP challenge for domain ${domain}`, res);
26+
+ try {
27+
+ const parsedBody = JSON.parse(responseBody + '');
28+
+ if (res.statusCode !== 200) {
29+
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because HTTP status code ${res.statusCode} was returned: ${parsedBody.message}`);
30+
+ resolve(undefined);
31+
+ } else {
32+
+ resolve(parsedBody);
33+
+ }
34+
+ } catch (err) {
35+
+ if (res.statusCode !== 200) {
36+
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because HTTP status code ${res.statusCode} was returned`);
37+
+ } else {
38+
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because response failed to be parsed: ${err.message}`);
39+
+ }
40+
resolve(undefined);
41+
}
42+
- resolve(parsedBody);
43+
});
44+
});
45+
46+
@@ -1198,6 +1209,9 @@ const internalCertificate = {
47+
if (!result) {
48+
// Some error occurred while trying to get the data
49+
return 'failed';
50+
+ } else if (result.error) {
51+
+ logger.info(`HTTP challenge test failed for domain ${domain} because error was returned: ${result.error.msg}`);
52+
+ return `other:${result.error.msg}`;
53+
} else if (`${result.responsecode}` === '200' && result.htmlresponse === 'Success') {
54+
// Server exists and has responded with the correct data
55+
return 'ok';
56+
diff --git a/docker/rootfs/etc/nginx/conf.d/include/force-ssl.conf b/docker/rootfs/etc/nginx/conf.d/include/force-ssl.conf
57+
index 15f0d28..aa52f33 100644
58+
--- a/docker/rootfs/etc/nginx/conf.d/include/force-ssl.conf
59+
+++ b/docker/rootfs/etc/nginx/conf.d/include/force-ssl.conf
60+
@@ -1,3 +1,10 @@
61+
+set $test "";
62+
if ($scheme = "http") {
63+
+ set $test "H";
64+
+}
65+
+if ($request_uri = /.well-known/acme-challenge/test-challenge) {
66+
+ set $test "${test}T";
67+
+}
68+
+if ($test = H) {
69+
return 301 https://$host$request_uri;
70+
}

0 commit comments

Comments
 (0)