2024-04-24 01:00:57 +02:00
{
config ,
lib ,
. . .
} : {
2024-03-21 20:39:59 +01:00
wireguard . elisabeth = {
client . via = " e l i s a b e t h " ;
firewallRuleForNode . elisabeth . allowedTCPPorts = [ 80 3000 3001 ] ;
} ;
2024-04-24 01:00:57 +02:00
age . secrets . coturnPassword = {
generator . script = " a l n u m " ;
group = " n e t b i r d " ;
} ;
age . secrets . coturnSecret = {
generator . script = " a l n u m " ;
2024-04-24 15:50:56 +02:00
owner = " t u r n s e r v e r " ;
2024-04-24 01:00:57 +02:00
} ;
age . secrets . dataEnc = {
2024-04-24 15:50:56 +02:00
generator . script = { pkgs , . . . }: ''
$ { lib . getExe pkgs . openssl } rand - base64 32
'' ;
2024-04-24 01:00:57 +02:00
group = " n e t b i r d " ;
} ;
2024-03-21 20:39:59 +01:00
networking . firewall . allowedTCPPorts = [ 80 3000 3001 ] ;
networking . firewall . allowedUDPPorts = [ 3478 ] ;
2024-04-24 01:00:57 +02:00
services . netbird = {
server = {
enable = true ;
domain = " n e t b i r d . ${ config . secrets . secrets . global . domains . web } " ;
dashboard = {
2024-05-25 21:12:15 +02:00
enableNginx = true ;
2024-04-24 01:00:57 +02:00
settings = {
AUTH_AUTHORITY = " h t t p s : / / a u t h . ${ config . secrets . secrets . global . domains . web } / o a u t h 2 / o p e n i d / n e t b i r d " ;
} ;
} ;
coturn = {
enable = true ;
passwordFile = config . age . secrets . coturnPassword . path ;
} ;
management = {
port = 3000 ;
dnsDomain = " i n t e r n a l . ${ config . secrets . secrets . global . domains . web } " ;
singleAccountModeDomain = " n e t b i r d . p a t r i c k " ;
oidcConfigEndpoint = " h t t p s : / / a u t h . ${ config . secrets . secrets . global . domains . web } / o a u t h 2 / o p e n i d / n e t b i r d / . w e l l - k n o w n / o p e n i d - c o n f i g u r a t i o n " ;
settings = {
TURNConfig = {
Secret . _secret = config . age . secrets . coturnSecret . path ;
} ;
2024-05-26 16:26:36 +02:00
HttpConfig = {
# This is not possible
# failed validating JWT token sent from peer y1ParZkbzVMQGeU/KMycYl75v90i2O6EwgO1YQZnSFs= with error rpc error: code = Internal desc = unable to fetch account with claims, err: user ID is empty
#AuthUserIDClaim = "preferred_username";
AuthAudience = " n e t b i r d " ;
} ;
2024-04-24 01:00:57 +02:00
DataStoreEncryptionKey . _secret = config . age . secrets . dataEnc . path ;
} ;
} ;
2024-03-21 20:39:59 +01:00
} ;
} ;
2024-03-24 21:06:11 +01:00
environment . persistence . " / p e r s i s t " . directories = [
{
directory = " / v a r / l i b / n e t b i r d - m g m t " ;
mode = " 4 4 0 " ;
user = " n e t b i r d " ;
}
] ;
2024-03-21 20:39:59 +01:00
}