Commit graph

10 commits

Author SHA1 Message Date
Florian Eckert
9a27865acb openvpn: add possibility to start openvpn_path_instance on request
This commit adds the possibility that an OpenVPN instance located under
'/etc/openvpn' can also be started with the command.
'/etc/init.d/openvpn start <name>'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-20 15:01:39 +01:00
Florian Eckert
0b633a0886 openvpn: add start_path_instance function
This commit moves the part for starting an instance to a sub function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-20 15:01:29 +01:00
Florian Eckert
b2269ecbf7 openvpn: move path instances call to sub function
Move the start of the OpenVPN configurations in '/etc/openvpn' in a function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-20 15:01:24 +01:00
Florian Eckert
01d8f5c9be openvpn: rename start_instance to start_uci_instance
Preparation commit to make it clear that this is a uci configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-20 15:01:14 +01:00
Ivan Pavlov
808f67d615 openvpn: fix ipchange hotplug event
In f8a8b71e26 openvpn introduced new hotplug events.
For server config, ipchange hotplug event produces an error.
So, make ipchange hotplug event for client only

Fixes https://github.com/openwrt/packages/issues/21200

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
2023-06-09 14:46:03 +03:00
Michal Hrusecky
f8a8b71e26 openvpn: Add more hotplug events
OpenVPN supports more hooks than just 'up' and 'down'. Especially
reacting to 'route-up' and 'route-pre-down' events could be important.
When routing table changes, it can make sense to adapt firewall, run
some tests or change even more routes. This change passes those events
to hotplug, so it is easy to react to them without changing
configuration files provided by VPN provider.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2023-05-20 12:58:33 +03:00
Martin Schiller
5ce5220eb2 openvpn: add possibility to set param "compress" without algorithm
In some situations you need to set the compress param without an
algorithm. Compression will be turned off, but the packet framing for
compression will still be enabled, allowing a different setting to be
pushed later.

As it is not possible to have options with optional values at the
moment, I've introduced a pseudo value "frames_only" which will be
removed in the init script.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2022-10-31 14:22:17 +01:00
Jo-Philipp Wich
7f065a94bb openvpn: fix invoking user up & down commands from hotplug wrapper
This commit adds a number of fixes to the OpenVPN up/down hotplug command
wrapper which currently fails to actually invoke user defined up and down
commands for uci configurations not using external native configurations.

 - Use the `--setenv` to pass the user configured `up` and `down` commands
   as `user_up` and `user_down` environment variables respectively

 - Instead of attempting to scrape the `up` and `down` settings from the
   (possibly generated) native OpenVPN configuration in
   `/etc/hotplug.d/openvpn/01-user`, read them from the respective
   environment variables instead

 - Fix parsing of native configuration values in `get_openvpn_option()`;
   first try to parse a given setting as single quoted value, then as
   double quoted and finally as non-quoted, potentially white-space
   escaped one. This ensures that `up '/bin/foo'` is interpreted as
   `/bin/foo` and not `'/bin/foo'`

Ref: https://forum.openwrt.org/t/openvpn-up-down-configuration-ignored/91126
Supersedes: #15121, #15284
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-04-01 07:20:03 -04:00
Michal Hrusecky
0830dfa41c
openvpn: Support username and password options
Some VPN providers require username and password for client to connect.
This commit adds an option to specify username, password and
cert_password directly in uci config which then gets expanded during
start of openpvn client.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-12-11 17:07:53 +01:00
Rosen Penev
4434915571
openvpn: import from base
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-12-01 12:37:37 -08:00