Commit Graph

98 Commits

Author SHA1 Message Date
Erik Conijn c82ed82443 openvpn: add missing host routes
Maintainer: Alexandru Ardelean <ardeleanalex@gmail.com>

ping @feckert

First of all big thanks to all involved devs, porting this to proto is not a minor task and besides some small quirks it is working well.
(Not all that happy with the use of a default route instead of /1 routes, because you loose internet if the tunnel goes down but that is just me nitpicking)

However I had problems with default routing as the host routes to the server endpoint were missing.

I tracked it down to code in the `openvpn-hotplug` script and made some changes and in my testing it appears to work now.
As a bonus I also added code for a future implementation of the `nohostroute` option.

Problem:
The host routes were created by just using route setup this however does not work.

Solution:
using `proto_add_host_dependency` seems the better solution.

Furthermore the correct guard for IPv6 seems to be `net_gateway_ipv6` instead of `route_ipv6_gateway` however even the correct guard is only working if ipv6 source routing is disabled on wan6, so perhaps we should consider removing the guard entirely.
For now I left it in place with a warning.

I have tested it on X86 running master build from 5 days ago, both for IPv4 and IPv6

Please have a look and consider implementing.

Thanks

Signed-off-by: Erik Conijn <egc112@msn.com>
2026-05-22 07:11:38 +03:00
Qingfang Deng 5823a0fb6c openvpn: use mbedtls by default
When luci-proto-openvpn is selected in `make menuconfig`,
openvpn-openssl is picked up automatically. As mbedTLS is the default
TLS package, set DEFAULT_VARIANT on openvpn-mbedtls so that it is used
by default.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
2026-05-19 10:04:17 +03:00
Andy Chiang c53d53ff93 openvpn: add kmod-ovpn-backports dependency
With openwrt/openwrt@f7d6e73 and openwrt/packages@974c2be, kmod-ovpn-backports can now be built and run correctly.
add this dependency enables DCO.

Link: openwrt/packages@01fafd69e

Test on: Mediatek Filogic GL-MT3000 (with kmod-crypto-hw-safexcel)

Signed-off-by: Andy Chiang <AndyChiang_git@outlook.com>
2026-05-16 11:04:52 +03:00
Yanase Yuki b0d8a3d384 treewide: cleanup URLs
This commit converts plain HTTP URLs to HTTPS, and updates
old or outdated URLs.

Signed-off-by: Yanase Yuki <dev@zpc.st>
2026-05-08 22:28:27 +02:00
Sander van Deijck 0393b2260c openvpn: disable wolfssl support
WolfSSL support for OpenVPN is currently broken:
https://github.com/wolfSSL/wolfssl/pull/10309

Until a fix is available, disable WolfSSL as variant.
Support can be re-enabled when WolfSSL is updated.

Signed-off-by: Sander van Deijck <sander@vandeijck.com>
2026-05-05 09:02:59 +03:00
Sander van Deijck 3e779d0564 openvpn: update to 2.7.4
Update the OpenVPN package to 2.7.4

For changes, see:
https://github.com/OpenVPN/openvpn/blob/v2.7.4/Changes.rst

Signed-off-by: Sander van Deijck <sander@vandeijck.com>
2026-05-05 09:02:59 +03:00
Chen Minqiang bb02e8b734 openvpn: handler: refine netifd routing and config
Introduce a new `ipv6` proto option for OpenVPN netifd integration and
export it to the hotplug environment. IPv6 remains enabled by default,
but can now be explicitly disabled per instance.

Update the hotplug helper to apply IPv6 addresses and routes only when
IPv6 is enabled, allowing cleaner IPv4-only tunnel deployments.

Also improve route handling by:
- ignoring invalid default gateway values (0.0.0.0 / ::)
- replacing fixed `seq` loops with shell-safe while loops
- keeping trusted peer host routes conditional on valid gateways

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2026-04-17 08:48:33 +02:00
Alexandru Ardelean 8d3c004213 treewide: set me where PKG_MAINTAINER empty
Seems a lot of packages are just getting abandoned by people.
Will pick these up and see them through.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-04-16 21:48:36 +03:00
Florian Eckert 2255c65fa1 openvpn: make the packages dependency clearer
No functional changes, so the PKG_RELEASE version number has not been
incremented.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-04-15 11:08:30 +02:00
Qingfang Deng 9faf26770b openvpn: update to 2.7.1
The new DCO module depends on OpenVPN 2.7.1.
For details refer to https://github.com/OpenVPN/openvpn/blob/v2.7.1/Changes.rst

Removed upstreamed wolfSSL patches:
- 101-Fix-EVP_PKEY_CTX_-compilation-with-wolfSSL.patch
- 102-Disable-external-ec-key-support-when-building-with-wolfSSL.patch

Reworked 100-mbedtls-disable-runtime-version-check.patch to use
MBEDTLS_VERSION_STRING instead of a mutable buffer.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
2026-04-13 19:24:25 +03:00
Chen Minqiang bd524c0a7a openvpn: fix quoting and deprecated option filtering
This patch fixes two issues in the netifd protocol script:

1. Fix logic error in deprecated option filtering:
   Previously, ${f%%:*} was called before checking for the deprecated
   flag (:d). This stripped the suffix and made the check [ "${f#*:}" = "d" ]
   always fail. The cleaning of $f is now deferred until after this check.

2. Improve parameter quoting for specific options:
   - Adds single quotes to --push and --push-remove parameters to handle
     spaces (e.g., "route 10.0.0.0 255.255.255.0").
   - Unifies quoting for 'file' type options to improve shell safety.
   - Refactors the build logic using a case statement for better
     extensibility.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2026-03-27 14:56:22 +01:00
Chen Minqiang cde9e3b668 openvpn: increment PKG_RELEASE by one
Increment PKG_RELEASE by one.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2026-03-21 15:47:47 +02:00
Chen Minqiang 29e74f34d3 openvpn: handle netifd setup in hotplug script
- Process 'up'/'down' events to manage interface status.
- Add IPv4/IPv6 addresses and routes via netifd-proto.
- Parse DNS/search domains from foreign options.
- Convert netmasks and CIDR strings with new helpers.
- Apply MTU settings from OpenVPN environment.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2026-03-21 15:47:47 +02:00
Chen Minqiang bda60d1fc5 openvpn: cleanup and fix netifd proto script logic
- Default to '--ifconfig-noexec' and '--route-noexec' to allow hotplug
  script to handle IP and routing configuration.
- Only append '--auth-user-pass-verify' if the option is explicitly
  configured to avoid unexpected authentication requirements.
- Fix missing retrieval of 'auth_user_pass', 'askpass', and 'tls_verify'.
- Remove redundant '--config' parameter (managed by option_builder).
- Simplify 'script_security' assignment logic.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2026-03-21 15:47:47 +02:00
Sander van Deijck e0ab7d0dfa openvpn: update to 2.6.19
Update the openvpn package to the latest version in
the 2.6.x branch while development of the 2.7.x branch
become stable enough to merge.

Signed-off-by: Sander van Deijck <sander@vandeijck.com>
2026-03-18 12:14:11 +02:00
Hannu Nyman eb85b30011 openvpn: increment PKG_RELEASE by one
Increment PKG_RELEASE by one.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2026-03-15 09:28:52 +02:00
Paul Donald 56453de58c openvpn: change tmp-dir to /tmp
This allows openvpn to create any temp files after
user or group change at exec time.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald ef3ffde899 openvpn: change file/path types
move file and path type values to FILE type params
so they are better handled with quoting, in case
paths contain spaces.

Remove duplicate 'extra_certs'.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald dc8198b960 openvpn: proto handler; write params to config file
writing the command line to a config file avoids
formatting pitfalls for the command line.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald ea5daeae16 openvpn: proto handler; trim white-space from append
'append' inserts white-space by default (3rd parameter)

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald 00471e0dc9 openvpn: shell proto script improvements
add mode server hook scripts hotplug handling

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald 0d39f4ec8b openvpn: ucode hotplug script improvements
add mode server hook scripts hotplug handling

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald 99a24f515a openvpn: hotplug script improvements
add mode server hook scripts hotplug handling

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald c0faf0714d openvpn: ucode proto script improvements
fix the pop() bug
write options to a config file in case argv length > 63

netifd has a hard limit of 64 argv entries for its ucode
proto.run_command whereby '--param' is one, and its
'option string' is two.

follow-up to affa96dc81

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald e8ae8b1a8f openvpn: sync with proto shell-script
add hotplug script handlers to ucode version

follow-up to 647b67e18b

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald ddb20d9880 openvpn: proto handler; handle user config file
Handle a user provided config file.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald 08bc5a7e90 openvpn: shellcheck fixes
correct spacing for [] if blocks and var quoting.
use json_get_vars to get user-defined scripts so the
setenv parameters are appended to the command line.

handle ovpnproto as a PROTO_STRING so it is monitored
and loaded.

follow-up to 337a449c03
and 647b67e18b

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Paul Donald 4ecd407766 openvpn: handling for 'push' and other array options
remove duplicate 'push' entry from string types.
push and other array values shall be "double quoted".
we also must 'eval' so that the double-quoted array values
don't get split on spaces.
Also quote file paths in case they contain spaces.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-15 08:45:36 +02:00
Florian Eckert 19bf94887b openvpn: increment PKG_RELEASE by one
Increment PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert 647b67e18b openvpn: add hotplug handling back in
This commit adds hotplug handling back in.

Fixes: 2607b761 ("openvpn: introduce proto handler")

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert 337a449c03 openvpn: use append for the remaining options
There is already the 'append' command, which assembles all parameters that
are called 'proto_run_command'. Let´s move also the last params to the
top. To ensure that the sequence is correct, the parameters must be added
at the beginning, so that user parameters can overwrite them.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert be20045045 openvpn: use also append for dev_type and ovpnproto options
There is already the 'append' command, which assembles all parameters that
are called 'proto_run_command'. Let´s use that. To ensure that the
sequence is correct, the parameters must be added at the beginning, so that
user parameters can overwrite them.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert f89b656de2 openvpn: use common pattern for global variable
The common pattern for global variable is, to write the variable name in
capital letters. This improves maintainability in shell scripts.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert 9ccb8650fd openvpn: fix auth_user_pass option
The variable 'auth_file' is not used in the following programm sequence.
It therefore only makes sense to add it as a call parameter via 'append'
when calling the the 'proto_run_commmand'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert a5b3ecfbcf openvpn: rename openvpn proto option to ovpnproto option
This was forgotten during renameing of this option.

Fixes: e026ce0f ("openvpn: handle ovpnproto exclusively")

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert 54eae83c95 openvpn: remove net needed blank lines
There is always only one blank line between the sections.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-11 14:22:41 +01:00
Florian Eckert 803e8ae3f7 openvpn: increment PKG_RELEASE by one
Increment PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Florian Eckert 8816657223 openvpn: move usr/share/openvpn files into its own dir
By moving the file to a subdirectory, it is easier to track where the file
is located on the target without having to check the Makefile every time.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Florian Eckert 310c097378 openvpn: move lib/upgrade/keep.d file into its own dir
By moving the file to a subdirectory, it is easier to track where the file
is located on the target without having to check the Makefile every time.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Florian Eckert f1c2f51fc8 openvpn: improve readability for files install target
Each script to be installed is moved to its own line to improve readability.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Florian Eckert 9d2de51e06 openvpn: remove not needed INSTALL_DIR creations
This 'INSTALL_DIR' creation are not needed anymore after refactoring.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Florian Eckert 27df3c8341 openvpn: refactoring INSTALL_DIR command call during install
Move the 'INSTALL_DIR' creation in the make install target to the location
where the files are also installed. This prevents directories that are no
longer needed from being forgotten during refactoring.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-03-05 07:54:01 +01:00
Paul Donald e026ce0f01 openvpn: handle ovpnproto exclusively
Since proto was migrated to ovpnproto to avoid collision
with netifd proto, this shall be handled separately.

Also avoid using uci commands to migrate the config which
requires knowing property types; use awk instead.

follow-up to 2607b76154

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-03 17:23:53 +02:00
Paul Donald 6b054c6cef openvpn: drop unused eurephia
This plugin has not seen updates to keep it synchronised
with recent openvpn, nor any updates in the last several
years. It relies on the SHA1 algo which is deprecated,
and iptables. ovpn has its own management interface.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
https://github.com/openwrt/packages/pull/28533
2026-02-22 11:54:13 +02:00
Paul Donald 90d5a8ce35 openvpn: enable management interface
This eases management of live servers via its socket
interface.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
https://github.com/openwrt/packages/pull/28533
2026-02-22 11:54:13 +02:00
Paul Donald 0ff7aa62fc openvpn: disable compression in builds
If you need the security risks of using compression,
make a custom build.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
https://github.com/openwrt/packages/pull/28533
2026-02-22 11:54:13 +02:00
Paul Donald affa96dc81 openvpn: introduce ucode proto handler
In preparation for netifd support for ucode
proto handlers.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
https://github.com/openwrt/packages/pull/28533
2026-02-22 11:54:13 +02:00
Paul Donald 2607b76154 openvpn: introduce proto handler
openvpn needs a proto handler. Here it is.

Removed all of the up/down scripts from the init handler
and made those entirely optional (with some ucode examples).

The config options have been updated to reflect v 2.6/2.7,
with a 'd' flag to denote deprecated. Deprecated flags are
gated behind an 'allow_deprecated' config flag, which must
be on to use them. Some flags will cease to work in the next
version.

Users should not be using compression. Openvpn has enough
security holes and pitfalls already without using
compression.

Updated the example configs (left in place as legacy
documentation) and removed older cryptos which do not exist
in ovpn any longer.

A migration script is included -x. /etc/config/openvpn
entries become interface entries in /etc/config/network
with proto='openvpn'. The source config is retained.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
https://github.com/openwrt/packages/pull/28533
2026-02-22 11:54:13 +02:00
Martin Schiller 390cdc1419 openvpn: add missing options
Add missing options taken from the OpenVPN 2.6 manual.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2025-12-23 10:47:44 -03:00
Martin Schiller 789cf82890 openvpn: remove vanished options
These options are no longer available in openvpn 2.6.x.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2025-12-23 10:47:44 -03:00