diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100755 index 0000000..406c0b3 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,122 @@ +# Contributing to wireguard + +## Gotchas + +* While contributing make sure to make all your changes before creating a Pull Request, as our pipeline builds each commit after the PR is open. +* Read, and fill the Pull Request template + * If this is a fix for a typo in code or documentation in the README please file an issue + * If the PR is addressing an existing issue include, closes #\, in the body of the PR commit message +* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn) + +## Common files + +| File | Use case | +| :----: | --- | +| `Dockerfile` | Dockerfile used to build amd64 images | +| `Dockerfile.aarch64` | Dockerfile used to build 64bit ARM architectures | +| `Dockerfile.armhf` | Dockerfile used to build 32bit ARM architectures | +| `Jenkinsfile` | This file is a product of our builder and should not be edited directly. This is used to build the image | +| `jenkins-vars.yml` | This file is used to generate the `Jenkinsfile` mentioned above, it only affects the build-process | +| `package_versions.txt` | This file is generated as a part of the build-process and should not be edited directly. It lists all the installed packages and their versions | +| `README.md` | This file is a product of our builder and should not be edited directly. This displays the readme for the repository and image registries | +| `readme-vars.yml` | This file is used to generate the `README.md` | + +## Readme + +If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit. +Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-wireguard/edit/master/readme-vars.yml). + +These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play. +Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-wireguard) + +### Fixing typos or clarify the text in the readme + +There are variables for multiple parts of the readme, the most common ones are: + +| Variable | Description | +| :----: | --- | +| `project_blurb` | This is the short excerpt shown above the project logo. | +| `app_setup_block` | This is the text that shows up under "Application Setup" if enabled | + +### Parameters + +The compose and run examples are also generated from these variables. + +We have a [reference file](https://github.com/linuxserver/docker-jenkins-builder/blob/master/vars/_container-vars-blank) in our Jenkins Builder. + +These are prefixed with `param_` for required parameters, or `opt_param` for optional parameters, except for `cap_add`. +Remember to enable param, if currently disabled. This differs between parameters, and can be seen in the reference file. + +Devices, environment variables, ports and volumes expects its variables in a certain way. + +### Devices + +```yml +param_devices: + - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" } +opt_param_devices: + - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" } +``` + +### Environment variables + +```yml +param_env_vars: + - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." } +opt_param_env_vars: + - { env_var: "VERSION", env_value: "latest", desc: "Supported values are LATEST, PLEXPASS or a specific version number." } +``` + +### Ports + +```yml +param_ports: + - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" } +opt_param_ports: + - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" } +``` + +### Volumes + +```yml +param_volumes: + - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } +opt_param_volumes: + - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } +``` + +### Testing template changes + +After you make any changes to the templates, you can use our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) to have the files updated from the modified templates. Please use the command found under `Running Locally` [on this page](https://github.com/linuxserver/docker-jenkins-builder/blob/master/README.md) to generate them prior to submitting a PR. + +## Dockerfiles + +We use multiple Dockerfiles in our repos, this is because sometimes some CPU architectures needs different packages to work. +If you are proposing additional packages to be added, ensure that you added the packages to all the Dockerfiles in alphabetical order. + +### Testing your changes + +``` +git clone https://github.com/linuxserver/docker-wireguard.git +cd docker-wireguard +docker build \ + --no-cache \ + --pull \ + -t linuxserver/wireguard:latest . +``` + +The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static` +``` +docker run --rm --privileged multiarch/qemu-user-static:register --reset +``` + +Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`. + +## Update the chagelog + +If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-wireguard/tree/master/root), add an entry to the changelog + +```yml +changelogs: + - { date: "DD.MM.YY:", desc: "Added some love to templates" } +``` diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index da0c279..7d92262 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,7 +1,10 @@ [linuxserverurl]: https://linuxserver.io [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] -If you are new to Docker or this application our issue tracker is **ONLY** used for reporting bugs or requesting features. Please use [our discord server](https://discord.gg/YWrKVTn) for general support. + + + + @@ -22,9 +25,10 @@ If you are new to Docker or this application our issue tracker is **ONLY** used 4. ## Environment -**OS:** -**CPU architecture:** x86_64/arm32/arm64 -**How docker service was installed:** +**OS:** +**CPU architecture:** x86_64/arm32/arm64 +**How docker service was installed:** + ## Command used to create docker container (run/create/compose/screenshot) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 26d5031..f50314f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,11 +2,11 @@ [linuxserverurl]: https://linuxserver.io [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] - + - + @@ -21,7 +21,11 @@ ------------------------------ -We welcome all PR’s though this doesn’t guarantee it will be accepted. + - [ ] I have read the [contributing](https://github.com/linuxserver/docker-wireguard/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications + +------------------------------ + + ## Description: diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index b7f6355..f116d9f 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -8,6 +8,6 @@ jobs: steps: - uses: actions/first-interaction@v1 with: - issue-message: 'Thanks for opening your first issue here! Be sure to follow the [issue template](https://github.com/linuxserver/docker-wireguard/.github/ISSUE_TEMPLATE.md)!' - pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-wireguard/.github/PULL_REQUEST_TEMPLATE.md)!' + issue-message: 'Thanks for opening your first issue here! Be sure to follow the [issue template](https://github.com/linuxserver/docker-wireguard/blob/master/.github/ISSUE_TEMPLATE.md)!' + pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-wireguard/blob/master/.github/PULL_REQUEST_TEMPLATE.md)!' repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Jenkinsfile b/Jenkinsfile index e80382b..04f48d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT 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 ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/greetings.yml ./.github/workflows/stale.yml ./root/donate.txt' + env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/greetings.yml ./.github/workflows/stale.yml ./root/donate.txt' } script{ env.LS_RELEASE_NUMBER = sh( @@ -136,6 +136,7 @@ pipeline { env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER } env.META_TAG = env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER + env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN } } } @@ -156,6 +157,7 @@ pipeline { env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA } env.META_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DEV_DOCKERHUB_IMAGE + '/tags/' } } @@ -176,6 +178,7 @@ pipeline { env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST } env.META_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/pull/' + env.PULL_REQUEST env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.PR_DOCKERHUB_IMAGE + '/tags/' } @@ -543,8 +546,10 @@ pipeline { for PUSHIMAGE in "${GITHUBIMAGE}" "${GITLABIMAGE}" "${IMAGE}"; do docker tag ${IMAGE}:${META_TAG} ${PUSHIMAGE}:${META_TAG} docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:latest + docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:${EXT_RELEASE_TAG} docker push ${PUSHIMAGE}:latest docker push ${PUSHIMAGE}:${META_TAG} + docker push ${PUSHIMAGE}:${EXT_RELEASE_TAG} done ''' } @@ -552,6 +557,7 @@ pipeline { for DELETEIMAGE in "${GITHUBIMAGE}" "{GITLABIMAGE}" "${IMAGE}"; do docker rmi \ ${DELETEIMAGE}:${META_TAG} \ + ${DELETEIMAGE}:${EXT_RELEASE_TAG} \ ${DELETEIMAGE}:latest || : done ''' @@ -592,12 +598,18 @@ pipeline { docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-latest docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-latest docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-latest + docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} + docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} + docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} docker push ${MANIFESTIMAGE}:amd64-${META_TAG} docker push ${MANIFESTIMAGE}:arm32v7-${META_TAG} docker push ${MANIFESTIMAGE}:arm64v8-${META_TAG} docker push ${MANIFESTIMAGE}:amd64-latest docker push ${MANIFESTIMAGE}:arm32v7-latest docker push ${MANIFESTIMAGE}:arm64v8-latest + docker push ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} + docker push ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} + docker push ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} docker manifest push --purge ${MANIFESTIMAGE}:latest || : docker manifest create ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:amd64-latest ${MANIFESTIMAGE}:arm32v7-latest ${MANIFESTIMAGE}:arm64v8-latest docker manifest annotate ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:arm32v7-latest --os linux --arch arm @@ -606,8 +618,12 @@ pipeline { docker manifest create ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} --os linux --arch arm docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8 + docker manifest create ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} + docker manifest annotate ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} --os linux --arch arm + docker manifest annotate ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} --os linux --arch arm64 --variant v8 docker manifest push --purge ${MANIFESTIMAGE}:latest docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG} + docker manifest push --purge ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} done docker tag ${IMAGE}:amd64-${META_TAG} ${GITHUBIMAGE}:amd64-${META_TAG} docker tag ${IMAGE}:arm32v7-${META_TAG} ${GITHUBIMAGE}:arm32v7-${META_TAG} @@ -616,6 +632,10 @@ pipeline { docker tag ${GITHUBIMAGE}:amd64-${META_TAG} ${GITHUBIMAGE}:${META_TAG} docker tag ${GITHUBIMAGE}:arm32v7-${META_TAG} ${GITHUBIMAGE}:arm32v7-latest docker tag ${GITHUBIMAGE}:arm64v8-${META_TAG} ${GITHUBIMAGE}:arm64v8-latest + docker tag ${GITHUBIMAGE}:amd64-${META_TAG} ${GITHUBIMAGE}:amd64-${EXT_RELEASE_TAG} + docker tag ${GITHUBIMAGE}:amd64-${META_TAG} ${GITHUBIMAGE}:${EXT_RELEASE_TAG} + docker tag ${GITHUBIMAGE}:arm32v7-${META_TAG} ${GITHUBIMAGE}:arm32v7-${EXT_RELEASE_TAG} + docker tag ${GITHUBIMAGE}:arm64v8-${META_TAG} ${GITHUBIMAGE}:arm64v8-${EXT_RELEASE_TAG} docker push ${GITHUBIMAGE}:amd64-${META_TAG} docker push ${GITHUBIMAGE}:arm32v7-${META_TAG} docker push ${GITHUBIMAGE}:arm64v8-${META_TAG} @@ -623,6 +643,10 @@ pipeline { docker push ${GITHUBIMAGE}:${META_TAG} docker push ${GITHUBIMAGE}:arm32v7-latest docker push ${GITHUBIMAGE}:arm64v8-latest + docker push ${GITHUBIMAGE}:${EXT_RELEASE_TAG} + docker push ${GITHUBIMAGE}:amd64-${EXT_RELEASE_TAG} + docker push ${GITHUBIMAGE}:arm32v7-${EXT_RELEASE_TAG} + docker push ${GITHUBIMAGE}:arm64v8-${EXT_RELEASE_TAG} ''' } sh '''#! /bin/bash @@ -691,7 +715,7 @@ pipeline { set -e TEMPDIR=$(mktemp -d) docker pull linuxserver/jenkins-builder:latest - docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest + docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest docker pull lsiodev/readme-sync docker run --rm=true \ -e DOCKERHUB_USERNAME=$DOCKERUSER \ diff --git a/README.md b/README.md index 04a6ead..c61f960 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + + [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io) [![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!") @@ -33,7 +36,6 @@ Find us at: [![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/wireguard.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/linuxserver/wireguard) [![Docker Stars](https://img.shields.io/docker/stars/linuxserver/wireguard.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/linuxserver/wireguard) [![Jenkins Build](https://img.shields.io/jenkins/build?labelColor=555555&logoColor=ffffff&style=for-the-badge&jobUrl=https%3A%2F%2Fci.linuxserver.io%2Fjob%2FDocker-Pipeline-Builders%2Fjob%2Fdocker-wireguard%2Fjob%2Fmaster%2F&logo=jenkins)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-wireguard/job/master/) -[![LSIO CI](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=CI&query=CI&url=https%3A%2F%2Flsio-ci.ams3.digitaloceanspaces.com%2Flinuxserver%2Fwireguard%2Flatest%2Fci-status.yml)](https://lsio-ci.ams3.digitaloceanspaces.com/linuxserver/wireguard/latest/index.html) [WireGuard®](https://www.wireguard.com/) is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. Initially released for the Linux kernel, it is now cross-platform (Windows, macOS, BSD, iOS, Android) and widely deployable. It is currently under heavy development, but already it might be regarded as the most secure, easiest to use, and simplest VPN solution in the industry. @@ -58,35 +60,11 @@ The architectures supported by this image are: Here are some example snippets to help you get started creating a container. -### docker - -``` -docker create \ - --name=wireguard \ - --cap-add=NET_ADMIN \ - --cap-add=SYS_MODULE \ - -e PUID=1000 \ - -e PGID=1000 \ - -e TZ=Europe/London \ - -e SERVERURL=wireguard.domain.com `#optional` \ - -e SERVERPORT=51820 `#optional` \ - -e PEERS=1 `#optional` \ - -e PEERDNS=auto `#optional` \ - -e INTERNAL_SUBNET=10.13.13.0 `#optional` \ - -p 51820:51820/udp \ - -v /path/to/appdata/config:/config \ - -v /lib/modules:/lib/modules \ - --sysctl="net.ipv4.conf.all.src_valid_mark=1" \ - --restart unless-stopped \ - linuxserver/wireguard -``` - - -### docker-compose +### docker-compose ([recommended](https://docs.linuxserver.io/general/docker-compose)) Compatible with docker-compose v2 schemas. -``` +```yaml --- version: "2.1" services: @@ -115,6 +93,30 @@ services: restart: unless-stopped ``` +### docker cli + +``` +docker run -d \ + --name=wireguard \ + --cap-add=NET_ADMIN \ + --cap-add=SYS_MODULE \ + -e PUID=1000 \ + -e PGID=1000 \ + -e TZ=Europe/London \ + -e SERVERURL=wireguard.domain.com `#optional` \ + -e SERVERPORT=51820 `#optional` \ + -e PEERS=1 `#optional` \ + -e PEERDNS=auto `#optional` \ + -e INTERNAL_SUBNET=10.13.13.0 `#optional` \ + -p 51820:51820/udp \ + -v /path/to/appdata/config:/config \ + -v /lib/modules:/lib/modules \ + --sysctl="net.ipv4.conf.all.src_valid_mark=1" \ + --restart unless-stopped \ + linuxserver/wireguard +``` + + ## Parameters Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container. @@ -199,11 +201,26 @@ This is not a Wireguard specific issue and the two generally accepted solutions Both of these approaches have positives and negatives however their setup is out of scope for this document as everyone's network layout and equipment will be different. +## Maintaining local access to attached services + +** Note: This is not a supported configuration by Linuxserver.io - use at your own risk. + +When routing via Wireguard from another container using the `service` option in docker, you might lose access to the containers webUI locally. To avoid this, exclude the docker subnet from being routed via Wireguard by modifying your `wg0.conf` like so (modifying the subnets as you require): + + ``` + [Interface] + PrivateKey = + Address = 9.8.7.6/32 + DNS = 8.8.8.8 + PostUp = DROUTE=$(ip route | grep default | awk '{print $3}'); HOMENET=192.168.0.0/16; HOMENET2=10.0.0.0/8; HOMENET3=172.16.0.0/12; ip route add $HOMENET3 via $DROUTE;ip route add $HOMENET2 via $DROUTE; ip route add $HOMENET via $DROUTE;iptables -I OUTPUT -d $HOMENET -j ACCEPT;iptables -A OUTPUT -d $HOMENET2 -j ACCEPT; iptables -A OUTPUT -d $HOMENET3 -j ACCEPT; iptables -A OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT + PreDown = HOMENET=192.168.0.0/16; HOMENET2=10.0.0.0/8; HOMENET3=172.16.0.0/12; ip route del $HOMENET3 via $DROUTE;ip route del $HOMENET2 via $DROUTE; ip route del $HOMENET via $DROUTE; iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT; iptables -D OUTPUT -d $HOMENET -j ACCEPT; iptables -D OUTPUT -d $HOMENET2 -j ACCEPT; iptables -D OUTPUT -d $HOMENET3 -j ACCEPT + ``` + ## Docker Mods -[![Docker Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=mods&query=%24.mods%5B%27wireguard%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=wireguard "view available mods for this container.") +[![Docker Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=wireguard&query=%24.mods%5B%27wireguard%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=wireguard "view available mods for this container.") [![Docker Universal Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=universal&query=%24.mods%5B%27universal%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=universal "view available universal mods.") -We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to enable additional functionality within the containers. The list of Mods available for this image (if any) can be accessed via the dynamic badge above. +We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to enable additional functionality within the containers. The list of Mods available for this image (if any) as well as universal mods that can be applied to any one of our images can be accessed via the dynamic badges above. ## Support Info @@ -221,14 +238,6 @@ Most of our images are static, versioned, and require an image update and contai Below are the instructions for updating containers: -### Via Docker Run/Create -* Update the image: `docker pull linuxserver/wireguard` -* Stop the running container: `docker stop wireguard` -* Delete the container: `docker rm wireguard` -* Recreate a new container with the same docker create parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved) -* Start the new container: `docker start wireguard` -* You can also remove the old dangling images: `docker image prune` - ### Via Docker Compose * Update all images: `docker-compose pull` * or update a single image: `docker-compose pull wireguard` @@ -236,7 +245,14 @@ Below are the instructions for updating containers: * or update a single container: `docker-compose up -d wireguard` * You can also remove the old dangling images: `docker image prune` -### Via Watchtower auto-updater (especially useful if you don't remember the original parameters) +### Via Docker Run +* Update the image: `docker pull linuxserver/wireguard` +* Stop the running container: `docker stop wireguard` +* Delete the container: `docker rm wireguard` +* Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved) +* You can also remove the old dangling images: `docker image prune` + +### Via Watchtower auto-updater (only use if you don't remember the original parameters) * Pull the latest image at its tag and replace it with the same env variables in one run: ``` docker run --rm \ @@ -244,11 +260,13 @@ Below are the instructions for updating containers: containrrr/watchtower \ --run-once wireguard ``` - -**Note:** We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using Docker Compose. - * You can also remove the old dangling images: `docker image prune` +**Note:** We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using [Docker Compose](https://docs.linuxserver.io/general/docker-compose). + +### Image Update Notifications - Diun (Docker Image Update Notifier) +* We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported. + ## Building locally If you want to make local modifications to these images for development purposes or just to customize the logic: @@ -270,6 +288,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **27.09.20:** - Cleaning service binding example to have accurate PreDown script. * **06.08.20:** - Replace resolvconf with openresolv due to dns issues when a client based on this image is connected to a server also based on this image. Add IPv6 info to readme. Display kernel version in logs. * **29.07.20:** - Update Coredns config to detect dns loops (existing users need to delete `/config/coredns/Corefile` and restart). * **27.07.20:** - Update Coredns config to prevent issues with non-user-defined bridge networks (existing users need to delete `/config/coredns/Corefile` and restart). diff --git a/package_versions.txt b/package_versions.txt index 63302e5..0f45b6a 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -1,14 +1,14 @@ adduser3.116ubuntu1 apt1.6.12ubuntu0.1 apt-utils1.6.12ubuntu0.1 -base-files10.1ubuntu2.9 +base-files10.1ubuntu2.10 base-passwd3.5.44 bash4.4.18-2ubuntu1.2 bc1.07.1-2 binutils2.30-21ubuntu1~18.04.4 binutils-common2.30-21ubuntu1~18.04.4 binutils-x86-64-linux-gnu2.30-21ubuntu1~18.04.4 -bsdutils1:2.31.1-0.4ubuntu3.6 +bsdutils1:2.31.1-0.4ubuntu3.7 build-essential12.4ubuntu1 bzip21.0.6-8.1ubuntu0.2 ca-certificates20190110~18.04.1 @@ -20,12 +20,12 @@ dash0.5.8-2.10 debconf1.5.66ubuntu1 debianutils4.8.4 diffutils1:3.6-1 -dirmngr2.2.4-1ubuntu1.2 +dirmngr2.2.4-1ubuntu1.3 dkms2.3-3ubuntu9.7 dpkg1.19.0.5ubuntu2.3 dpkg-dev1.19.0.5ubuntu2.3 e2fsprogs1.44.1-1ubuntu1.3 -fdisk2.31.1-0.4ubuntu3.6 +fdisk2.31.1-0.4ubuntu3.7 findutils4.6.0+git+20170828-2 g++4:7.4.0-1ubuntu2.3 g++-77.5.0-3ubuntu1~18.04 @@ -35,16 +35,16 @@ gcc-7-base7.5.0-3ubuntu1~18.04 gcc-8-base8.4.0-1ubuntu1~18.04 git1:2.17.1-1ubuntu0.7 git-man1:2.17.1-1ubuntu0.7 -gnupg2.2.4-1ubuntu1.2 -gnupg-l10n2.2.4-1ubuntu1.2 -gnupg-utils2.2.4-1ubuntu1.2 -gpg2.2.4-1ubuntu1.2 -gpg-agent2.2.4-1ubuntu1.2 -gpgconf2.2.4-1ubuntu1.2 -gpgsm2.2.4-1ubuntu1.2 -gpgv2.2.4-1ubuntu1.2 -gpg-wks-client2.2.4-1ubuntu1.2 -gpg-wks-server2.2.4-1ubuntu1.2 +gnupg2.2.4-1ubuntu1.3 +gnupg-l10n2.2.4-1ubuntu1.3 +gnupg-utils2.2.4-1ubuntu1.3 +gpg2.2.4-1ubuntu1.3 +gpg-agent2.2.4-1ubuntu1.3 +gpgconf2.2.4-1ubuntu1.3 +gpgsm2.2.4-1ubuntu1.3 +gpgv2.2.4-1ubuntu1.3 +gpg-wks-client2.2.4-1ubuntu1.3 +gpg-wks-server2.2.4-1ubuntu1.3 grep3.1-2build1 gzip1.6-5ubuntu1 hostname3.20 @@ -67,7 +67,7 @@ libattr11:2.4.47-2build1 libaudit11:2.8.2-1ubuntu1 libaudit-common1:2.8.2-1ubuntu1 libbinutils2.30-21ubuntu1~18.04.4 -libblkid12.31.1-0.4ubuntu3.6 +libblkid12.31.1-0.4ubuntu3.7 libbz2-1.01.0.6-8.1ubuntu0.2 libc62.27-3ubuntu1.2 libc6-dev2.27-3ubuntu1.2 @@ -88,7 +88,7 @@ libelf-dev0.170-0.4ubuntu0.1 liberror-perl0.17025-1 libexpat12.2.5-3ubuntu0.2 libext2fs21.44.1-1ubuntu1.3 -libfdisk12.31.1-0.4ubuntu3.6 +libfdisk12.31.1-0.4ubuntu3.7 libffi63.2.1-8 libgcc11:8.4.0-1ubuntu1~18.04 libgcc-7-dev7.5.0-3ubuntu1~18.04 @@ -128,7 +128,7 @@ liblsan08.4.0-1ubuntu1~18.04 liblz4-10.0~r131-2ubuntu3 liblzma55.2.2-1.3 libmnl01.0.4-2 -libmount12.31.1-0.4ubuntu3.6 +libmount12.31.1-0.4ubuntu3.7 libmpc31.1.0-1 libmpfr64.0.1-1 libmpx28.4.0-1ubuntu1~18.04 @@ -141,10 +141,10 @@ libnghttp2-141.30.0-1ubuntu1 libnpth01.5-3 libonig46.7.0-1 libp11-kit00.23.9-2 -libpam0g1.1.8-3.6ubuntu2.18.04.1 -libpam-modules1.1.8-3.6ubuntu2.18.04.1 -libpam-modules-bin1.1.8-3.6ubuntu2.18.04.1 -libpam-runtime1.1.8-3.6ubuntu2.18.04.1 +libpam0g1.1.8-3.6ubuntu2.18.04.2 +libpam-modules1.1.8-3.6ubuntu2.18.04.2 +libpam-modules-bin1.1.8-3.6ubuntu2.18.04.2 +libpam-runtime1.1.8-3.6ubuntu2.18.04.2 libpcre32:8.39-9 libperl5.265.26.1-6ubuntu0.3 libpng16-161.6.34-1ubuntu0.18.04.2 @@ -163,7 +163,7 @@ libselinux12.7-2build2 libsemanage12.7-2build2 libsemanage-common2.7-2build2 libsepol12.7-1 -libsmartcols12.31.1-0.4ubuntu3.6 +libsmartcols12.31.1-0.4ubuntu3.7 libsqlite3-03.22.0-1ubuntu0.4 libss21.44.1-1ubuntu1.3 libssl1.11.1.1-1ubuntu2.1~18.04.6 @@ -176,17 +176,17 @@ libtsan08.4.0-1ubuntu1~18.04 libubsan07.5.0-3ubuntu1~18.04 libudev1237-3ubuntu10.42 libunistring20.9.9-0ubuntu2 -libuuid12.31.1-0.4ubuntu3.6 +libuuid12.31.1-0.4ubuntu3.7 libwind0-heimdal7.5.0+dfsg-1 libxtables121.6.1-2ubuntu2 libzstd11.3.3+dfsg-2ubuntu1.1 -linux-libc-dev4.15.0-112.113 +linux-libc-dev4.15.0-118.119 locales2.27-3ubuntu1.2 login1:4.5-1ubuntu2 lsb-base9.20170808ubuntu1 make4.1-9.1ubuntu1 mawk1.3.3-17ubuntu3 -mount2.31.1-0.4ubuntu3.6 +mount2.31.1-0.4ubuntu3.7 multiarch-support2.27-3ubuntu1.2 ncurses-base6.1-1ubuntu1.18.04 ncurses-bin6.1-1ubuntu1.18.04 @@ -209,7 +209,7 @@ sysvinit-utils2.88dsf-59.10ubuntu1 tar1.29b-2ubuntu0.1 tzdata2020a-0ubuntu0.18.04 ubuntu-keyring2018.09.18.1~18.04.0 -util-linux2.31.1-0.4ubuntu3.6 +util-linux2.31.1-0.4ubuntu3.7 xz-utils5.2.2-1.3 zlib1g1:1.2.11.dfsg-0ubuntu2 zlib1g-dev1:1.2.11.dfsg-0ubuntu2 diff --git a/readme-vars.yml b/readme-vars.yml index dc930f4..181cfd3 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -85,10 +85,26 @@ app_setup_block: | This is not a Wireguard specific issue and the two generally accepted solutions are NAT reflection (setting your edge router/firewall up in such a way as it translates internal packets correctly) or split horizon DNS (setting your internal DNS to return the private rather than public IP when connecting locally). Both of these approaches have positives and negatives however their setup is out of scope for this document as everyone's network layout and equipment will be different. + + ## Maintaining local access to attached services + + ** Note: This is not a supported configuration by Linuxserver.io - use at your own risk. + + When routing via Wireguard from another container using the `service` option in docker, you might lose access to the containers webUI locally. To avoid this, exclude the docker subnet from being routed via Wireguard by modifying your `wg0.conf` like so (modifying the subnets as you require): + + ``` + [Interface] + PrivateKey = + Address = 9.8.7.6/32 + DNS = 8.8.8.8 + PostUp = DROUTE=$(ip route | grep default | awk '{print $3}'); HOMENET=192.168.0.0/16; HOMENET2=10.0.0.0/8; HOMENET3=172.16.0.0/12; ip route add $HOMENET3 via $DROUTE;ip route add $HOMENET2 via $DROUTE; ip route add $HOMENET via $DROUTE;iptables -I OUTPUT -d $HOMENET -j ACCEPT;iptables -A OUTPUT -d $HOMENET2 -j ACCEPT; iptables -A OUTPUT -d $HOMENET3 -j ACCEPT; iptables -A OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT + PreDown = HOMENET=192.168.0.0/16; HOMENET2=10.0.0.0/8; HOMENET3=172.16.0.0/12; ip route del $HOMENET3 via $DROUTE;ip route del $HOMENET2 via $DROUTE; ip route del $HOMENET via $DROUTE; iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT; iptables -D OUTPUT -d $HOMENET -j ACCEPT; iptables -D OUTPUT -d $HOMENET2 -j ACCEPT; iptables -D OUTPUT -d $HOMENET3 -j ACCEPT + ``` # changelog changelogs: - - { date: "19.08.20:", desc: "Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart" } + - { date: "04.10.20:", desc: "Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart" } + - { date: "27.09.20:", desc: "Cleaning service binding example to have accurate PreDown script." } - { date: "06.08.20:", desc: "Replace resolvconf with openresolv due to dns issues when a client based on this image is connected to a server also based on this image. Add IPv6 info to readme. Display kernel version in logs." } - { date: "29.07.20:", desc: "Update Coredns config to detect dns loops (existing users need to delete `/config/coredns/Corefile` and restart)." } - { date: "27.07.20:", desc: "Update Coredns config to prevent issues with non-user-defined bridge networks (existing users need to delete `/config/coredns/Corefile` and restart)." }