I'm playing a bit with netbird, and I feel like the netbird package lacks configuration customization.
Thats why I modified it a bit to have a /etc/config/netbird configuration file so you can actually tune it a bit, here are the files for thoses who are interested in the same feature:
The service file in /etc/init.d/netbird:
#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
handle_netbird_instance() {
local section="$1"
config_get_bool enabled "$section" 'enabled' 0
if [ $enabled -le 0 ]; then
return 1
fi
config_get_bool allow_server_ssh "$section" 'allow_server_ssh' 0
config_get daemon_addr "$section" daemon_addr
config_get config "$section" config
config_get log_level "$section" log_level
config_get log_file "$section" log_file
config_get management_url "$section" management_url
allow_server_ssh_value="false"
if [ ${allow_server_ssh} -gt 0 ]; then
allow_server_ssh_value="true"
fi
config_filename="${config:-/etc/netbird/config.${section}.json}"
[ -f "${config_filename}" ] && sed 's/"ServerSSHAllowed"\s*:[^,]*/"ServerSSHAllowed": '"${allow_server_ssh_value}"'/' "${config_filename}"
procd_open_instance "$section"
procd_set_param command /usr/bin/netbird
procd_append_param command service run
procd_append_param command --config "${config_filename}"
procd_append_param command --log-level "${log_level:-info}"
procd_append_param command --daemon-addr "${daemon_addr:-unix:///var/run/${section}.sock}"
procd_append_param command --log-file "${log_file:-syslog}"
procd_append_param command --management-url "${management_url:-https://api.netbird.io:443}"
procd_set_param pidfile /var/run/netbird.pid
procd_close_instance
return 0
}
handle_netbird_triggers() {
local section="$1"
config_get_bool enabled "$1" 'enabled' 0
if [ $enabled -le 0 ]; then
return 1
fi
config_get trigger_iface "$section" trigger_iface
if [ -z "$trigger_iface" ]; then
return 1
fi
procd_add_interface_trigger "interface.*" "$trigger_iface" /etc/init.d/netbird restart
}
service_triggers() {
config_load 'netbird'
config_foreach handle_netbird_triggers netbird
}
start_service() {
config_load 'netbird'
config_foreach handle_netbird_instance netbird
}
The configuration file in /etc/config/netbird:
#config netbird netbird
# option enabled '1'
# option allow_server_ssh '0'
# option daemon_addr 'unix:///var/run/netbird.sock'
# option config '/etc/netbird/config.json'
# option log_level 'info'
# option log_file 'syslog'
# option management_url 'https://api.netbird.io:443'
# option trigger_iface 'wan'