From 8532b1b706d37ac36535c43e15a8a57893b07458 Mon Sep 17 00:00:00 2001 From: thomas Date: Fri, 8 Sep 2023 01:44:07 -0400 Subject: [PATCH 1/5] fix: allow disabling IPv6 --- Dockerfile | 1 + README.md | 2 ++ ipv6.sh | 6 ++++++ lighttpd.conf | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 ipv6.sh diff --git a/Dockerfile b/Dockerfile index ab2d71aa9..b8d181495 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd WORKDIR /www COPY lighttpd.conf /lighttpd.conf +COPY ipv6.sh /etc/lighttpd/ipv6.sh COPY entrypoint.sh /entrypoint.sh COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/ COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets diff --git a/README.md b/README.md index d69796aa3..db2781d24 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ If you would like to host Homer in a subfolder, (ex: *http://my-domain/**homer** * **`PORT`** (default: `8080`) If you would like to change internal port of Homer from default `8080` to your port choice. +* **`IPV6_DISABLE`** (default: null) +Set to a non-empty value to disable listening on IPv6. #### With docker-compose diff --git a/ipv6.sh b/ipv6.sh new file mode 100755 index 000000000..c013ed6e0 --- /dev/null +++ b/ipv6.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Enable IPV6 if needed +if test -z "$IPV6_DISABLE"; then + echo '$SERVER["socket"] == "[::]:" + env.PORT { }' +fi diff --git a/lighttpd.conf b/lighttpd.conf index 2bf043fba..a6e9ff5f2 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -1,7 +1,7 @@ include "/etc/lighttpd/mime-types.conf" +include_shell "/etc/lighttpd/ipv6.sh" server.port = env.PORT -$SERVER["socket"] == "[::]:" + env.PORT { } server.modules = ( "mod_alias" ) server.username = "lighttpd" server.groupname = "lighttpd" From 5f37e9604548b3eab1f2e8b275e86677caed29a2 Mon Sep 17 00:00:00 2001 From: Thomas Anderson Date: Mon, 25 Sep 2023 20:12:29 -0400 Subject: [PATCH 2/5] fix: use double brackets instead of test Co-authored-by: Bastien Wirtz --- ipv6.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipv6.sh b/ipv6.sh index c013ed6e0..00b0ddadf 100755 --- a/ipv6.sh +++ b/ipv6.sh @@ -1,6 +1,6 @@ #!/bin/sh # Enable IPV6 if needed -if test -z "$IPV6_DISABLE"; then +if [[ "${IPV6_DISABLE}" == "1" ]]; then echo '$SERVER["socket"] == "[::]:" + env.PORT { }' fi From 3aeb2b324c63b03efe202141a0016e94f57e05e2 Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 25 Sep 2023 20:15:31 -0400 Subject: [PATCH 3/5] fix: rename ipv6.sh -> lighttpd-ipv6.sh --- Dockerfile | 3 ++- ipv6.sh => lighttpd-ipv6.sh | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename ipv6.sh => lighttpd-ipv6.sh (100%) diff --git a/Dockerfile b/Dockerfile index b8d181495..2670fec88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV UID 1000 ENV PORT 8080 ENV SUBFOLDER "/_" ENV INIT_ASSETS 1 +ENV IPV6_DISABLE 0 RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd && \ apk add -U --no-cache lighttpd @@ -24,7 +25,7 @@ RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd WORKDIR /www COPY lighttpd.conf /lighttpd.conf -COPY ipv6.sh /etc/lighttpd/ipv6.sh +COPY lighttpd-ipv6.sh /etc/lighttpd/ipv6.sh COPY entrypoint.sh /entrypoint.sh COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/ COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets diff --git a/ipv6.sh b/lighttpd-ipv6.sh similarity index 100% rename from ipv6.sh rename to lighttpd-ipv6.sh From c454f82f32bd4c3f3fe5a511ccbb33377ca49e5b Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 25 Sep 2023 20:17:08 -0400 Subject: [PATCH 4/5] fix(docs): only accept 1 for IPV6_DISABLE --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db2781d24..30717f166 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ If you would like to host Homer in a subfolder, (ex: *http://my-domain/**homer** * **`PORT`** (default: `8080`) If you would like to change internal port of Homer from default `8080` to your port choice. -* **`IPV6_DISABLE`** (default: null) -Set to a non-empty value to disable listening on IPv6. +* **`IPV6_DISABLE`** (default: 0) +Set to `1` to disable listening on IPv6. #### With docker-compose From 170cefd0befefef305878b6a1c035bdbfaa6b0dc Mon Sep 17 00:00:00 2001 From: Thomas Anderson Date: Wed, 27 Sep 2023 01:56:24 -0400 Subject: [PATCH 5/5] fix: reverse IPV6_DISABLE logic Co-authored-by: Bastien Wirtz --- lighttpd-ipv6.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lighttpd-ipv6.sh b/lighttpd-ipv6.sh index 00b0ddadf..40c485a2a 100755 --- a/lighttpd-ipv6.sh +++ b/lighttpd-ipv6.sh @@ -1,6 +1,6 @@ #!/bin/sh # Enable IPV6 if needed -if [[ "${IPV6_DISABLE}" == "1" ]]; then +if [[ "${IPV6_DISABLE}" != "1" ]]; then echo '$SERVER["socket"] == "[::]:" + env.PORT { }' fi