Files
Kevin Yue 408536807c chore: promote GP Connect 3.3.1 sources and Nix packages (#699)
* fix: restore client certificate compatibility after OpenSSL removal

Use GnuTLS for desktop client key matching and signing without applying server certificate policy to local identities. Restore RC4 PKCS12 import and renewed certificate selection, and provide actionable unsupported identity errors.

Add HTTP and OpenConnect mutual TLS regressions. Record the unresolved TLS 1.2 ECDSA hash limitation and reject P-521 and RSA-PSS keys explicitly.

* fix: select PKCS12 issuers by certificate signature

Handle CA rollover and self-issued intermediates by checking issuer signatures. Preserve RSA-PSS signature parameters during GnuTLS verification and keep the original archive for OpenConnect.

Add mutual-TLS regression coverage for certificate bag order and RSA-PSS salt lengths. Verified 53 targeted tests plus gpapi, desktop-core, and iOS compile checks.

* fix: add gateway login diagnostics and scope platform dependencies

* chore: prepare GP Connect 3.3.1 release
2026-11-09 00:51:46 +08:00

84 lines
2.5 KiB
Rust

//! Actual OpenConnect credential loading and mutual TLS, without creating a VPN tunnel.
use std::{
fs,
os::unix::process::CommandExt,
path::{Path, PathBuf},
process::{Child, Command},
time::{Duration, Instant},
};
struct ChildGuard(Child);
impl Drop for ChildGuard {
fn drop(&mut self) {
unsafe { libc::kill(-(self.0.id() as i32), libc::SIGKILL) };
let _ = self.0.wait();
}
}
fn run_bounded(command: &mut Command, log: &Path) {
let output = fs::File::create(log).unwrap();
let mut child = ChildGuard(
command
.process_group(0)
.stdout(output.try_clone().unwrap())
.stderr(output)
.spawn()
.unwrap(),
);
let deadline = Instant::now() + Duration::from_secs(45);
loop {
if let Some(status) = child.0.try_wait().unwrap() {
assert!(status.success(), "{status}: {}", fs::read_to_string(log).unwrap());
return;
}
assert!(
Instant::now() < deadline,
"Client identity test timed out: {}",
fs::read_to_string(log).unwrap()
);
std::thread::sleep(Duration::from_millis(20));
}
}
#[test]
fn client_identities_complete_openconnect_tls12_and_tls13() {
let manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let build = PathBuf::from(env!("OPENCONNECT_PROTOCOL_BUILD"));
let source = PathBuf::from(env!("OPENCONNECT_PROTOCOL_SOURCE"));
let directory = tempfile::tempdir().unwrap();
let executable = directory.path().join("client-identity");
let flags = Command::new("pkg-config")
.args(["--cflags", "--libs", "libxml-2.0", "gnutls"])
.output()
.unwrap();
assert!(flags.status.success(), "{}", String::from_utf8_lossy(&flags.stderr));
run_bounded(
Command::new(build.join("libtool"))
.args(["--mode=link", "cc", "-pthread"])
.arg(manifest.join("tests/client_identity.c"))
.arg("-I")
.arg(&build)
.arg("-I")
.arg(&source)
.arg("-I")
.arg(source.join("json"))
.arg(build.join("libopenconnect.la"))
.args(String::from_utf8(flags.stdout).unwrap().split_whitespace())
.arg("-o")
.arg(&executable),
&directory.path().join("compile.log"),
);
let server = manifest.join("deps/openconnect/tests/certs");
run_bounded(
Command::new(build.join("libtool"))
.arg("--mode=execute")
.arg(executable)
.arg(manifest.join("../gpapi/tests/files/client-identity"))
.arg(server.join("server-cert.pem"))
.arg(server.join("server-key.pem"))
.arg(server.join("ca.pem"))
.arg(directory.path()),
&directory.path().join("runtime.log"),
);
}