[GH-ISSUE #3591] Port WireGuard hooks to netbird #7542

Open
opened 2026-08-05 01:13:26 -04:00 by saavagebueno · 5 comments
Owner

Originally created by @gslongo on GitHub (Mar 27, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/3591

Is your feature request related to a problem? Please describe.
We are trying to build complex network use case and take benefits of Netbird. However we are facing to some lack of features compared to a "Standard" wireguard setup. Especially with hook commands:

  • PreUp
  • PostUp
  • PreDown
  • PostDown

Describe the solution you'd like
Add an option to run hook commands when setting up a tunnel (or shutting down)

Describe alternatives you've considered
Do not use Netbird, use raw wireguard implementation

Additional context
The context here is to allow L2 packets inside the tunnel by creating an additional tunnel over wireguard like L2TP, VXLAN,...

Originally created by @gslongo on GitHub (Mar 27, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/3591 **Is your feature request related to a problem? Please describe.** We are trying to build complex network use case and take benefits of Netbird. However we are facing to some lack of features compared to a "Standard" wireguard setup. Especially with hook commands: - PreUp - PostUp - PreDown - PostDown **Describe the solution you'd like** Add an option to run hook commands when setting up a tunnel (or shutting down) **Describe alternatives you've considered** Do not use Netbird, use raw wireguard implementation **Additional context** The context here is to allow L2 packets inside the tunnel by creating an additional tunnel over wireguard like L2TP, VXLAN,...
saavagebueno added the feature-request label 2026-08-05 01:13:26 -04:00
Author
Owner

@nazarewk commented on GitHub (Mar 27, 2025):

Actually, few hours ago I brought up this (almost) exact topic for tomorrow's roadmap planning, it was met with enthusiasm: "we already had similar thoughts on plugins/webassembly support".

In summary, we should be able to relatively easily plug in external scripts to the following events:

  • (dis)connecting to management
  • (dis)connecting to peer
    • possibly changing peer’s
  • adding/deleting/reconfiguring networks
  • adding/deleting/reconfiguring nameservers

Still I cannot guarantee or commit to making it happen anytime soon.

<!-- gh-comment-id:2758460682 --> @nazarewk commented on GitHub (Mar 27, 2025): Actually, few hours ago I brought up this (almost) exact topic for tomorrow's roadmap planning, it was met with enthusiasm: "we already had similar thoughts on plugins/webassembly support". In summary, we should be able to relatively easily plug in external scripts to the following events: - (dis)connecting to management - (dis)connecting to peer - possibly changing peer’s - adding/deleting/reconfiguring networks - adding/deleting/reconfiguring nameservers Still I cannot guarantee or commit to making it happen anytime soon.
Author
Owner

@gslongo commented on GitHub (Mar 28, 2025):

Actually, few hours ago I brought up this (almost) exact topic for tomorrow's roadmap planning, it was met with enthusiasm: "we already had similar thoughts on plugins/webassembly support".

In summary, we should be able to relatively easily plug in external scripts to the following events:

* (dis)connecting to management

* (dis)connecting to peer
  
  * possibly changing peer’s

* adding/deleting/reconfiguring networks

* adding/deleting/reconfiguring nameservers

Still I cannot guarantee or commit to making it happen anytime soon.

Thank you for you answer :-) I would appreciate if you let me know the outcome of your proposal to the roadmap (accepted or rejected). Have a good day !

<!-- gh-comment-id:2760451532 --> @gslongo commented on GitHub (Mar 28, 2025): > Actually, few hours ago I brought up this (almost) exact topic for tomorrow's roadmap planning, it was met with enthusiasm: "we already had similar thoughts on plugins/webassembly support". > > In summary, we should be able to relatively easily plug in external scripts to the following events: > > * (dis)connecting to management > > * (dis)connecting to peer > > * possibly changing peer’s > > * adding/deleting/reconfiguring networks > > * adding/deleting/reconfiguring nameservers > > > Still I cannot guarantee or commit to making it happen anytime soon. Thank you for you answer :-) I would appreciate if you let me know the outcome of your proposal to the roadmap (accepted or rejected). Have a good day !
Author
Owner

@gslongo commented on GitHub (Apr 9, 2025):

Hi @nazarewk ! :-)
Could you tell me if it has been included in the roadmap ?

Thanks !

<!-- gh-comment-id:2788816763 --> @gslongo commented on GitHub (Apr 9, 2025): Hi @nazarewk ! :-) Could you tell me if it has been included in the roadmap ? Thanks !
Author
Owner

@nazarewk commented on GitHub (Apr 9, 2025):

Could you tell me if it has been included in the roadmap ?

Yes, it is planned for the second half of 2025 if it gains any traction.

We are considering 2 approaches to the problem:

  1. Signed & verified (trusted) plugins that the client would execute directly: WebAssembly, Go or some other embedded language.
  2. Local stream of events that the user/system administrator could listen to and react to asynchronously (without blocking further handling). It could take the form of a log file (JSON event per line) or some other interface.

The team veers towards secure plugins, while I personally prefer the second approach.
It would put all the responsibility on the user (after all, we wouldn't be executing anything ourselves), but it would be significantly simpler to implement and maintain.

What do you think? Maybe you'd have other ideas?

<!-- gh-comment-id:2789391009 --> @nazarewk commented on GitHub (Apr 9, 2025): > Could you tell me if it has been included in the roadmap ? Yes, it is planned for the second half of 2025 if it gains any traction. We are considering 2 approaches to the problem: 1. Signed & verified (trusted) plugins that the client would execute directly: WebAssembly, Go or some other embedded language. 2. Local stream of events that the user/system administrator could listen to and react to asynchronously (without blocking further handling). It could take the form of a log file (JSON event per line) or some other interface. The team veers towards secure plugins, while I personally prefer the second approach. It would put all the responsibility on the user (after all, we wouldn't be executing anything ourselves), but it would be significantly simpler to implement and maintain. What do you think? Maybe you'd have other ideas?
Author
Owner

@gslongo commented on GitHub (Apr 10, 2025):

Thank you for answer @nazarewk. I appreciate.

The first option seems too heavy to implement and maintain with regard to the use case of these plugins (probably very simple actions).
I would consider a variant of the second option, KISS. For instance, enabling the configuration of scripts triggered by events could be a compelling approach. This could involve maintaining a dedicated folder for each event type, where scripts or binaries can be placed and executed with the aid of environment variables. It's a straightforward, easy to implement, effortless to maintain, and universally compatible across platforms

/etc/netbird/hooks/pre-up.d/01_script.sh
/etc/netbird/hooks/pre-up.d/05_script.py
/etc/netbird/hooks/post-up.d/02_bin_software
/etc/netbird/hooks/post-down.d/05_shutdown_tunnel.py

What do you think ?

Thank you very much !

On another note, do you know if there's any plan to work on this feature request https://github.com/netbirdio/netbird/issues/1633 ? It's also a big concern in our project, because we could have to manage huge number of peers.

<!-- gh-comment-id:2791745360 --> @gslongo commented on GitHub (Apr 10, 2025): Thank you for answer @nazarewk. I appreciate. The first option seems too heavy to implement and maintain with regard to the use case of these plugins (probably very simple actions). I would consider a variant of the second option, KISS. For instance, enabling the configuration of scripts triggered by events could be a compelling approach. This could involve maintaining a dedicated folder for each event type, where scripts or binaries can be placed and executed with the aid of environment variables. It's a straightforward, easy to implement, effortless to maintain, and universally compatible across platforms ``` /etc/netbird/hooks/pre-up.d/01_script.sh /etc/netbird/hooks/pre-up.d/05_script.py /etc/netbird/hooks/post-up.d/02_bin_software /etc/netbird/hooks/post-down.d/05_shutdown_tunnel.py ``` What do you think ? Thank you very much ! On another note, do you know if there's any plan to work on this feature request https://github.com/netbirdio/netbird/issues/1633 ? It's also a big concern in our project, because we could have to manage huge number of peers.
Sign in to join this conversation.
No Label feature-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#7542