mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
fix: replace passwd with OTP on gateway MFA retry
Gateway login OTP retries were appending a second passwd form field instead of replacing the credential password. That regressed in 2.6.0 when login params moved from a HashMap to a Vec and could cause MFA submissions to fail with HTTP 512 (fix #626). Bump version to 2.6.4.
This commit is contained in:
5 files changed
+60
-11
No files matched your search
Generated
+8
-8
@@ -214,7 +214,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"block2",
|
"block2",
|
||||||
@@ -705,7 +705,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compile-time"
|
name = "compile-time"
|
||||||
@@ -1732,7 +1732,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -1776,7 +1776,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@@ -1796,7 +1796,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"askama",
|
"askama",
|
||||||
@@ -1825,7 +1825,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1843,7 +1843,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3191,7 +3191,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autotools",
|
"autotools",
|
||||||
"cc",
|
"cc",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.89"
|
rust-version = "1.89"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
authors = ["Kevin Yue <[email protected]>"]
|
authors = ["Kevin Yue <[email protected]>"]
|
||||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.6.4
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed gateway login MFA OTP retries sending duplicate `passwd` form fields, which could cause authentication to fail with HTTP 512 after 2.6.0 (fix [#626](https://github.com/yuezk/GlobalProtect-openconnect/issues/626)).
|
||||||
|
|
||||||
## 2.6.3
|
## 2.6.3
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ pub(crate) fn build(input: &GatewayLoginInput) -> RequestParams {
|
|||||||
input.gp_params.input_str().unwrap_or_default().into(),
|
input.gp_params.input_str().unwrap_or_default().into(),
|
||||||
));
|
));
|
||||||
if let Some(otp) = input.gp_params.otp() {
|
if let Some(otp) = input.gp_params.otp() {
|
||||||
body.push(("passwd".into(), otp.into()));
|
set_body_param(&mut body, "passwd", otp);
|
||||||
}
|
}
|
||||||
if let Some(os_version) = input.gp_params.os_version() {
|
if let Some(os_version) = input.gp_params.os_version() {
|
||||||
body.push(("os-version".into(), os_version.into()));
|
body.push(("os-version".into(), os_version.into()));
|
||||||
@@ -99,6 +99,15 @@ pub(crate) fn build(input: &GatewayLoginInput) -> RequestParams {
|
|||||||
RequestParams { body, query: vec![] }
|
RequestParams { body, query: vec![] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_body_param(body: &mut Vec<(String, String)>, key: &str, value: impl Into<String>) {
|
||||||
|
let value = value.into();
|
||||||
|
if let Some(pos) = body.iter().position(|(k, _)| k == key) {
|
||||||
|
body[pos].1 = value;
|
||||||
|
} else {
|
||||||
|
body.push((key.to_string(), value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Resolve the gateway server to an IPv4 address if the profile requires it.
|
/// Resolve the gateway server to an IPv4 address if the profile requires it.
|
||||||
///
|
///
|
||||||
/// Falls back to the original gateway host if resolution fails.
|
/// Falls back to the original gateway host if resolution fails.
|
||||||
@@ -153,6 +162,40 @@ mod tests {
|
|||||||
Credential::Password(PasswordCredential::new("alice", "secret"))
|
Credential::Password(PasswordCredential::new("alice", "secret"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn passwd_values(body: &[(String, String)]) -> Vec<&str> {
|
||||||
|
body
|
||||||
|
.iter()
|
||||||
|
.filter(|(k, _)| k == "passwd")
|
||||||
|
.map(|(_, v)| v.as_str())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn otp_retry_replaces_passwd_instead_of_appending_duplicate() {
|
||||||
|
let mut gp_params = make_gp_params();
|
||||||
|
gp_params.set_input_str("challenge-token");
|
||||||
|
gp_params.set_otp("123456");
|
||||||
|
|
||||||
|
let cred = make_credential();
|
||||||
|
let input = GatewayLoginInput {
|
||||||
|
gp_params: &gp_params,
|
||||||
|
cred: &cred,
|
||||||
|
gateway_host: "vpn.example.com",
|
||||||
|
context: None,
|
||||||
|
client_ip: None,
|
||||||
|
extend_lifetime: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = build(&input);
|
||||||
|
|
||||||
|
assert_eq!(passwd_values(&result.body), vec!["123456"]);
|
||||||
|
|
||||||
|
let encoded = serde_urlencoded::to_string(&result.body).expect("form body should encode");
|
||||||
|
assert_eq!(encoded.matches("passwd=").count(), 1);
|
||||||
|
assert!(encoded.contains("passwd=123456"));
|
||||||
|
assert!(!encoded.contains("passwd=secret"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_without_context_includes_identity_fields() {
|
fn build_without_context_includes_identity_fields() {
|
||||||
let profile = test_profile(ClientOs::Linux);
|
let profile = test_profile(ClientOs::Linux);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
pname = "globalprotect-openconnect";
|
pname = "globalprotect-openconnect";
|
||||||
version = cargoToml.workspace.package.version;
|
version = cargoToml.workspace.package.version;
|
||||||
releaseTag = "v2.6.3";
|
releaseTag = "v2.6.4";
|
||||||
|
|
||||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user