Skip to content

Rebase to 3.22 #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .editorconfig
100755 → 100644
Empty file.
Empty file modified .github/CONTRIBUTING.md
100755 → 100644
Empty file.
Empty file modified .github/FUNDING.yml
100755 → 100644
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/config.yml
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions .github/workflows/call_issue_pr_tracker.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request_review:
types: [submitted,edited,dismissed]

permissions:
contents: read

jobs:
manage-project:
permissions:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/call_issues_cron.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
- cron: '20 0 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
stale:
permissions:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/external_trigger.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: External Trigger Main
on:
workflow_dispatch:

permissions:
contents: read

jobs:
external-trigger-master:
runs-on: ubuntu-latest
Expand All @@ -26,7 +29,7 @@ jobs:
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
echo "> External trigger running off of master branch. To disable this trigger, add \`wireguard_master\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:'"wireguard-tools"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
echo "Type is \`alpine_repo\`" >> $GITHUB_STEP_SUMMARY
if grep -q "^wireguard_master_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
Expand All @@ -44,8 +47,8 @@ jobs:
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
exit 1
fi
EXT_RELEASE=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
echo "External version: \`${EXT_RELEASE}\`" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE_SANITIZED=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
echo "Sanitized external version: \`${EXT_RELEASE_SANITIZED}\`" >> $GITHUB_STEP_SUMMARY
echo "Retrieving last pushed version" >> $GITHUB_STEP_SUMMARY
image="linuxserver/wireguard"
tag="latest"
Expand Down Expand Up @@ -101,10 +104,10 @@ jobs:
exit 1
fi
echo "Last pushed version: \`${IMAGE_VERSION}\`" >> $GITHUB_STEP_SUMMARY
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
if [ "${EXT_RELEASE_SANITIZED}" == "${IMAGE_VERSION}" ]; then
echo "Sanitized version \`${EXT_RELEASE_SANITIZED}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
exit 0
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"wireguard-tools"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.22/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"wireguard-tools"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
echo "New version \`${EXT_RELEASE}\` found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY
FAILURE_REASON="New version ${EXT_RELEASE} for wireguard tag latest is detected, however not all arch repos are updated yet. Will try again later."
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
Expand All @@ -124,7 +127,7 @@ jobs:
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
else
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
echo "New sanitized version \`${EXT_RELEASE_SANITIZED}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
if [[ "${artifacts_found}" == "true" ]]; then
echo "All artifacts seem to be uploaded." >> $GITHUB_STEP_SUMMARY
fi
Expand All @@ -144,7 +147,7 @@ jobs:
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--data-urlencode "Submit=Submit"
echo "**** Notifying Discord ****"
TRIGGER_REASON="A version change was detected for wireguard tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
TRIGGER_REASON="A version change was detected for wireguard tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE_SANITIZED}"
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/external_trigger_scheduler.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: '51 * * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
external-trigger-scheduler:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Greetings

on: [pull_request_target, issues]

permissions:
contents: read

jobs:
greeting:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/package_trigger_scheduler.yml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: '9 11 * * 4'
workflow_dispatch:

permissions:
contents: read

jobs:
package-trigger-scheduler:
runs-on: ubuntu-latest
Expand Down
Empty file modified .github/workflows/permissions.yml
100755 → 100644
Empty file.
13 changes: 3 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine:3.21
FROM ghcr.io/linuxserver/baseimage-alpine:3.22

# set version label
ARG BUILD_DATE
Expand All @@ -11,7 +11,7 @@ LABEL maintainer="thespad"

RUN \
if [ -z ${WIREGUARD_RELEASE+x} ]; then \
WIREGUARD_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
WIREGUARD_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:wireguard-tools$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
fi && \
echo "**** install dependencies ****" && \
Expand All @@ -21,23 +21,16 @@ RUN \
grep \
iproute2 \
iptables \
iptables-legacy \
ip6tables \
iputils \
kmod \
libcap-utils \
libqrencode-tools \
net-tools \
nftables \
openresolv \
wireguard-tools==${WIREGUARD_RELEASE} && \
echo "wireguard" >> /etc/modules && \
cd /usr/sbin && \
for i in ! !-save !-restore; do \
rm -rf iptables$(echo "${i}" | cut -c2-) && \
rm -rf ip6tables$(echo "${i}" | cut -c2-) && \
ln -s iptables-legacy$(echo "${i}" | cut -c2-) iptables$(echo "${i}" | cut -c2-) && \
ln -s ip6tables-legacy$(echo "${i}" | cut -c2-) ip6tables$(echo "${i}" | cut -c2-); \
done && \
sed -i 's|\[\[ $proto == -4 \]\] && cmd sysctl -q net\.ipv4\.conf\.all\.src_valid_mark=1|[[ $proto == -4 ]] \&\& [[ $(sysctl -n net.ipv4.conf.all.src_valid_mark) != 1 ]] \&\& cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1|' /usr/bin/wg-quick && \
rm -rf /etc/wireguard && \
ln -s /config/wg_confs /etc/wireguard && \
Expand Down
13 changes: 3 additions & 10 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.21
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.22

# set version label
ARG BUILD_DATE
Expand All @@ -11,7 +11,7 @@ LABEL maintainer="thespad"

RUN \
if [ -z ${WIREGUARD_RELEASE+x} ]; then \
WIREGUARD_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
WIREGUARD_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:wireguard-tools$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
fi && \
echo "**** install dependencies ****" && \
Expand All @@ -21,23 +21,16 @@ RUN \
grep \
iproute2 \
iptables \
iptables-legacy \
ip6tables \
iputils \
kmod \
libcap-utils \
libqrencode-tools \
net-tools \
nftables \
openresolv \
wireguard-tools==${WIREGUARD_RELEASE} && \
echo "wireguard" >> /etc/modules && \
cd /usr/sbin && \
for i in ! !-save !-restore; do \
rm -rf iptables$(echo "${i}" | cut -c2-) && \
rm -rf ip6tables$(echo "${i}" | cut -c2-) && \
ln -s iptables-legacy$(echo "${i}" | cut -c2-) iptables$(echo "${i}" | cut -c2-) && \
ln -s ip6tables-legacy$(echo "${i}" | cut -c2-) ip6tables$(echo "${i}" | cut -c2-); \
done && \
sed -i 's|\[\[ $proto == -4 \]\] && cmd sysctl -q net\.ipv4\.conf\.all\.src_valid_mark=1|[[ $proto == -4 ]] \&\& [[ $(sysctl -n net.ipv4.conf.all.src_valid_mark) != 1 ]] \&\& cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1|' /usr/bin/wg-quick && \
rm -rf /etc/wireguard && \
ln -s /config/wg_confs /etc/wireguard && \
Expand Down
9 changes: 7 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline {
DEV_DOCKERHUB_IMAGE = 'lsiodev/wireguard'
PR_DOCKERHUB_IMAGE = 'lspipepr/wireguard'
DIST_IMAGE = 'alpine'
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.22/main/'
DIST_REPO_PACKAGES = 'wireguard-tools'
MULTIARCH='true'
CI='false'
Expand Down Expand Up @@ -96,7 +96,11 @@ pipeline {
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
env.PULL_REQUEST = env.CHANGE_ID
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml ./root/donate.txt'
if ( env.SYFT_IMAGE_TAG == null ) {
env.SYFT_IMAGE_TAG = 'latest'
}
}
echo "Using syft image tag ${SYFT_IMAGE_TAG}"
sh '''#! /bin/bash
echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" '''
script{
Expand Down Expand Up @@ -783,7 +787,7 @@ pipeline {
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v ${TEMPDIR}:/tmp \
ghcr.io/anchore/syft:v1.26.1 \
ghcr.io/anchore/syft:${SYFT_IMAGE_TAG} \
${LOCAL_CONTAINER} -o table=/tmp/package_versions.txt
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
Expand Down Expand Up @@ -893,6 +897,7 @@ pipeline {
-e WEB_AUTH=\"${CI_AUTH}\" \
-e WEB_PATH=\"${CI_WEBPATH}\" \
-e NODE_NAME=\"${NODE_NAME}\" \
-e SYFT_IMAGE_TAG=\"${CI_SYFT_IMAGE_TAG:-${SYFT_IMAGE_TAG}}\" \
-t ghcr.io/linuxserver/ci:latest \
python3 test_build.py'''
}
Expand Down
Empty file modified LICENSE
100755 → 100644
Empty file.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![Blog](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Blog)](https://blog.linuxserver.io "all the things you can do with our containers including How-To guides, opinions and much more!")
[![Discord](https://img.shields.io/discord/354974912613449730.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Discord&logo=discord)](https://linuxserver.io/discord "realtime support / chat with the community and the team.")
[![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=discourse)](https://discourse.linuxserver.io "post on our community forum.")
[![Fleet](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.")
[![GitHub](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub&logo=github)](https://github.com/linuxserver "view the source for all of our repositories.")
[![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Supporters&logo=open%20collective)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget")

Expand All @@ -22,7 +21,6 @@ Find us at:
* [Blog](https://blog.linuxserver.io) - all the things you can do with our containers including How-To guides, opinions and much more!
* [Discord](https://linuxserver.io/discord) - realtime support / chat with the community and the team.
* [Discourse](https://discourse.linuxserver.io) - post on our community forum.
* [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images.
* [GitHub](https://github.com/linuxserver) - view the source for all of our repositories.
* [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget

Expand Down Expand Up @@ -54,11 +52,10 @@ The architectures supported by this image are:
| :----: | :----: | ---- |
| x86-64 | ✅ | amd64-\<version tag\> |
| arm64 | ✅ | arm64v8-\<version tag\> |
| armhf | ❌ | |

## Application Setup

During container start, it will first check if the wireguard module is already installed and loaded. Kernels newer than 5.6 generally have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.
During container start, it will first check if the wireguard module is already installed and loaded. All currently supported kernels should have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.

This can be run as a server or a client, based on the parameters used.

Expand Down Expand Up @@ -388,6 +385,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **15.07.25:** - Rebase to Alpine 3.22. Remove iptables-legacy shim.
* **01.01.25:** - Deprecate legacy branch.
* **20.12.24:** - Rebase to Alpine 3.21.
* **13.08.24:** - Add `errors` plugin to default Corefile.
Expand Down
2 changes: 1 addition & 1 deletion jenkins-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repo_vars:
- DEV_DOCKERHUB_IMAGE = 'lsiodev/wireguard'
- PR_DOCKERHUB_IMAGE = 'lspipepr/wireguard'
- DIST_IMAGE = 'alpine'
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.22/main/'
- DIST_REPO_PACKAGES = 'wireguard-tools'
- MULTIARCH='true'
- CI='false'
Expand Down
3 changes: 2 additions & 1 deletion readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ readonly_message: |
# application setup block
app_setup_block_enabled: true
app_setup_block: |
During container start, it will first check if the wireguard module is already installed and loaded. Kernels newer than 5.6 generally have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.
During container start, it will first check if the wireguard module is already installed and loaded. All currently supported kernels should have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.

This can be run as a server or a client, based on the parameters used.

Expand Down Expand Up @@ -158,6 +158,7 @@ init_diagram: |
"wireguard:latest" <- Base Images
# changelog
changelogs:
- {date: "15.07.25:", desc: "Rebase to Alpine 3.22. Remove iptables-legacy shim."}
- {date: "01.01.25:", desc: "Deprecate legacy branch."}
- {date: "20.12.24:", desc: "Rebase to Alpine 3.21."}
- {date: "13.08.24:", desc: "Add `errors` plugin to default Corefile."}
Expand Down
4 changes: 2 additions & 2 deletions root/defaults/server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Address = ${INTERFACE}.1
ListenPort = 51820
PrivateKey = $(cat /config/server/privatekey-server)
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth+ -j MASQUERADE
PostUp = iptables-nft -A FORWARD -i %i -j ACCEPT; iptables-nft -A FORWARD -o %i -j ACCEPT; iptables-nft -t nat -A POSTROUTING -o eth+ -j MASQUERADE
PostDown = iptables-nft -D FORWARD -i %i -j ACCEPT; iptables-nft -D FORWARD -o %i -j ACCEPT; iptables-nft -t nat -D POSTROUTING -o eth+ -j MASQUERADE
2 changes: 0 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/init-wireguard-module/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ echo "Uname info: $(uname -a)"
# check for wireguard module
ip link del dev test 2>/dev/null
if ip link add dev test type wireguard; then
echo "**** It seems the wireguard module is already active. Skipping kernel header install and module compilation. ****"
ip link del dev test
if capsh --current | grep "Current:" | grep -q "cap_sys_module"; then
echo "**** As the wireguard module is already active you can remove the SYS_MODULE capability from your container run/compose. ****"
echo "**** If your host does not automatically load the iptables module, you may still need the SYS_MODULE capability. ****"
fi
else
echo "**** The wireguard module is not active. If you believe that your kernel should have wireguard support already, make sure that it is activated via modprobe! ****"
echo "**** If you have an old kernel without wireguard support built-in, you can try using the 'legacy' tag for this image to compile the modules from scratch. ****"
sleep infinity
fi
8 changes: 4 additions & 4 deletions root/etc/s6-overlay/s6-rc.d/svc-wireguard/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
unset WG_CONFS
rm -rf /run/activeconfs
# Enumerate interfaces
for wgconf in $(ls /config/wg_confs/*.conf); do
for wgconf in /config/wg_confs/*.conf; do
if grep -q "\[Interface\]" "${wgconf}"; then
echo "**** Found WG conf ${wgconf}, adding to list ****"
WG_CONFS+=("${wgconf}")
Expand All @@ -13,14 +13,14 @@ for wgconf in $(ls /config/wg_confs/*.conf); do
fi
done

if [[ -z "${WG_CONFS}" ]]; then
if [[ -z "${WG_CONFS[*]}" ]]; then
echo "**** No valid tunnel config found. Please create a valid config and restart the container ****"
ip route del default
exit 0
fi

unset FAILED
for tunnel in ${WG_CONFS[@]}; do
for tunnel in "${WG_CONFS[@]}"; do
echo "**** Activating tunnel ${tunnel} ****"
if ! wg-quick up "${tunnel}"; then
FAILED="${tunnel}"
Expand All @@ -33,7 +33,7 @@ if [[ -z "${FAILED}" ]]; then
echo "**** All tunnels are now active ****"
else
echo "**** Tunnel ${FAILED} failed, will stop all others! ****"
for tunnel in ${WG_CONFS[@]}; do
for tunnel in "${WG_CONFS[@]}"; do
if [[ "${tunnel}" = "${FAILED}" ]]; then
break
else
Expand Down