92 Commits

Author SHA1 Message Date
Paul Donald
ec799109e5 luci-proto-wireguard: add download link for peer config
Ease download of the generated config.

Closes #8389

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-05 16:09:43 +01:00
Paul Donald
50a8d5325d luci-base: js linting fixes / ES6 treatment
prevent global variable bleed and reduce size somewhat

-cbi
-network
-protocol/static
-rpc
-tools/widgets
-tools/views
-uci

protocols

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 01:42:57 +01:00
Paul Donald
b8c049a1ed luci-proto-wireguard: fix i18n compile error
Message contains an embedded URL.
Better move it out of the translatable string

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-03 06:59:25 +01:00
Paul Donald
f52d047e2f luci-proto-wireguard: Display times which account for the timezone also
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-10-28 20:50:51 +01:00
Paul Donald
80a0abb54f luci-proto-wireguard: Hide the QR code parent dialogue button row via styling
Previously, the render code attempted to add the class "hidden" to the button
row, the button row which can have a persistent visibility style applied via CSS
so the "hidden" class attribute was overridden. Set the style.display of the row
instead which now hides the button row.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-10-28 17:36:53 +01:00
Jan Pazdziora
2604b5532f luci-proto-wireguard: Add the option for setting ip6prefix.
Signed-off-by: Jan Pazdziora <jan.pazdziora@code.adelton.com>
2025-06-16 13:24:57 +02:00
Paul Donald
fa6ca8a618 treewide: vectorise iconography
follow-up to ae5d91da90

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-14 00:13:52 +02:00
Paul Donald
85fde70cd2 treewide: vectorise iconography
follow-up to ae5d91da90

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-13 15:55:41 +02:00
Paul Donald
ae5d91da90 treewide: vectorise iconography
Clear, crisp, resolution independent vector graphics replace the trusty
microscopic PNG. Some minor CSS changes were needed to constrain images
in some locations to make sure they don't consume too much space.

Iconography taken from Mate desktop theme with minor adjustments:

https://github.com/mate-desktop/mate-icon-theme/

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-12 18:55:53 +02:00
this-username-has-been-taken
8bff54dc47 luci-proto-wireguard: fixed incorrect peer name detection
Added the legacy peer name detection algorithm. If the new algorithm
fails to find a peer's name (e.g. when the IP address has been changed)
then the legacy value will be used.

Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
2025-04-13 16:17:02 +02:00
Paul Donald
4207c2c5d5 luci-proto-wireguard: add extra checks for hostname when building qr
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-03-26 22:41:23 +01:00
Paul Donald
fec079db36 luci-base, luci-proto-wireguard: grammar fix
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-01-13 17:57:42 +01:00
Paul Donald
b4e1052331 luci-proto-wireguard: disambiguate fwmark description
fwmark is used internally during firewall processing, and no mark
remains on egress. Yes, the fwmark is to identify egress encrypted
packets, but no egress packet itself contains this value, and
this metadata disappears once the packet leaves the firewall.

The current wording is ambiguous, since "for" does a lot of lifting.

"during" helps limit the scope of this definition.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-12-18 15:03:54 +00:00
Paul Donald
8d13ea410d luci-base, luci-proto-*: rename getOpkgPackage -> getPackageName
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-12-15 20:13:56 +01:00
Tom Haley
461d632d5c luci-proto-wireguard: fixed incorrect peer detection for ipv6 and default port
Fixed incorrect peer detection if IP v6 is used and no port for peer is defined.

Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
2024-12-05 18:09:39 +01:00
Tom Haley
27ecfdaafe luci-proto-wireguard: fixed incorrect peer detection if port is not set
Fixed incorrect peer detection if port is not set (default port is used)

Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
2024-12-05 18:09:39 +01:00
Tom Haley
101ea169c6 luci-proto-wireguard: fixed a vulnerability in the checkPeerHost method
shellquote method is introduced so an injected code cannot be executed by the popen command.

Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
2024-12-05 18:09:39 +01:00
Tom Haley
5c97a89684 luci-proto-wireguard: Fix incorrect peer detection for IP v6
This commit fixes incorrect peer detection when using IP v6 by deleting all the square the square brackets from the wgHost variable.

Signed-off-by: Tom Haley <this_username_has_been_taken2@proton.me>
2024-12-02 18:22:15 +01:00
Paul Donald
f1b302d49b luci-proto-wireguard: make peer entries sortable
Closes #7354

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-10-25 21:41:33 +02:00
Paul Donald
760ac165fa luci-proto-wireguard: follow-up fix for status overview
follow-up to 7acea81873

Closes #7347

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-10-24 20:34:43 +02:00
this-username-has-been-taken
7acea81873 luci-proto-wireguard: fixed bug with incorrect peer name detection
Fixed bug with incorrect peer name detection on `Status -> WireGuard`
page when more than one peer with the same public key exist:
1. Peers are now tested not only by public key, but also by
enabled/disabled status, peer host (both IP and FQDN are supported)
and port.
2. Added required `resolveip` dependency.

Closes #7342

Signed-off-by: @this-username-has-been-taken
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-10-23 22:25:27 +02:00
Bryan Roessler
071fc1bc92 luci-proto-wireguard: disable peers from the tab
It's clumsy to enable/disable peers from the modal, save some clicks

Signed-off-by: Bryan Roessler <bryanroessler@gmail.com>
2024-07-15 22:49:32 +02:00
Paul Donald
74f366a1e5 luci-proto-wireguard: adapt to use uqr
If for some reason luci-lib-uqr is absent, the GUI shows that the proto
handler needs installing (since it now has a dep which is missing).

Suitable action is to install the lib or remove/install wireguard again.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-06-27 20:19:58 +02:00
Sergey Ponomarev
fbbfdb4afc treewide: Add missing PKG_MAINTAINER
Daniel F. Dickinson changed email address to <dfdpublic@wildtechgarden.ca>

luci-all-lxl has a maintainer Petar Koretic <petar.koretic@sartura.hr> but there is no corresponding GitHub account.
So Dirk Brenken was added as a second maintainer: he answered on an issue of the app.

When maintainer wasn't set the initial author was used, or most contributor or Jo-Philipp Wich as a default.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-05-28 01:55:14 +02:00
Hannu Nyman
1ba94f2ed5 luci-proto-{wireguard,yggdrasil}: remove unnecessary PROVIDES
Remove the unnecessary PROVIDES statements from two protocols.

Wireguard was recently changed erroneously: the old compatibility
reference to luci-app-wireguard was replaced by self-reference.
But as the app and proto were combined already in 2022, the old
compatibility define should be unnecessary by now, so just remove it.

Yggdrasil has had a similar unnecessary setting (package
PROVIDES itself), so remove that at the same time.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2024-04-25 20:08:37 +03:00
Paul Donald
f5f2323e80 luci-proto-wireguard: fix Makefile 'provides'
once-upon-a-time it was called luci-app-wireguard. Now it's proto.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-04-23 00:21:17 +02:00
Florian Eckert
20197f4911 luci-proto-wireguard: add missing license information
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-19 13:22:36 +01:00
Jo-Philipp Wich
e28f9a0491 luci-proto-wireguard: fix broken DNS option in peer config generator
The config generation code was referencing a not existing `dns_servers`
input field.

Fixes: #6921
Fixes: 5b26887c52 ("Adding a DNS option to the wireguard peer config ...")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2024-02-16 16:17:26 +01:00
Nicholaos Mouzourakis
5b26887c52 Adding a DNS option to the wireguard peer config generator.
Some clients like iOS require this explicitly, and so this change
adds the appropriate config with some sensible defaults.

Closes #6351

Signed-off-by: Nicholaos Mouzourakis <nevumx@gmail.com>
Signed-off-by: Paul Donald <newtwen@gmail.com>
Tested-by: Paul Donald <newtwen@gmail.com>
(cherry picked from commit 990696d73f982de015df7c7d552daef1a03f50c5)
2023-12-05 00:08:33 +01:00
Paul Donald
a5786b5f2f luci-proto-wireguard: Remove confirmation dialogue to generate keys (#6697)
Quality of life improvements. Reduce click amounts.
LuCI batches all changes for user-review anyway.

Tested on 23.05.0

Signed-off-by: Paul Donald <newtwen@gmail.com>
2023-12-04 22:00:35 +01:00
Nicholaos Mouzourakis
3bc0be4a00 Adding an Addresses option to the wireguard peer config generator.
Some clients like iOS require this explicitly, and so this change
adds the appropriate config with some sensible defaults.
Addresses issue #6050
Signed-off-by: Nicholaos Mouzourakis <nevumx@gmail.com>
2023-10-21 22:42:58 -04:00
Jonathan Duncan
527453ff48 luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config
Signed-off-by: Jonathan Duncan <JonathanDuncan@gmail.com>
2023-09-24 16:16:35 +01:00
Paul Dee
992cca55ae luci-proto-wireguard: grammar fixes
To setup (n) -> To set(v) up

Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
2023-08-11 13:21:45 +02:00
Jo-Philipp Wich
59a6f062d2 luci-proto-wireguard: use ddns lookup_host for peer hints
The `domain` option of a DDNS service entry may contain non-hostname values,
use the `lookup_hostname` option instead.

Fixes: #6289
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-03-14 23:36:39 +01:00
Jo-Philipp Wich
785792a591 luci-proto-wireguard: fix configuration import
Avoid referencing not existing `peerdns` option during the configuration
file import process.

Fixes: #6136
Fixes: 2be01cbfcb ("luci-mod-network: restrict peerdns option to protocols that implemenent it")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-12-05 10:34:51 +01:00
Jo-Philipp Wich
22c51acf81 luci-proto-wireguard: fix loading peer descriptions
Explicitly load `network` uci in wireguard rpcd backend as `ctx.foreach()`
does not implicitly load it.

Also remove leftover test setup information from the status page source.

Fixes: #6095
Fixes: 008fa18878 ("luci-proto-wireguard: rewrite rpcd handler in ucode")
Fixes: 6e6fce3eb4 ("luci-proto-wireguard: merge status page functionality")
Ref: https://github.com/jow-/ucode/pull/126
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-23 13:20:42 +01:00
Jo-Philipp Wich
6e6fce3eb4 luci-proto-wireguard: merge status page functionality
Merge status page functionality from the separate `luci-app-wireguard`
package into the `luci-proto-wirguard` protocol backend.

Also rewrite the status page markup to be more compact while we're at it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-22 10:56:36 +01:00
Julien Cassette
73aca68b9e luci-proto-wireguard: fix generated AllowedIPs
This corrects the option `AllowedIPs` in generated peer configurations,
and allows to customize it via a dropdown list.

Fixes: #5956
Signed-off-by: Julien Cassette <julien.cassette@gmail.com>
[correct fixes tag, slightly adjust option description]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-09 21:00:56 +01:00
Jo-Philipp Wich
008fa18878 luci-proto-wireguard: rewrite rpcd handler in ucode
Rewrite the wireguard rpcd plugin in ucode to prevent an implicit dependency
on the LuCI Lua runtime.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25 01:03:37 +02:00
Jo-Philipp Wich
94bfa33452 luci-proto-wireguard: handle multiple peers in imported configuration
When importing a fully configuration, import all peer entries from it
instead of non-deterministically merging all peer keys into one.

When importing a remote configuration as peer, only use the setting from
the peer section matching our local interface pubkey.

Also relabel the `Import peer configuration` button to
`Import configuration as peer` in order to be more explicit.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-01 13:00:31 +02:00
Jo-Philipp Wich
2ae74b909b luci-proto-wireguard: configuration import improvements
- Reword texts in import dialogs for better clarity, use different
   descriptions for full import and peer import

 - Allow importing configurations without [Peer] section

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-07-23 20:24:09 +02:00
Jo-Philipp Wich
340183786e luci-proto-wireguard: gracefully deal with missing uci configs
The /etc/config/ddns in particular might not be present on the system,
don't fail if it is absent.

Fixes: #5838
Fixes: 9ba20645b0 ("luci-proto-wireguard: rewrite protocol handler")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-06-21 00:07:48 +02:00
Jo-Philipp Wich
4769bf11aa luci-proto-wireguard: grant uci read access to system and ddns config
The configuration export requires access to /e/c/system and /e/c/ddns for
external hostname hints.

Fixes: #5838
Fixes: 9ba20645b0 ("luci-proto-wireguard: rewrite protocol handler")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-06-20 23:58:07 +02:00
Jo-Philipp Wich
9ba20645b0 luci-proto-wireguard: rewrite protocol handler
This commit rewrites large chunks of the WireGuard protocol handler in order
to simplify the process of importing and exporting configuration. The major
changes are:

1) The wireguard interface configuration tab (General Settings) gained an
   import assistant which allows dragging or pasting a native WireGuard
   configuration file in order to import required settrings into uci

2) The peer configuration tab gained a similar import assistant which allows
   importing the settings for a WireGuard peer from an existing native
   WireGuard configuration file

3) The QR code export feature has been rewritten to make the resulting codes
   actually useful for importing into a WireGuard client application.
   Additionally the plaintext native WireGuard configuration is displayed
   to allow copy-pasting it for use on a Linux or OS X system

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-05-17 15:45:20 +02:00
Florian Eckert
7206d8fd6a luci-proto-wireguard: adjust MTU range from 0-8940
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-04-14 11:59:56 +02:00
Florian Eckert
ddd04a719f luci-proto-wireguard: remove MTU limit
fixes #5737

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-04-12 10:32:25 +02:00
Lukas Voegl
b6925a1227 luci-proto-wireguard: add generate psk button
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
2022-03-18 14:47:44 +01:00
Jo-Philipp Wich
ff4f52983e Merge pull request #5540 from jow-/wireguard-peer-gridsection
Implement nested grid section support and use it for wireguard peer config
2021-12-02 10:54:36 +01:00
Florian Eckert
a1723c2272 Merge pull request #5400 from systemcrash/wg_pubkey
luci-proto-wireguard: display interface public key
2021-11-30 14:10:19 +01:00
Jo-Philipp Wich
f2445a862e luci-proto-wireguard: turn peer configuration into grid view
Turn the list of configured peers into a grid section in order to improve
the overview of the configuration form.

Fixes: #5489
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-11-22 09:43:29 +01:00