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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[package]
name = "akon"
version = "1.2.2"
version = "1.2.3"
edition = "2021"
authors = ["vcwild"]
description = "A CLI tool for managing VPN connections with OpenConnect"
Expand Down
26 changes: 13 additions & 13 deletions akon-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "akon-core"
version = "1.2.2"
version = "1.2.3"

[features]
default = []
Expand All @@ -15,35 +15,35 @@ dead_code = "deny"
# Workspace dependencies
anyhow.workspace = true
base32.workspace = true
chrono = "0.4"
data-encoding = "2.9.0"
keyring.workspace = true
nix.workspace = true
regex = "1.10"
secrecy.workspace = true
serde.workspace = true
sha1 = "0.10.6"
thiserror.workspace = true
tokio.workspace = true
toml.workspace = true
totp-lite.workspace = true
tracing-journald.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
tokio.workspace = true
nix.workspace = true
data-encoding = "2.9.0"
sha1 = "0.10.6"
regex = "1.10"
chrono = "0.4"
# lazy_static is optional and enabled via the `mock-keyring` feature
lazy_static = { version = "1.5", optional = true }
lazy_static = {version = "1.5", optional = true}

# Network interruption detection dependencies
zbus = "4.0"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
reqwest = {version = "0.12", default-features = false, features = ["rustls-tls"]}
url = "2.5"
zbus = "4.0"

[dev-dependencies]
cargo-tarpaulin = "0.27"
serde_json = "1.0"
criterion = "0.5"
hex = "0.4"
lazy_static = "1.5"
serde_json = "1.0"
tempfile = "3.0"
criterion = "0.5"
tokio-test = "0.4"
wiremock = "0.6"
lazy_static = "1.5"
63 changes: 44 additions & 19 deletions src/cli/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ use std::io::{self, Write};

/// Run the setup command
pub fn run_setup() -> Result<(), AkonError> {
println!("[SETUP] {}", "akon VPN Setup".bright_white().bold());
println!(
"{} {}",
"🔐".bright_magenta(),
"akon VPN Setup".bright_white().bold()
"{}",
"========================================".bright_white()
);
println!("{}", "=================".bright_white());
println!();
println!(
"{}",
Expand All @@ -38,7 +37,7 @@ pub fn run_setup() -> Result<(), AkonError> {
if let Ok(true) = toml_config::config_exists() {
println!(
"{} {}",
"".bright_yellow(),
"[WARN]".bright_yellow(),
"Existing configuration detected.".bright_yellow()
);
if !prompt_yes_no("Overwrite existing setup?", false)? {
Expand Down Expand Up @@ -72,7 +71,7 @@ pub fn run_setup() -> Result<(), AkonError> {
println!();
println!(
"{} {}",
"💾".bright_cyan(),
"[SAVE]".bright_cyan(),
"Saving configuration...".bright_white()
);

Expand All @@ -85,15 +84,15 @@ pub fn run_setup() -> Result<(), AkonError> {

println!(
"{} {}",
"".bright_green(),
"[OK]".bright_green().bold(),
"Setup complete!".bright_green().bold()
);
println!();
println!("{}", "You can now use:".bright_white());
println!(" {} - Connect to VPN", "akon vpn on".bright_cyan());
println!(" {} - Disconnect from VPN", "akon vpn off".bright_cyan());
println!(" {} - Connect to VPN", "akon vpn on".bright_cyan());
println!(" {} - Disconnect from VPN", "akon vpn off".bright_cyan());
println!(
" {} - Generate OTP token manually",
" {} - Generate OTP token manually",
"akon get-password".bright_cyan()
);

Expand All @@ -110,9 +109,13 @@ fn check_keyring_availability() -> Result<(), AkonError> {
Ok(())
}
Err(AkonError::Keyring(_)) => {
println!("❌ Keyring is not available or locked.");
println!("Please ensure your system keyring is unlocked and available.");
println!("On GNOME systems, this is usually handled automatically.");
println!(
"{} {}",
"[ERROR]".bright_red().bold(),
"Keyring is not available or locked.".bright_red().bold()
);
println!(" Please ensure your system keyring is unlocked and available.");
println!(" On GNOME systems, this is usually handled automatically.");
Err(AkonError::Keyring(
akon_core::error::KeyringError::ServiceUnavailable,
))
Expand Down Expand Up @@ -299,7 +302,7 @@ fn collect_reconnection_config(

println!();
println!(
"{} {}",
" {} {}",
"✓".bright_green(),
"Reconnection configuration validated".bright_green()
);
Expand All @@ -321,7 +324,13 @@ fn collect_otp_secret() -> Result<OtpSecret, AkonError> {
let secret = prompt_password("TOTP Secret")?;

if secret.trim().is_empty() {
println!("❌ Secret cannot be empty. Please try again.");
println!(
"{} {}",
"[ERROR]".bright_red().bold(),
"Secret cannot be empty. Please try again."
.bright_red()
.bold()
);
continue;
}

Expand All @@ -330,8 +339,14 @@ fn collect_otp_secret() -> Result<OtpSecret, AkonError> {
match otp_secret.validate_base32() {
Ok(_) => return Ok(otp_secret),
Err(_) => {
println!("❌ Invalid Base32 format. Please check your secret and try again.");
println!(" Valid characters: A-Z, 2-7, =, /");
println!(
"{} {}",
"[ERROR]".bright_red().bold(),
"Invalid Base32 format. Please check your secret and try again."
.bright_red()
.bold()
);
println!(" Valid characters: A-Z, 2-7, =, /");
continue;
}
}
Expand All @@ -354,7 +369,11 @@ fn collect_pin() -> Result<Pin, AkonError> {
let candidate = pin_str.trim().to_string();

if candidate.is_empty() {
println!("❌ PIN cannot be empty. Please try again.");
println!(
"{} {}",
"[ERROR]".bright_red().bold(),
"PIN cannot be empty. Please try again.".bright_red().bold()
);
continue;
}

Expand Down Expand Up @@ -385,7 +404,13 @@ fn prompt_required(prompt: &str, default: &str) -> Result<String, AkonError> {
if !default.is_empty() {
return Ok(default.to_string());
}
println!("❌ This field is required. Please enter a value.");
println!(
"{} {}",
"[ERROR]".bright_red().bold(),
"This field is required. Please enter a value."
.bright_red()
.bold()
);
continue;
}

Expand Down
Loading