From cdebfa69013e6059cf735ac19b369925dee0f311 Mon Sep 17 00:00:00 2001 From: Reactor Scram Date: Mon, 6 May 2024 09:09:30 -0500 Subject: [PATCH] chore(gui-client/linux): fix group name, `firezone` should be `firezone-client` (#4889) Also improved the manual testing checklist a little --- rust/gui-client/docs/intended_behavior.md | 13 +++++++++---- rust/gui-client/src-tauri/src/client.rs | 3 ++- rust/gui-client/src-tauri/src/client/gui.rs | 2 +- rust/headless-client/src/imp_linux.rs | 6 +++--- rust/headless-client/src/lib.rs | 3 +++ scripts/tests/smoke-test-gui-linux.sh | 5 +++-- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/rust/gui-client/docs/intended_behavior.md b/rust/gui-client/docs/intended_behavior.md index 2aaba48f6..9884634a7 100644 --- a/rust/gui-client/docs/intended_behavior.md +++ b/rust/gui-client/docs/intended_behavior.md @@ -8,8 +8,9 @@ Best performed on a clean VM 1. Run `scripts/firezone-client-gui-install.sh` 1. Expect "Reboot to finish..." message -1. Expect `grep firezone-client /etc/group` to show the group 1. Expect `systemctl status firezone-client-ipc.service` to show "enabled" and "running" +1. Run the Firezone GUI +1. Expect an error saying that you are not a member of the group `firezone-client` 1. Reboot 1. Expect `groups` to include "firezone-client" 1. Run the Firezone GUI @@ -23,7 +24,7 @@ Best performed on a clean VM 1. Check "Always..." and click "Open link" 1. Expect a keyring dialog to pop up 1. Enter 'password' for testing purposes -1. Expect "Connected to Firezone" notification +1. Expect "Firezone connected" notification 1. Browse to `https://ifconfig.net` 1. Expect to see the gateway's IP and location 1. Quit Firezone @@ -33,8 +34,12 @@ Best performed on a clean VM 1. Run the Firezone GUI 1. Expect a keyring dialog to pop up 1. Enter 'password' to unlock the stored token -1. Expect "Connected to Firezone" notification -1. Check the IP again +1. Expect "Firezone connected" notification +1. Check the IP again, expect the gateway's IP +1. Export the logs +1. Expect the zip file to start with "firezone_logs_" +1. Expect `zipinfo` to show a single directory in the root of the zip, to prevent zip bombing +1. Expect two subdirectories in the zip, "connlib", and "app", each with 3 files, totalling 6 files ## Settings tab diff --git a/rust/gui-client/src-tauri/src/client.rs b/rust/gui-client/src-tauri/src/client.rs index b3250dc3f..006d01614 100644 --- a/rust/gui-client/src-tauri/src/client.rs +++ b/rust/gui-client/src-tauri/src/client.rs @@ -1,5 +1,6 @@ use anyhow::Result; use clap::{Args, Parser}; +use firezone_headless_client::FIREZONE_GROUP; use std::path::PathBuf; mod about; @@ -134,7 +135,7 @@ fn show_error_dialog(error: &gui::Error) -> Result<()> { gui::Error::DeepLink(deep_link::Error::CantListen) => "Firezone is already running. If it's not responding, force-stop it.".to_string(), gui::Error::DeepLink(deep_link::Error::Other(error)) => error.to_string(), gui::Error::Logging(_) => "Logging error".to_string(), - gui::Error::UserNotInFirezoneGroup => "You are not a member of the group `firezone`. Try `sudo adduser $USER firezone` and then reboot".to_string(), + gui::Error::UserNotInFirezoneGroup => format!("You are not a member of the group `{FIREZONE_GROUP}`. Try `sudo adduser $USER {FIREZONE_GROUP}` and then reboot"), gui::Error::Other(error) => error.to_string(), }; diff --git a/rust/gui-client/src-tauri/src/client/gui.rs b/rust/gui-client/src-tauri/src/client/gui.rs index ada1e22a3..12b4ba394 100644 --- a/rust/gui-client/src-tauri/src/client/gui.rs +++ b/rust/gui-client/src-tauri/src/client/gui.rs @@ -561,7 +561,7 @@ impl Controller { let auth_response = client::deep_link::parse_auth_callback(url).context("Couldn't parse scheme request")?; - tracing::info!("Got deep link"); + tracing::info!("Received deep link over IPC"); // Uses `std::fs` let token = self.auth.handle_response(auth_response)?; self.start_session(token) diff --git a/rust/headless-client/src/imp_linux.rs b/rust/headless-client/src/imp_linux.rs index c719397da..37502e25c 100644 --- a/rust/headless-client/src/imp_linux.rs +++ b/rust/headless-client/src/imp_linux.rs @@ -1,6 +1,6 @@ //! Implementation, Linux-specific -use super::{Cli, IpcClientMsg, IpcServerMsg, TOKEN_ENV_KEY}; +use super::{Cli, IpcClientMsg, IpcServerMsg, FIREZONE_GROUP, TOKEN_ENV_KEY}; use anyhow::{bail, Context as _, Result}; use clap::Parser; use connlib_client_shared::{file_logger, Callbacks, ResourceDescription, Sockets}; @@ -185,9 +185,9 @@ pub(crate) fn run_ipc_service(cli: Cli) -> Result<()> { } pub fn firezone_group() -> Result { - let group = nix::unistd::Group::from_name("firezone") + let group = nix::unistd::Group::from_name(FIREZONE_GROUP) .context("can't get group by name")? - .context("firezone group must exist on the system")?; + .context("`{FIREZONE_GROUP}` group must exist on the system")?; Ok(group) } diff --git a/rust/headless-client/src/lib.rs b/rust/headless-client/src/lib.rs index 5014f6e6c..f57ec8bbe 100644 --- a/rust/headless-client/src/lib.rs +++ b/rust/headless-client/src/lib.rs @@ -30,6 +30,9 @@ pub mod imp_windows; #[cfg(target_os = "windows")] pub use imp_windows as imp; +/// Only used on Linux +pub const FIREZONE_GROUP: &str = "firezone-client"; + /// Output of `git describe` at compile time /// e.g. `1.0.0-pre.4-20-ged5437c88-modified` where: /// diff --git a/scripts/tests/smoke-test-gui-linux.sh b/scripts/tests/smoke-test-gui-linux.sh index 1470c2b91..0bce34de3 100755 --- a/scripts/tests/smoke-test-gui-linux.sh +++ b/scripts/tests/smoke-test-gui-linux.sh @@ -3,6 +3,7 @@ set -euox pipefail BUNDLE_ID="dev.firezone.client" +FZ_GROUP="firezone-client" #DEVICE_ID_PATH="/var/lib/$BUNDLE_ID/config/firezone-id.json" LOGS_PATH="$HOME/.cache/$BUNDLE_ID/data/logs" @@ -22,8 +23,8 @@ cargo install --quiet --locked dump_syms minidump-stackwalk dump_syms ../target/debug/firezone-gui-client --output "$SYMS_PATH" ls -lash ../target/debug -sudo groupadd --force firezone -sudo adduser "$USER" firezone +sudo groupadd --force "$FZ_GROUP" +sudo adduser "$USER" "$FZ_GROUP" function run_fz_gui() { pwd