EU OS: integrate netbird VPN in laptop provisioning – how to obtain setup keys securely?

Dear all, dear @mlsmaycon,

already last year, we discussed how to best integrate netbird into the setup of EU OS PoC that provides for provisioning of atomic linux distributions to managed laptops for end uses in the public (and private) sector.

The goal is to get this done in time to present this at CfgMgmtCamp early February in Belgium. I’ve made a post about it here: Foreman provisioning with Wireguard VPN key enrollment (like FreeIPA enollment) - Development - TheForeman

Quote:

Netbird supports at least the following options to setup clients:

  1. interactive SSO to link a connection to as specific user
  2. bootstrap via config file and secret key
    1. One-off key — can be used only once to authenticate a single machine.
    2. Reusable key — can be used multiple times to authenticate a configurable number of machines.

For the per-machine VPN the 2nd choice seems the way to go with a few options for implementation:

  1. we configure a new provisioning variable that the admin needs to fill with a reusable key. A script generates the config file during provisioning. On first boot, the VPN is setup. Unclear how the reusable key can be protected.
  2. with a netbird service account access token stored in a provisioning variable, a script obtains a one-time token and generates the config file during provisioning. On first boot, the VPN is setup.

For the per-user VPN, netbird offers a GUI or a browser-based flow. Optimal would be to reuse the FreeIPA kerberos ticket for automatic setup of this 2nd VPN, but I found very little about kerberos support. The netbird docs don’t mention it. […]

Some collaborators have asked Claude to understand how to do this best:

You notice that Claude AI proposes to create a token broker inbetween Netbird and Foreman to limit effectively the scope of tokens for Foreman.

My question to the netbird community:

  1. What is your feedback on the broker? Other organisations must have been in similar situations? Are there any best practices?
  2. Wouldn’t it be possible to limit the API access of the service account within netbird, so that service account tokens cannot be used to change VPN configurations other than adding setup keys?

More about the EU OS proof-of-concept (2nd post due to link limitations for new users):

Hey @rriemann thanks for the update and for the questions. Here are the answers:

  1. The broker idea looks great. If you don’t need users to log in to NetBird, then the design is fine. If you want users to log in to NetBird after their machines are provisioned, I would set ephemeral setup keys, as they would need to log in after disconnecting for 10 minutes.
  2. Not yet, but we have a few things in our plans to enable more granular configurations.

Hi @mlsmaycon ,

our talk on netbird integration to foreman was accepted for cfgmgtcamp in Gent next year. :partying_face:

Are you plans somewhere published? Can we check your plan against our use case and possibly make suggestions?