diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 1c90939b..c638e105 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -516,6 +516,7 @@ pub(crate) async fn do_update_instance( instance.disable_all_traffic = instance_info.disable_all_traffic; instance.enterprise_enabled = instance_info.enterprise_enabled; instance.openid_display_name = instance_info.openid_display_name; + instance.uuid = instance_info.id; // Token may be empty if it was not issued // This happens during polling, as core doesn't issue a new token for polling request if response.token.is_some() { diff --git a/src-tauri/src/enterprise/periodic/config.rs b/src-tauri/src/enterprise/periodic/config.rs index a4436921..5cb32286 100644 --- a/src-tauri/src/enterprise/periodic/config.rs +++ b/src-tauri/src/enterprise/periodic/config.rs @@ -206,14 +206,6 @@ pub async fn poll_instance( return Ok(()); } - if check_uuid_mismatch(&response, instance, handle)? { - warn!("Instance {}({}) has UUID mismatch, it's config won't be automatically updated. Remove \ - the instance and add it again, or contact your administrator.", - instance.name, instance.id - ); - return Ok(()); - } - debug!( "Config for instance {}({}) changed", instance.name, instance.id @@ -277,102 +269,11 @@ fn build_request(instance: &Instance) -> Result }) } -#[derive(PartialEq, Eq, Hash)] -enum NotificationType { - VersionMismatch, - UuidMismatch, -} - /// Tracks instance IDs that for which we already sent notification about version mismatches /// to prevent duplicate notifications in the app's lifetime. -static NOTIFIED_INSTANCES: LazyLock>> = +static NOTIFIED_INSTANCES: LazyLock>> = LazyLock::new(|| Mutex::new(HashSet::new())); -#[derive(Clone, Serialize)] -struct UuidMismatchPayload { - instance_name: String, -} - -fn check_uuid_mismatch( - response: &InstanceInfoResponse, - instance: &Instance, - handle: &AppHandle, -) -> Result { - debug!( - "Checking UUID mismatch for instance {}({})", - instance.name, instance.id - ); - - let mut notified_instances = NOTIFIED_INSTANCES.lock().unwrap(); - - debug!( - "Instance {}({}) local UUID: {}, checking against response...", - instance.name, instance.id, instance.uuid - ); - - if let Some(device_config) = &response.device_config { - debug!( - "Found device_config for instance {}({})", - instance.name, instance.id - ); - - if let Some(info) = &device_config.instance { - debug!( - "Found instance info in device_config for instance {}({}), core UUID: {}", - instance.name, instance.id, info.id - ); - - if info.id != instance.uuid { - error!( - "Instance {}({}) has mismatching UUIDs: local {}, remote {}", - instance.name, instance.id, instance.uuid, info.id - ); - - if !notified_instances.contains(&(instance.id, NotificationType::UuidMismatch)) { - if let Err(err) = handle.emit( - EventKey::UuidMismatch.into(), - UuidMismatchPayload { - instance_name: instance.name.clone(), - }, - ) { - error!("Failed to emit UUID mismatch event to the frontend: {err}"); - } else { - debug!( - "Successfully emitted UUID mismatch event for instance {}({})", - instance.name, instance.id - ); - notified_instances.insert((instance.id, NotificationType::UuidMismatch)); - } - } else { - debug!( - "Instance {}({}) already notified about UUID mismatch, skipping", - instance.name, instance.id - ); - } - - return Ok(true); - } else { - debug!( - "UUIDs match for instance {}({}): {}", - instance.name, instance.id, instance.uuid - ); - } - } else { - debug!( - "No instance info found in device_config for instance {}({})", - instance.name, instance.id - ); - } - } else { - debug!( - "No device_config found in response for instance {}({})", - instance.name, instance.id - ); - } - - Ok(false) -} - const CORE_VERSION_HEADER: &str = "defguard-core-version"; const PROXY_VERSION_HEADER: &str = "defguard-component-version"; @@ -394,7 +295,7 @@ fn check_min_version( handle: &AppHandle, ) -> Result<(), Error> { let mut notified_instances = NOTIFIED_INSTANCES.lock().unwrap(); - if notified_instances.contains(&(instance.id, NotificationType::VersionMismatch)) { + if notified_instances.contains(&instance.id) { debug!( "Instance {}({}) already notified about version mismatch, skipping", instance.name, instance.id @@ -490,7 +391,7 @@ fn check_min_version( if let Err(err) = handle.emit(EventKey::VersionMismatch.into(), payload) { error!("Failed to emit version mismatch event to the frontend: {err}"); } else { - notified_instances.insert((instance.id, NotificationType::VersionMismatch)); + notified_instances.insert(instance.id); } } diff --git a/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx b/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx index cc6a6f15..2307f534 100644 --- a/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx +++ b/src/pages/client/pages/ClientInstancePage/components/LocationsList/modals/MFAModal/MFAModal.tsx @@ -153,7 +153,7 @@ export const MFAModal = () => { return; } - if (errorData === 'selected MFA method is not available') { + if (errorData === 'selected MFA method not available') { toaster.error(localLL.errors.mfaNotConfigured()); } else { toaster.error(localLL.errors.mfaStartGeneric());