Hi all,
I released ns8-roadwarrior 0.1.1. It is a VPN for NS8, for users who work from outside. It runs on OpenVPN in a rootless container.
Each user logs in with three factors:
- a personal certificate, in the profile
- the password of the user domain (LDAP: OpenLDAP or Samba AD)
- a TOTP code from an authenticator app
The password and the TOTP code are optional. You choose per instance. TOTP needs the password mode, and you can make it mandatory for every account.
Code and docs: GitHub - stephdl/ns8-roadwarrior: OpenVPN road warrior server for NethServer 8 · GitHub
What it does
A user imports one profile in an OpenVPN client. Then the user reaches:
- the web apps of the nodes
- the Samba shares and the AD domain controller, if the node shares them
- SSH of a node, only if that node allows it
Internet traffic stays outside the VPN. The user does not reach your LAN, only the services of the nodes.
From the UI you create accounts, download profiles, see who is connected, kick a session and read the login history.
Install
In the cluster admin, go to Settings, Software repositories, and add my repository:
https://forge.de-labrusse.fr/ns8/updates/
Then install Roadwarrior from the Software center. The repository refreshes every 4 hours, so 0.1.1 may show up a bit later.
Or install it from the command line:
add-module ghcr.io/stephdl/roadwarrior:0.1.1 1
Not on Debian 13 yet
On Debian 13 (kernel 6.12.117) OpenVPN cannot open its tun device. It fails with Cannot ioctl TUNSETIFF ...: Operation not permitted. Rocky Linux 9 works.
The fix is in the core, NethServer/ns8-core#1422. When a core with it is released, Debian 13 will work. I track it in stephdl/ns8-roadwarrior#16.
Configure
Install the module on every node that runs apps your users must reach. Then:
- Configure one instance as the hub. Set the host name the users connect to, a UDP port, a private network for the users (like
10.8.0.0/24) and the login mode. - On each other node, open Settings, choose “Node of a hub” and pick the hub.
- On the hub, add the accounts. Send each user its profile.
Configure the hub first: a node can only join a hub that exists.
Each instance chooses. As a hub, it is a VPN of its own, with its own port, network and accounts. A hub alone serves the apps of its own node. As a node of a hub, it adds its node to that VPN. So you can run one VPN for every node, or separate VPNs: other users, another user domain or another login mode.
The profile has no routes and no DNS. The server sends them at each connection. Add a node or an app, and the users get it at their next connection.
One hub, the other nodes join it
The users connect to the hub. A node of a hub has no users and no public port. It joins the hub through the cluster VPN.
user 10.8.0.5
| Internet, UDP port of the hub
v
hub on node 1
user server 10.8.0.1 -> link server 10.8.1.1
| cluster VPN
+--------------+--------------+
v v
node 1, 10.8.1.2 node 2, 10.8.1.3
its apps its apps, its Samba DC
A packet makes one jump. It goes from the user to the hub, then from the hub to the node that runs the app. The hub forwards in its own network namespace with its own nft rules. The node firewall is not touched.
Users can open connections to the nodes. Users cannot reach each other. Nodes cannot open connections to users.
Keep an app for VPN users only
The hub does no NAT. Each node sees the real address of the user, like 10.8.0.5.
So open the HTTP route of the app and put 10.8.0.0/24 in “Allow access from”. VPN users get the app. Everyone else gets a 403. This works on every node that joined the hub.
Names that exist only inside
The hub runs a DNS server (dnsmasq) on 10.8.0.1 and gives it to the users. It answers:
- the name of every HTTP route of every node
- the FQDN of the hub node
- the Samba realm, sent to the domain controller
Other names go to the normal DNS of the node.
The server also sends the routes to reach these addresses. So a route like wiki.internal.lan, unknown on the Internet, works through the VPN. The same goes for the AD realm: a Windows PC in the domain gets Kerberos, shares and group policies.
About certificates: an app with a public name keeps its Let’s Encrypt certificate, even when it is closed to the Internet. A name that exists only inside cannot get one. Use a public name kept for the VPN, or upload your own certificate.
NetworkManager, OpenVPN Connect, OpenVPN GUI and Tunnelblick use this DNS by themselves. The plain openvpn command on Linux needs the systemd-resolved helper.
Good to know
- Speed: about 300 Mbit/s to another node on my test VMs.
- SSH is closed from the VPN. Each node can open it with “Open SSH to the VPN”.
- Backup, restore, clone and move keep the accounts, the certificates, the TOTP secrets and the history.
- While accounts exist, the host, port, network and login mode are locked. They are written in the profiles you already sent.
- The UI speaks English, German, Spanish, Basque, French, Italian, Portuguese and Brazilian Portuguese.
Diagrams of the login, the packet path and the DNS: ns8-roadwarrior/docs/network.md at main · stephdl/ns8-roadwarrior · GitHub
Feedback and bug reports are welcome, here or on GitHub.