From 880c3acfc15c733981b333ce3a8bf9eb4e7ef325 Mon Sep 17 00:00:00 2001 From: Aceix Date: Mon, 17 Mar 2025 14:49:05 +0000 Subject: [PATCH] fix: config to allow muti-net connections on netdesk (#3371) --- config/config.go | 2 +- scripts/netmaker.default.env | 2 +- scripts/nm-quick.sh | 2 +- scripts/nm-upgrade.sh | 2 +- servercfg/serverconf.go | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 0e42eaae..3a625a2d 100644 --- a/config/config.go +++ b/config/config.go @@ -91,7 +91,7 @@ type ServerConfig struct { Environment string `yaml:"environment"` JwtValidityDuration time.Duration `yaml:"jwt_validity_duration" swaggertype:"primitive,integer" format:"int64"` RacAutoDisable bool `yaml:"rac_auto_disable"` - RacAllowMultipleNetworks bool `yaml:"rac_allow_multiple_networks"` + RacRestrictToSingleNetwork bool `yaml:"rac_restrict_to_single_network"` CacheEnabled string `yaml:"caching_enabled"` EndpointDetection bool `yaml:"endpoint_detection"` AllowedEmailDomains string `yaml:"allowed_email_domains"` diff --git a/scripts/netmaker.default.env b/scripts/netmaker.default.env index 1045edc6..d409de7f 100644 --- a/scripts/netmaker.default.env +++ b/scripts/netmaker.default.env @@ -74,7 +74,7 @@ JWT_VALIDITY_DURATION=43200 # Auto disable a user's connecteds clients bassed on JWT token expiration RAC_AUTO_DISABLE=false # Allow a user to connect to multiple networks simultaneously -RAC_ALLOW_MULTIPLE_NETWORKS=false +RAC_RESTRICT_TO_SINGLE_NETWORK=false # if turned on data will be cached on to improve performance significantly (IMPORTANT: If HA set to `false` ) CACHING_ENABLED=true # if turned on netclient checks if peers are reachable over private/LAN address, and choose that as peer endpoint diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 0cc446aa..4319ad06 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -256,7 +256,7 @@ save_config() { ( "INSTALL_TYPE" "NODE_ID" "DNS_MODE" "NETCLIENT_AUTO_UPDATE" "API_PORT" "MANAGE_DNS" "DEFAULT_DOMAIN" "CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "VERBOSITY" "DEBUG_MODE" "REST_BACKEND" "DISABLE_REMOTE_IP_CHECK" "TELEMETRY" "ALLOWED_EMAIL_DOMAINS" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET" - "FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_ALLOW_MULTIPLE_NETWORKS" "CACHING_ENABLED" "ENDPOINT_DETECTION" + "FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_RESTRICT_TO_SINGLE_NETWORK" "CACHING_ENABLED" "ENDPOINT_DETECTION" "SMTP_HOST" "SMTP_PORT" "EMAIL_SENDER_ADDR" "EMAIL_SENDER_USER" "EMAIL_SENDER_PASSWORD") for name in "${toCopy[@]}"; do save_config_item $name "${!name}" diff --git a/scripts/nm-upgrade.sh b/scripts/nm-upgrade.sh index b5a8dfe5..d2a87e1c 100755 --- a/scripts/nm-upgrade.sh +++ b/scripts/nm-upgrade.sh @@ -179,7 +179,7 @@ save_config() { ( "CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "STUN_PORT" "VERBOSITY" "TURN_PORT" "USE_TURN" "DEBUG_MODE" "TURN_API_PORT" "REST_BACKEND" "DISABLE_REMOTE_IP_CHECK" "TELEMETRY" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET" - "FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_ALLOW_MULTIPLE_NETWORKS") + "FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_RESTRICT_TO_SINGLE_NETWORK") for name in "${toCopy[@]}"; do save_config_item $name "${!name}" done diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index aa30751f..450c6812 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -94,7 +94,7 @@ func GetServerConfig() config.ServerConfig { } cfg.JwtValidityDuration = GetJwtValidityDuration() cfg.RacAutoDisable = GetRacAutoDisable() - cfg.RacAllowMultipleNetworks = GetRacAllowMultipleNetworks() + cfg.RacRestrictToSingleNetwork = GetRacRestrictToSingleNetwork() cfg.MetricInterval = GetMetricInterval() cfg.ManageDNS = GetManageDNS() cfg.Stun = IsStunEnabled() @@ -121,9 +121,9 @@ func GetRacAutoDisable() bool { return os.Getenv("RAC_AUTO_DISABLE") == "true" } -// GetRacAllowMultipleNetworks - returns whether the feature to allow simultaneous network connections via RAC is enabled -func GetRacAllowMultipleNetworks() bool { - return os.Getenv("RAC_ALLOW_MULTIPLE_NETWORKS") == "true" +// GetRacRestrictToSingleNetwork - returns whether the feature to allow simultaneous network connections via RAC is enabled +func GetRacRestrictToSingleNetwork() bool { + return os.Getenv("RAC_RESTRICT_TO_SINGLE_NETWORK") == "true" } // GetServerInfo - gets the server config into memory from file or env