mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-17 13:46:27 -05:00
fix: complete 2.6.1 release updates
This commit is contained in:
1 parent
40739739b5
commit
6746cf64c3
8 files changed
+171
-54
No files matched your search
@@ -305,58 +305,6 @@ jobs:
|
||||
gpgui-source/*.bin.tar.xz
|
||||
gpgui-source/*.bin.tar.xz.sha256
|
||||
|
||||
build-nix-prebuilt:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-26.05
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-26.05
|
||||
name: build-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
repository: yuezk/GlobalProtect-openconnect
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Build prebuilt Nix package
|
||||
run: |
|
||||
nix build .#prebuilt \
|
||||
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
|
||||
- name: Inspect prebuilt Nix package
|
||||
run: |
|
||||
test -x result/bin/gpclient
|
||||
test -x result/bin/gpauth
|
||||
test -x result/bin/gpservice
|
||||
test -x result/bin/gpgui-helper
|
||||
test -x result/bin/gpgui
|
||||
test ! -L result/bin/gpservice
|
||||
head -n1 result/bin/gpclient | grep '^#!'
|
||||
head -n1 result/bin/gpservice | grep '^#!'
|
||||
grep -q '/run/wrappers/bin/pkexec' result/bin/gpclient
|
||||
grep -q 'gpservice_public=.*/bin/gpservice' result/bin/gpclient
|
||||
grep -q 'exec .*/bin/gpservice' result/bin/gpservice
|
||||
! grep -q '@gpservice_public@\|@gpservice_fhs@\|\$out/bin/gpservice' result/bin/gpclient result/bin/gpservice
|
||||
|
||||
! grep -R '/usr/bin/gp' result/share
|
||||
|
||||
setup-bsd-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
|
||||
@@ -31,6 +31,83 @@ jobs:
|
||||
scripts/update-flake-hashes.sh
|
||||
fi
|
||||
|
||||
- name: Upload updated flake
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: updated-flake
|
||||
path: flake.nix
|
||||
if-no-files-found: error
|
||||
|
||||
validate-nix-prebuilt:
|
||||
needs:
|
||||
- update-flake-hashes
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-26.05
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-26.05
|
||||
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Download updated flake
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: updated-flake
|
||||
path: .
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Build prebuilt Nix package
|
||||
run: |
|
||||
nix build .#prebuilt \
|
||||
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
|
||||
- name: Inspect prebuilt Nix package
|
||||
run: |
|
||||
test -x result/bin/gpclient
|
||||
test -x result/bin/gpauth
|
||||
test -x result/bin/gpservice
|
||||
test -x result/bin/gpgui-helper
|
||||
test -x result/bin/gpgui
|
||||
test ! -L result/bin/gpservice
|
||||
head -n1 result/bin/gpclient | grep '^#!'
|
||||
head -n1 result/bin/gpservice | grep '^#!'
|
||||
grep -q '/run/wrappers/bin/pkexec' result/bin/gpclient
|
||||
grep -q 'gpservice_public=.*/bin/gpservice' result/bin/gpclient
|
||||
grep -q 'exec .*/bin/gpservice' result/bin/gpservice
|
||||
! grep -q '@gpservice_public@\|@gpservice_fhs@\|\$out/bin/gpservice' result/bin/gpclient result/bin/gpservice
|
||||
|
||||
! grep -R '/usr/bin/gp' result/share
|
||||
|
||||
open-pull-request:
|
||||
needs:
|
||||
- validate-nix-prebuilt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Download updated flake
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: updated-flake
|
||||
path: .
|
||||
|
||||
- name: Open pull request
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
@@ -57,6 +57,19 @@ struct Cli {
|
||||
#[arg(long, help = "Override the GlobalProtect client version reported to the server")]
|
||||
client_version: Option<String>,
|
||||
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
help = "Use SSL client certificate file in pkcs#8 (.pem) or pkcs#12 (.p12, .pfx) format"
|
||||
)]
|
||||
certificate: Option<String>,
|
||||
|
||||
#[arg(short = 'k', long, help = "Use SSL private key file in pkcs#8 (.pem) format")]
|
||||
sslkey: Option<String>,
|
||||
|
||||
#[arg(short = 'p', long, help = "The key passphrase of the private key")]
|
||||
key_password: Option<String>,
|
||||
|
||||
#[arg(long, help = "Get around the OpenSSL `unsafe legacy renegotiation` error")]
|
||||
fix_openssl: bool,
|
||||
|
||||
@@ -161,6 +174,9 @@ impl Cli {
|
||||
fn build_gp_params(&self) -> GpParams {
|
||||
GpParams::builder(self.build_os_profile())
|
||||
.ignore_tls_errors(self.ignore_tls_errors)
|
||||
.certificate(self.certificate.clone())
|
||||
.sslkey(self.sslkey.clone())
|
||||
.key_password(self.key_password.clone())
|
||||
.is_gateway(self.gateway)
|
||||
.build()
|
||||
}
|
||||
@@ -276,4 +292,23 @@ mod tests {
|
||||
assert_eq!(profile.client_version(), "legacy-client");
|
||||
assert!(profile.user_agent().contains("legacy-client"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn client_certificate_args_parse() {
|
||||
let cli = Cli::try_parse_from([
|
||||
"gpauth",
|
||||
"portal.example.com",
|
||||
"--certificate",
|
||||
"/tmp/client.pem",
|
||||
"--sslkey",
|
||||
"/tmp/client.key",
|
||||
"--key-password",
|
||||
"secret",
|
||||
])
|
||||
.expect("gpauth args should parse");
|
||||
|
||||
assert_eq!(cli.certificate.as_deref(), Some("/tmp/client.pem"));
|
||||
assert_eq!(cli.sslkey.as_deref(), Some("/tmp/client.key"));
|
||||
assert_eq!(cli.key_password.as_deref(), Some("secret"));
|
||||
}
|
||||
}
|
||||
@@ -74,12 +74,16 @@ impl ConnectHandler<'_> {
|
||||
};
|
||||
let verbose = self.shared_args.verbose.to_verbose_arg();
|
||||
let os_profile = self.os_profile.borrow().clone();
|
||||
let key_password = self.latest_key_password.borrow().clone();
|
||||
let auth_launcher = SamlAuthLauncher::new(server)
|
||||
.gateway(is_gateway)
|
||||
.saml_request(prelogin.saml_request())
|
||||
.os_profile(&os_profile)
|
||||
.fix_openssl(self.shared_args.fix_openssl)
|
||||
.ignore_tls_errors(self.shared_args.ignore_tls_errors)
|
||||
.certificate(self.args.certificate.as_deref())
|
||||
.sslkey(self.args.sslkey.as_deref())
|
||||
.key_password(key_password.as_deref())
|
||||
.browser(browser)
|
||||
.verbose(verbose);
|
||||
|
||||
|
||||
@@ -139,8 +139,11 @@ impl ConnectHandler<'_> {
|
||||
let mut gp_params = self.build_gp_params();
|
||||
gp_params.set_is_gateway(true);
|
||||
|
||||
let prelogin = prelogin(gateway, &gp_params, self.prelogin_options(true)).await?;
|
||||
let cred = self.obtain_credential(&prelogin, gateway, true).await?;
|
||||
let gateway_external_browser_allowed = true;
|
||||
let prelogin = prelogin(gateway, &gp_params, self.direct_gateway_prelogin_options()).await?;
|
||||
let cred = self
|
||||
.obtain_credential(&prelogin, gateway, gateway_external_browser_allowed)
|
||||
.await?;
|
||||
|
||||
let login_session = self
|
||||
.login_gateway(gateway, &cred, &gp_params, gateway_context.as_ref())
|
||||
|
||||
@@ -71,6 +71,10 @@ impl<'a> ConnectHandler<'a> {
|
||||
.gateway_external_browser_allowed(gateway_external_browser_allowed)
|
||||
}
|
||||
|
||||
pub(super) fn direct_gateway_prelogin_options(&self) -> PreloginOptions {
|
||||
self.prelogin_options(true)
|
||||
}
|
||||
|
||||
fn external_browser_requested(&self) -> bool {
|
||||
#[cfg(feature = "webview-auth")]
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
- Fixed NixOS GUI launch failures caused by package-local binary paths.
|
||||
- Fixed NixOS tray icon setup documentation for GNOME desktops.
|
||||
- Fixed browser authentication for portals that require a client certificate.
|
||||
- Fixed release automation so Nix flake hash updates are run manually after release assets are available.
|
||||
|
||||
## 2.6.0
|
||||
|
||||
@@ -16,6 +16,9 @@ pub struct SamlAuthLauncher<'a> {
|
||||
os: Option<&'a str>,
|
||||
host_id: Option<&'a str>,
|
||||
client_version: Option<&'a str>,
|
||||
certificate: Option<&'a str>,
|
||||
sslkey: Option<&'a str>,
|
||||
key_password: Option<&'a str>,
|
||||
fix_openssl: bool,
|
||||
ignore_tls_errors: bool,
|
||||
#[cfg(feature = "webview-auth")]
|
||||
@@ -38,6 +41,9 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
os: None,
|
||||
host_id: None,
|
||||
client_version: None,
|
||||
certificate: None,
|
||||
sslkey: None,
|
||||
key_password: None,
|
||||
fix_openssl: false,
|
||||
ignore_tls_errors: false,
|
||||
#[cfg(feature = "webview-auth")]
|
||||
@@ -83,6 +89,21 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn certificate(mut self, certificate: Option<&'a str>) -> Self {
|
||||
self.certificate = certificate;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn sslkey(mut self, sslkey: Option<&'a str>) -> Self {
|
||||
self.sslkey = sslkey;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn key_password(mut self, key_password: Option<&'a str>) -> Self {
|
||||
self.key_password = key_password;
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "webview-auth")]
|
||||
pub fn hidpi(mut self, hidpi: bool) -> Self {
|
||||
self.hidpi = hidpi;
|
||||
@@ -148,6 +169,18 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
auth_cmd.arg("--ignore-tls-errors");
|
||||
}
|
||||
|
||||
if let Some(certificate) = self.certificate {
|
||||
auth_cmd.arg("--certificate").arg(certificate);
|
||||
}
|
||||
|
||||
if let Some(sslkey) = self.sslkey {
|
||||
auth_cmd.arg("--sslkey").arg(sslkey);
|
||||
}
|
||||
|
||||
if let Some(key_password) = self.key_password {
|
||||
auth_cmd.arg("--key-password").arg(key_password);
|
||||
}
|
||||
|
||||
#[cfg(feature = "webview-auth")]
|
||||
{
|
||||
if self.hidpi {
|
||||
@@ -222,4 +255,16 @@ mod tests {
|
||||
|
||||
assert_eq!(launcher.client_version, Some("6.0.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn client_certificate_options_are_stored() {
|
||||
let launcher = SamlAuthLauncher::new("portal.example.com")
|
||||
.certificate(Some("/tmp/client.pem"))
|
||||
.sslkey(Some("/tmp/client.key"))
|
||||
.key_password(Some("secret"));
|
||||
|
||||
assert_eq!(launcher.certificate, Some("/tmp/client.pem"));
|
||||
assert_eq!(launcher.sslkey, Some("/tmp/client.key"));
|
||||
assert_eq!(launcher.key_password, Some("secret"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user