From 7e38789ee126d1db3a26269df1cddfd9e3125307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Mon, 12 Jan 2026 11:24:14 +0100 Subject: [PATCH 1/4] add more logs to postinst script --- resources-linux/postinst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources-linux/postinst b/resources-linux/postinst index 64779ffd..2fb63db8 100644 --- a/resources-linux/postinst +++ b/resources-linux/postinst @@ -10,6 +10,8 @@ case "$1" in if ! getent group "$GROUP_NAME" >/dev/null; then groupadd --system "$GROUP_NAME" echo "Created group $GROUP_NAME" + else + echo "Group $GROUP_NAME exists already." fi # Determine target user @@ -19,6 +21,7 @@ case "$1" in elif [ -n "$USER" ] && [ "$USER" != "root" ]; then TARGET_USER="$USER" fi + echo "Installation triggered by user $TARGET_USER" # Add user to group if we found a valid target if [ -n "$TARGET_USER" ]; then @@ -40,10 +43,14 @@ case "$1" in exit 1 fi fi + else + echo "User $TARGET_USER is not a valid target. Not adding the user to group $GROUP_NAME" fi # Handle systemd service if [ -d /run/systemd/system ]; then + echo "Updating systemd service $SERVICE_NAME" + # Reload systemd to recognize new service file systemctl daemon-reload @@ -58,6 +65,7 @@ case "$1" in abort-upgrade|abort-remove|abort-deconfigure) # On failed operations, ensure service is running if it should be if [ -d /run/systemd/system ]; then + echo "Restarting systemd service $SERVICE_NAME" systemctl daemon-reload if systemctl is-enabled "$SERVICE_NAME" >/dev/null 2>&1; then systemctl start "$SERVICE_NAME" || true From b42e5b4bb8b3a50b7a28baa312122f9493769d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Mon, 12 Jan 2026 14:01:47 +0100 Subject: [PATCH 2/4] add another method for finding current user --- resources-linux/postinst | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/resources-linux/postinst b/resources-linux/postinst index 2fb63db8..e3b7932e 100644 --- a/resources-linux/postinst +++ b/resources-linux/postinst @@ -4,6 +4,29 @@ set -e GROUP_NAME="defguard" SERVICE_NAME="defguard-service" +# Get the name of user who is installing the client +get_installing_user() { + # Method 1: Check standard environment variables when installing with CLI + if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then + INSTALLING_USER="$SUDO_USER" + elif [ -n "$USER" ] && [ "$USER" != "root" ]; then + INSTALLING_USER="$USER" + fi + if [ -n "$INSTALLING_USER" ]; then + echo "$INSTALLING_USER" + return 0 + fi + + # Method 2: Check loginctl for latest session + username=$(loginctl list-users --no-legend | awk '$1 >= 1000 {print $2; exit}') + if [ -n "$username" ]; then + echo "$username" + return 0 + fi + + return 1 +} + case "$1" in 1|configure) # Create the group if it doesn't exist @@ -15,12 +38,7 @@ case "$1" in fi # Determine target user - TARGET_USER="" - if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then - TARGET_USER="$SUDO_USER" - elif [ -n "$USER" ] && [ "$USER" != "root" ]; then - TARGET_USER="$USER" - fi + TARGET_USER=$(get_installing_user) echo "Installation triggered by user $TARGET_USER" # Add user to group if we found a valid target From 825bbe1a6f2ae746991cc2b5deffb5eda8623f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Mon, 12 Jan 2026 14:06:19 +0100 Subject: [PATCH 3/4] bump version --- package.json | 2 +- src-tauri/Cargo.lock | 6 +++--- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- swift/extension/VPNExtension.xcodeproj/project.pbxproj | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f7cabdd0..7ff4e118 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "defguard-client", "private": false, - "version": "1.6.3", + "version": "1.6.4", "type": "module", "scripts": { "dev": "npm-run-all --parallel vite typesafe-i18n", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 838d633e..d6b20f70 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -990,7 +990,7 @@ dependencies = [ [[package]] name = "common" -version = "1.6.3" +version = "1.6.4" dependencies = [ "nix", ] @@ -1363,7 +1363,7 @@ checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" [[package]] name = "defguard-client" -version = "1.6.3" +version = "1.6.4" dependencies = [ "anyhow", "async-stream", @@ -1433,7 +1433,7 @@ dependencies = [ [[package]] name = "defguard-dg" -version = "1.6.3" +version = "1.6.4" dependencies = [ "clap", "common", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 36519efc..b9503398 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -31,7 +31,7 @@ edition = "2021" homepage = "https://github.com/DefGuard/client" license-file = "../LICENSE.md" rust-version = "1.85" -version = "1.6.3" +version = "1.6.4" [package] name = "defguard-client" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f58453bc..a3a8cdd7 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -86,7 +86,7 @@ "productName": "Defguard", "mainBinaryName": "defguard-client", "identifier": "net.defguard", - "version": "1.6.3", + "version": "1.6.4", "app": { "security": { "capabilities": [ diff --git a/swift/extension/VPNExtension.xcodeproj/project.pbxproj b/swift/extension/VPNExtension.xcodeproj/project.pbxproj index f0d34342..f62b7893 100644 --- a/swift/extension/VPNExtension.xcodeproj/project.pbxproj +++ b/swift/extension/VPNExtension.xcodeproj/project.pbxproj @@ -322,7 +322,7 @@ ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 13.5; - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.4; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -417,7 +417,7 @@ ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 13.5; - MARKETING_VERSION = 1.6.3; + MARKETING_VERSION = 1.6.4; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = net.defguard.VPNExtension; From a185da31ae791a55519cc56a8323697ad84767af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Tue, 13 Jan 2026 09:37:48 +0100 Subject: [PATCH 4/4] change approach to handle multi-user setups --- resources-linux/postinst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources-linux/postinst b/resources-linux/postinst index e3b7932e..1dac4b2b 100644 --- a/resources-linux/postinst +++ b/resources-linux/postinst @@ -18,7 +18,8 @@ get_installing_user() { fi # Method 2: Check loginctl for latest session - username=$(loginctl list-users --no-legend | awk '$1 >= 1000 {print $2; exit}') + SESSION_ID=$(loginctl show-seat seat0 -p ActiveSession --value) + username=$(loginctl show-session "$SESSION_ID" -p Name --value) if [ -n "$username" ]; then echo "$username" return 0