Skip to content
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

Template peer info appended to the server config #345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nonk123
Copy link

@nonk123 nonk123 commented Jul 12, 2024

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

[Peer] blocks inside wg0.conf used to be hardcoded. But there are very specific usecases where this might not be desirable. So, these blocks are now templated.

Benefits of this PR and context:

Closes #335.

How Has This Been Tested?

Running this command produced equivalent configuration files before and after the changes made, except the friendly_name = line:

docker run -d \
  --name=wireguard \
  --cap-add=NET_ADMIN \
  --cap-add=SYS_MODULE \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Moscow \
  -e SERVERPORT=51820 \
  -e PEERS=TheA,TheB,TheC \
  -e INTERNAL_SUBNET=10.13.13.0 `#optional` \
  -e ALLOWEDIPS=0.0.0.0/0 `#optional` \
  -e PERSISTENTKEEPALIVE_PEERS=TheC \
  -e LOG_CONFS=true `#optional` \
  -p 51820:51820/udp \
  -v wg-thing:/config \
  -v /lib/modules:/lib/modules `#optional` \
  --sysctl="net.ipv4.conf.all.src_valid_mark=1" \
  --restart unless-stopped \
  lscr.io/linuxserver/wireguard:latest

Here's a diff with some dummy keys:

4c4
< PrivateKey = SKO8MxSnzOCPiNoq/HIvyATfnksEINWKXk4IC4Kp3mk=
---
> PrivateKey = iIh6dFt4IJ3DwKp8GvZh2+DUWwUWp2IJD/sYAART/ks=
9,11c9,11
< # peer_TheA
< PublicKey = dS3HgHgvrFmjKlPlcB8juERrTHu2WlL5kSipLODgaDk=
< PresharedKey = zRC7UcvqIWIIsVchmtsSAYC4Qa1G+OPLXdBMHUUulS0=
---
> # friendly_name = peer_TheA
> PublicKey = 3+zJGVJp+Pmtw5aKXg5hH00X79vmV7FV7yoioB3mvE0=
> PresharedKey = OeE/fo4SI4KYwrSATVDViba50If7t635aZFcTeCWBMk=
15,17c15,17
< # peer_TheB
< PublicKey = mUEENNG9zXmq8RO4qdHkcbkO0h2mSYT1ewbyOebQVgQ=
< PresharedKey = svDHI0L1NpVYwrpsNguxJW0+bqNzXFMCp/fCd6QBD2s=
---
> # friendly_name = peer_TheB
> PublicKey = B13Es6dp2QtcNlUi5yxKZQHCkl7n0rMzgosBKCKyBXE=
> PresharedKey = mOrHbrB4NdoOjgZIxXy/UmwBhtK1kfen6lXdIesJgSk=
21,23c21,23
< # peer_TheC
< PublicKey = NgrQMdiotUWc3KP9xgTHur8KEoCvILTq0mIO78e8fkA=
< PresharedKey = /a7lxaQFOGiI+sC72dIghwHsSAfpCdc/btTweM6LK20=
---
> # friendly_name = peer_TheC
> PublicKey = 5SF4exknx+na5gPpGf9KAkgVy806npfRmKob9eg4wBE=
> PresharedKey = yDoiF2IVwCZRMNqQcudjDw2nwdKfKMRjrsM1qdlwczE=

Source / References:

See: #335.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-wireguard:1.0.20210914-r4-pkg-3d758f73-dev-ed2bf04cf979160318638a83d3f494d50a2ba497-pr-345

@Pingachguk
Copy link

русские есть?

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-wireguard:1.0.20210914-r4-pkg-256aa340-dev-bc415a4d17c4e39620762696e92607229549f15e-pr-345

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-wireguard:1.0.20210914-r4-pkg-4ea10a38-dev-1c6786aa6ab32c36f91a41606ba6cff1f75ad7c1-pr-345

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-wireguard:1.0.20210914-r4-pkg-5cdc355d-dev-9af07c2a1c620be62196b43bcc5b1c00082f3f55-pr-345

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-wireguard:1.0.20210914-r4-pkg-17ab2ff8-dev-f305a6f7ea6069438a86c834f8853b4e5b7d43d8-pr-345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

[FEAT] [Peer] definition within generated wg0.conf should be templated
3 participants