Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions crates/defguard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -144,18 +143,7 @@ async fn main() -> Result<(), anyhow::Error> {
let incompatible_components: Arc<RwLock<IncompatibleComponents>> = 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
Expand Down
32 changes: 18 additions & 14 deletions web/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ const AuthorizedDefaultEdgeEdgeIdEditRoute =

export interface FileRoutesByFullPath {
'/404': typeof R404Route
'/': typeof AuthorizedDefaultRouteWithChildren
'/auth': typeof AuthRouteWithChildren
'/consent': typeof ConsentRoute
'/playground': typeof PlaygroundRoute
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -475,6 +477,7 @@ export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths:
| '/404'
| '/'
| '/auth'
| '/consent'
| '/playground'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -662,7 +666,7 @@ declare module '@tanstack/react-router' {
'/_authorized': {
id: '/_authorized'
path: ''
fullPath: ''
fullPath: '/'
preLoaderRoute: typeof AuthorizedRouteImport
parentRoute: typeof rootRouteImport
}
Expand Down Expand Up @@ -718,7 +722,7 @@ declare module '@tanstack/react-router' {
'/_authorized/_default': {
id: '/_authorized/_default'
path: ''
fullPath: ''
fullPath: '/'
preLoaderRoute: typeof AuthorizedDefaultRouteImport
parentRoute: typeof AuthorizedRoute
}
Expand Down Expand Up @@ -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
}
Expand Down
Loading