1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-14 19:33:59 +02:00
Commit Graph

27 Commits

Author SHA1 Message Date
Nick Hainke
3b28c6f389 wg-installer: use babeld add_interface function
With commit 385200443554 ("babeld: add add_interface function") babeld
has a new ubus function allowing to dynamically add an interface.

Before the add_interface function, we were required to reload babeld.
The reload influenced the babeld routing. However, the remove part is
still missing and will be added at a later stage.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 40b87aac95)
2022-02-02 11:10:19 +01:00
Nick Hainke
aeb8aad5c0 wg-installer: fix multiple namespaces
Add flag "--lookup-default-namespace" to signal that wg-installer should
look already established wireguard sessions in the default namespace.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 94efdcf02a)
2022-01-23 18:09:51 +01:00
Nick Hainke
b9bfe1ef15 wg-installer: remove unused dependency
Remove the dependency "coreutils-realpath" from
wg-installer-server-hotplug-olsrd.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit fab86eb626)
2022-01-20 22:22:53 +01:00
Nick Hainke
9a836f4307 wg-installer: create wireguard key if it does not exist
Check if the key exists which is given by
    option wg_key '/etc/wgserver/wg.key'

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 324fa79d7c)
2022-01-20 15:12:22 +01:00
Nick Hainke
317ba6a43e wg-installer: install cronjob
Install a cronjob that removes unused wireguard interfaces every 10
minutes.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 432a965689)
2022-01-20 13:57:46 +01:00
Nick Hainke
a430932a7d wg-installer: check if a key is already inserted
Check if a peer is already existing with a given public key. Introduce a
response code for signaling why the server rejected the request.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit da48bc3792)
2022-01-20 13:57:46 +01:00
Nick Hainke
0aaa90629c wg-installer: rework code
Use shellcheck to rework the code. Use "export" to return variables from
a function call. Further, fix typos.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 69c81790d1)
2022-01-20 13:57:46 +01:00
Nick Hainke
dea64c08ea wg-installer: cosmetic changes
Use "ip addr" instead of "ip addres" or "ip a".

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 38a9a3e0dc)
2022-01-20 13:57:46 +01:00
Nick Hainke
c7470d1d8e wg-installer: switch to ubus call for olsrd hotplug
Use ubus ipc calls to add and remove interfaces.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit b89eb0115f)
2022-01-17 09:42:06 +01:00
Nick Hainke
8c3ce87fd2 wg-installer: rework iproute2 commands
- Use ip address add instead of ip a a
- Directly add broadcast address

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit fea27cec05)
2022-01-17 09:42:06 +01:00
Nick Hainke
6fe1b64e7a wg-installer: fix shell typo
Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 53503c4a3a)
2022-01-12 22:43:41 +01:00
Nick Hainke
f21f39cfd8 wg-installer: allow defining link costs for hotplugs
Add options to set link costs in mesh routing daemons.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit ee879d3747)
2022-01-12 18:28:12 +01:00
Nick Hainke
9952517460 wg-installer: private key as parameter
Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 6a59d41fbf)
2022-01-12 09:13:29 +01:00
Nick Hainke
652ebf1a33 wg-installer: generate new keys for every connection
Generate new keys on every new connection.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 8ab044712a)
2022-01-12 09:13:29 +01:00
Nick Hainke
92e357ebd8 wg-installer: fix using symlinks for conf files
It is useful to symlink babeld and olsrd to /tmp/ if we frequently
write to those config files.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 5e8301d7dc)
2022-01-11 00:52:40 +01:00
Nick Hainke
b3764db33c wg-installer: fix cleanup script
The wrong function was called.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit e6afcf8f3c)
2022-01-10 14:15:28 +01:00
Nick Hainke
d364552774 wg-installer: fix get_usage function
The get_usage function always returns 0. The shell syntax was wrong.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit f7cb8b20e1)
2022-01-09 14:13:06 +01:00
Nick Hainke
49f898044c wg-installer: delete old interfaces
Add "wg_check_interfaces" and specify a timeout in the config file.
This allows to delete not used wireguard-interfaces automatically.

For example a cronjob can be installed that calls:
  . /usr/share/wginstaller/wg_functions.sh && wg_check_interfaces

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 36dc9b3f79)
2022-01-09 14:13:06 +01:00
Nick Hainke
335ad2a4d7 wg-installer: fix dependencies
Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 62cc627aba)
2022-01-09 14:13:06 +01:00
Nick Hainke
f2745c85a2 wg-installer: fix typo in cleanup function
The delete variable was misspelled leading to devices always being
removed although they had connected neighbors.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 0e416dadd1)
2022-01-09 13:49:19 +01:00
Nick Hainke
1de352b603 wg-installer: fix ipv4 meshing via olsr
The ipv4 address space was not allowed.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 4302bfd3c8)
2022-01-09 12:20:18 +01:00
Nick Hainke
efb5bdf073 wg-installer: add link-local to client interface
Wireguard has no link-local address on an interface automatically.
Add a link-local to the interface. The server has fe80::1/64 and
the client fe80::2/64.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 625f3c8302)
2022-01-09 12:20:18 +01:00
Nick Hainke
bf1c780af4 wg-installer: add cleanup script
Add script to cleanup unused wireguard interfaces.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 714b51c630)
2022-01-09 10:43:34 +01:00
Nick Hainke
032d0157c3 wg-installer: add ipv4 support
Add base_v4prefix to allow ipv4 mesh connections.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 98d8680a8c)
2022-01-07 08:23:10 +01:00
Nick Hainke
f755690b0e wg-installer: add hotplug script for olsr
Add hotplug-olsrd to automatically mesh with olsrd via new wireguard
links.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit d35c22951b)
2022-01-06 22:44:48 +01:00
Nick Hainke
3ebc568f18 wg-installer: add babeld hotplug.d script
Add a hotplug.d-extension that automatically configures babeld for
meshing via wireguard interfaces.

It checks for "add" and "remove" of a wireguard interface with name
"wg_*". Depending on the action, it removes it from the babeld config
or adds the interface and reloads babeld.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-02-08 11:38:36 +01:00
Nick Hainke
3a6949dfaf wg-installer: add wg-installer
This tool can be used to automatically create wireguard tunnels. Using
rpcd a new wireguard interface is created on the server where the client
can connect to.

Wiregurad server automatically installs a user and associated ACL to use
the wireguard-installer-server features. The user is called wginstaller
and so is the password.

Get Usage:
  wg-client-installer get_usage --ip 127.0.0.1 --user wginstaller
	--password wginstaller

Register Interface:
  wg-client-installer register --ip 127.0.0.1 --user wginstaller
         --password wginstaller --bandwidth 10 --mtu 1400

Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-02-06 22:41:29 +01:00