Feature: switching between multiple profiles (one being active) #1592

Open
opened 2025-11-20 05:33:24 -05:00 by saavagebueno · 0 comments
Owner

Originally created by @mlsmaycon on GitHub (Feb 3, 2025).

See https://github.com/netbirdio/netbird/issues/446 for supporting multiple networks/accounts simultaneously


Current Default Configuration:

  • We’ve been planning to move the configuration to a user path, which will allow us to move to a more secure structure, especially for shared user computers. With this, we see the following paths for profiles: Default and setup-key activated keys: /etc/netbird/profiles/default.json
    User profiles: /home/user/.config/netbird/profiles.

Creating a New Profile with CLI:

  • Running netbird profiles new <profile_name> will create a memory placeholder for the new profile. This will allow us to define the place to store the configuration depending on the user input when login in.

  • After running netbird up, the profile file is created. If the users used a setup key, the file is saved in the /etc/netbird/profiles directory, otherwise it will be saved in the user's directory.

Creating a New Profile with GUI:

  • We can create the profile and leave it in memory, or, as GUI activation is usually user-bound, we can create the profile on disk already since we know the user.

Storing selected profile
Storing Profile State:

  • The most recently selected profile should be stored in a state file located at /var/lib/netbird or another designated user profile state path (to be determined). So, on system boot or daemon restart, we have the last profile.

Switching Profiles and Side Effects
Profile Switching Commands:

  • netbird profiles select <profile_name> - Selects the specified profile.

  • netbird up --profile <profile_name> - Brings up the VPN with the selected profile.

  • netbird login --profile <profile_name> - Logs in using the selected profile.

Side Effect:

  • Switching profiles will disconnect the current running process.
  • Switching profile will immediately start the connection with the other profile unless a --skip-concect flag is passed

Behavior on netbird Commands
On netbird down:

  • The CLI should display the current profile when the netbird down command is executed.

On netbird up:

  • The CLI should display the current profile when the netbird up command is executed.

On netbird service restart:

  • The last selected profile should be reloaded from the state stored in /var/lib/netbird or the user profile state path (to be determined).

Compatibility with Existing Installations
Handling Existing Installs:

The current profile will be copied into /etc/netbird/profiles/default.json.

Graphical User Interface (GUI) changes
Profile Display:

  • The GUI will show the current profile between the “Connected” and “Connect” options.
    Display order:
    Connected
    =====================
    FancyProfile > Add profile
    =====================
    Connect FancyProfile > Select
    Disconnect Delete → warning box

Profile Management:

  • A submenu will list all profiles with options to create new profiles. Each profile will have options to select or delete it.

  • The GUI settings menu will switch to the selected profile settings.

Profile Loading on Restart:

  • Upon restarting, the application will load the current profile from the stored state using the daemon.
Originally created by @mlsmaycon on GitHub (Feb 3, 2025). See https://github.com/netbirdio/netbird/issues/446 for supporting multiple networks/accounts simultaneously --- Current Default Configuration: - We’ve been planning to move the configuration to a user path, which will allow us to move to a more secure structure, especially for shared user computers. With this, we see the following paths for profiles: Default and setup-key activated keys: /etc/netbird/profiles/default.json User profiles: /home/user/.config/netbird/profiles. Creating a New Profile with CLI: - Running netbird profiles new <profile_name> will create a memory placeholder for the new profile. This will allow us to define the place to store the configuration depending on the user input when login in. - After running netbird up, the profile file is created. If the users used a setup key, the file is saved in the /etc/netbird/profiles directory, otherwise it will be saved in the user's directory. Creating a New Profile with GUI: - We can create the profile and leave it in memory, or, as GUI activation is usually user-bound, we can create the profile on disk already since we know the user. Storing selected profile Storing Profile State: - The most recently selected profile should be stored in a state file located at /var/lib/netbird or another designated user profile state path (to be determined). So, on system boot or daemon restart, we have the last profile. Switching Profiles and Side Effects Profile Switching Commands: - netbird profiles select <profile_name> - Selects the specified profile. - netbird up --profile <profile_name> - Brings up the VPN with the selected profile. - netbird login --profile <profile_name> - Logs in using the selected profile. Side Effect: - Switching profiles will disconnect the current running process. - Switching profile will immediately start the connection with the other profile unless a `--skip-concect` flag is passed Behavior on netbird Commands On netbird down: - The CLI should display the current profile when the netbird down command is executed. On netbird up: - The CLI should display the current profile when the netbird up command is executed. On netbird service restart: - The last selected profile should be reloaded from the state stored in /var/lib/netbird or the user profile state path (to be determined). Compatibility with Existing Installations Handling Existing Installs: The current profile will be copied into /etc/netbird/profiles/default.json. Graphical User Interface (GUI) changes Profile Display: - The GUI will show the current profile between the “Connected” and “Connect” options. Display order: Connected ===================== FancyProfile > Add profile ===================== Connect FancyProfile > Select Disconnect Delete → warning box Profile Management: - A submenu will list all profiles with options to create new profiles. Each profile will have options to select or delete it. - The GUI settings menu will switch to the selected profile settings. Profile Loading on Restart: - Upon restarting, the application will load the current profile from the stored state using the daemon.
saavagebueno added the enhancementfeature-request labels 2025-11-20 05:33:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#1592