From 652089d6b9caaef050bab1d0ac051b8df60a2d80 Mon Sep 17 00:00:00 2001 From: Aleksander <170264518+t-aleksander@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:28:15 +0100 Subject: [PATCH] fix issues with connecting to proxy after setup --- crates/defguard/src/main.rs | 22 +++++----------------- web/src/routeTree.gen.ts | 32 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/crates/defguard/src/main.rs b/crates/defguard/src/main.rs index 4e5c40380f..562c05c9ec 100644 --- a/crates/defguard/src/main.rs +++ b/crates/defguard/src/main.rs @@ -9,10 +9,7 @@ use defguard_common::{ config::{Command, DefGuardConfig, SERVER_CONFIG}, db::{ init_db, - models::{ - Settings, - settings::{initialize_current_settings, update_current_settings}, - }, + models::{Settings, settings::initialize_current_settings}, }, messages::peer_stats_update::PeerStatsUpdate, types::proxy::ProxyControlMessage, @@ -111,8 +108,10 @@ async fn main() -> Result<(), anyhow::Error> { if let Err(err) = run_setup_web_server(pool.clone(), config.http_bind_address, config.http_port).await { - error!("Setup web server exited with error: {err}"); + anyhow::bail!("Setup web server exited with error: {err}"); } + + settings = Settings::get_current_settings(); } config.initialize_post_settings(); @@ -144,18 +143,7 @@ async fn main() -> Result<(), anyhow::Error> { let incompatible_components: Arc> = Arc::default(); if settings.ca_cert_der.is_none() || settings.ca_key_der.is_none() { - info!( - "No gRPC TLS certificate or key found in settings, generating self-signed certificate for gRPC server." - ); - - let ca = defguard_certs::CertificateAuthority::new("Defguard", "", 10)?; - - let (cert_der, key_der) = (ca.cert_der().to_vec(), ca.key_pair_der().to_vec()); - - settings.ca_cert_der = Some(cert_der); - settings.ca_key_der = Some(key_der); - - update_current_settings(&pool, settings).await?; + anyhow::bail!("CA certificate or key were not found in settings, despite completing setup.") } // read grpc TLS cert and key diff --git a/web/src/routeTree.gen.ts b/web/src/routeTree.gen.ts index f1d8040d34..e22adc19ec 100644 --- a/web/src/routeTree.gen.ts +++ b/web/src/routeTree.gen.ts @@ -327,6 +327,7 @@ const AuthorizedDefaultEdgeEdgeIdEditRoute = export interface FileRoutesByFullPath { '/404': typeof R404Route + '/': typeof AuthorizedDefaultRouteWithChildren '/auth': typeof AuthRouteWithChildren '/consent': typeof ConsentRoute '/playground': typeof PlaygroundRoute @@ -366,15 +367,16 @@ export interface FileRoutesByFullPath { '/settings/smtp': typeof AuthorizedDefaultSettingsSmtpRoute '/user/$username': typeof AuthorizedDefaultUserUsernameRoute '/vpn-overview/$locationId': typeof AuthorizedDefaultVpnOverviewLocationIdRoute - '/edge': typeof AuthorizedDefaultEdgeIndexRoute - '/locations': typeof AuthorizedDefaultLocationsIndexRoute - '/settings': typeof AuthorizedDefaultSettingsIndexRoute - '/vpn-overview': typeof AuthorizedDefaultVpnOverviewIndexRoute + '/edge/': typeof AuthorizedDefaultEdgeIndexRoute + '/locations/': typeof AuthorizedDefaultLocationsIndexRoute + '/settings/': typeof AuthorizedDefaultSettingsIndexRoute + '/vpn-overview/': typeof AuthorizedDefaultVpnOverviewIndexRoute '/edge/$edgeId/edit': typeof AuthorizedDefaultEdgeEdgeIdEditRoute '/locations/$locationId/edit': typeof AuthorizedDefaultLocationsLocationIdEditRoute } export interface FileRoutesByTo { '/404': typeof R404Route + '/': typeof AuthorizedDefaultRouteWithChildren '/consent': typeof ConsentRoute '/playground': typeof PlaygroundRoute '/snackbar': typeof SnackbarRoute @@ -475,6 +477,7 @@ export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: | '/404' + | '/' | '/auth' | '/consent' | '/playground' @@ -514,15 +517,16 @@ export interface FileRouteTypes { | '/settings/smtp' | '/user/$username' | '/vpn-overview/$locationId' - | '/edge' - | '/locations' - | '/settings' - | '/vpn-overview' + | '/edge/' + | '/locations/' + | '/settings/' + | '/vpn-overview/' | '/edge/$edgeId/edit' | '/locations/$locationId/edit' fileRoutesByTo: FileRoutesByTo to: | '/404' + | '/' | '/consent' | '/playground' | '/snackbar' @@ -662,7 +666,7 @@ declare module '@tanstack/react-router' { '/_authorized': { id: '/_authorized' path: '' - fullPath: '' + fullPath: '/' preLoaderRoute: typeof AuthorizedRouteImport parentRoute: typeof rootRouteImport } @@ -718,7 +722,7 @@ declare module '@tanstack/react-router' { '/_authorized/_default': { id: '/_authorized/_default' path: '' - fullPath: '' + fullPath: '/' preLoaderRoute: typeof AuthorizedDefaultRouteImport parentRoute: typeof AuthorizedRoute } @@ -823,28 +827,28 @@ declare module '@tanstack/react-router' { '/_authorized/_default/vpn-overview/': { id: '/_authorized/_default/vpn-overview/' path: '/vpn-overview' - fullPath: '/vpn-overview' + fullPath: '/vpn-overview/' preLoaderRoute: typeof AuthorizedDefaultVpnOverviewIndexRouteImport parentRoute: typeof AuthorizedDefaultRoute } '/_authorized/_default/settings/': { id: '/_authorized/_default/settings/' path: '/settings' - fullPath: '/settings' + fullPath: '/settings/' preLoaderRoute: typeof AuthorizedDefaultSettingsIndexRouteImport parentRoute: typeof AuthorizedDefaultRoute } '/_authorized/_default/locations/': { id: '/_authorized/_default/locations/' path: '/locations' - fullPath: '/locations' + fullPath: '/locations/' preLoaderRoute: typeof AuthorizedDefaultLocationsIndexRouteImport parentRoute: typeof AuthorizedDefaultRoute } '/_authorized/_default/edge/': { id: '/_authorized/_default/edge/' path: '/edge' - fullPath: '/edge' + fullPath: '/edge/' preLoaderRoute: typeof AuthorizedDefaultEdgeIndexRouteImport parentRoute: typeof AuthorizedDefaultRoute }