mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
5 Commits
v2.4.2
...
69ef7f5cce
Author | SHA1 | Date | |
---|---|---|---|
|
69ef7f5cce | ||
|
2f90b73683 | ||
|
5186e80c6f | ||
|
4ff1c1dc1f | ||
|
c1427040f6 |
42
.github/workflows/build.yaml
vendored
42
.github/workflows/build.yaml
vendored
@@ -68,6 +68,47 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
source/gp/.build/tarball/*.tar.gz
|
source/gp/.build/tarball/*.tar.gz
|
||||||
|
|
||||||
|
tarball-offline:
|
||||||
|
if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- tarball
|
||||||
|
steps:
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9
|
||||||
|
|
||||||
|
- name: Prepare workspace
|
||||||
|
run: rm -rf source-offline && mkdir source-offline
|
||||||
|
|
||||||
|
- name: Download tarball
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: artifact-source
|
||||||
|
path: source-offline
|
||||||
|
|
||||||
|
- name: Create offline tarball
|
||||||
|
run: |
|
||||||
|
cd source-offline
|
||||||
|
|
||||||
|
offline_tarball=$(basename *.tar.gz .tar.gz).offline.tar.gz
|
||||||
|
|
||||||
|
# Extract the tarball
|
||||||
|
tar -xzf *.tar.gz
|
||||||
|
|
||||||
|
cd */
|
||||||
|
make tarball OFFLINE=1
|
||||||
|
|
||||||
|
# Rename the tarball to .offline.tar.gz
|
||||||
|
mv -v .build/tarball/*.tar.gz ../$offline_tarball
|
||||||
|
|
||||||
|
- name: Upload offline tarball
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: source-offline/*.offline.tar.gz
|
||||||
|
name: artifact-source-offline
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build-gp:
|
build-gp:
|
||||||
needs:
|
needs:
|
||||||
- setup-matrix
|
- setup-matrix
|
||||||
@@ -168,6 +209,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- tarball
|
- tarball
|
||||||
|
- tarball-offline
|
||||||
- build-gp
|
- build-gp
|
||||||
- build-gpgui
|
- build-gpgui
|
||||||
|
|
||||||
|
33
.github/workflows/publish.yaml
vendored
33
.github/workflows/publish.yaml
vendored
@@ -52,22 +52,26 @@ jobs:
|
|||||||
version: 9
|
version: 9
|
||||||
- name: Prepare workspace
|
- name: Prepare workspace
|
||||||
run: rm -rf publish-ppa && mkdir publish-ppa
|
run: rm -rf publish-ppa && mkdir publish-ppa
|
||||||
- name: Download ${{ inputs.tag }} source code
|
- name: Download ${{ inputs.tag }} offline source code
|
||||||
uses: robinraju/release-downloader@v1.9
|
env:
|
||||||
with:
|
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
token: ${{ secrets.GH_PAT }}
|
run: |
|
||||||
tag: ${{ inputs.tag }}
|
gh -R yuezk/GlobalProtect-openconnect \
|
||||||
fileName: globalprotect-openconnect-*.tar.gz
|
release download ${{ inputs.tag }} \
|
||||||
tarBall: false
|
--pattern '*.offline.tar.gz' \
|
||||||
zipBall: false
|
--dir publish-ppa
|
||||||
out-file-path: publish-ppa
|
- name: Patch the source code
|
||||||
- name: Make the offline tarball
|
|
||||||
run: |
|
run: |
|
||||||
cd publish-ppa
|
cd publish-ppa
|
||||||
tar -xf globalprotect-openconnect-*.tar.gz
|
|
||||||
cd globalprotect-openconnect-*/
|
|
||||||
|
|
||||||
make tarball OFFLINE=1
|
# Rename the source tarball without the offline suffix
|
||||||
|
mv -v *.tar.gz $(basename *.tar.gz .offline.tar.gz).tar.gz
|
||||||
|
|
||||||
|
# Extract the source tarball
|
||||||
|
tar -xzf *.tar.gz
|
||||||
|
|
||||||
|
# Prepare the debian directory with custom files
|
||||||
|
cd globalprotect-openconnect-*/
|
||||||
|
|
||||||
# Prepare the debian directory with custom files
|
# Prepare the debian directory with custom files
|
||||||
mkdir -p .build/debian
|
mkdir -p .build/debian
|
||||||
@@ -78,7 +82,6 @@ jobs:
|
|||||||
cp -v packaging/deb/postrm .build/debian/postrm
|
cp -v packaging/deb/postrm .build/debian/postrm
|
||||||
|
|
||||||
sed -i "s/@RUST@/cargo-1.80/g" .build/debian/control
|
sed -i "s/@RUST@/cargo-1.80/g" .build/debian/control
|
||||||
|
|
||||||
sed -i "s/@OFFLINE@/1/g" .build/debian/rules
|
sed -i "s/@OFFLINE@/1/g" .build/debian/rules
|
||||||
sed -i "s/@BUILD_GUI@/1/g" .build/debian/rules
|
sed -i "s/@BUILD_GUI@/1/g" .build/debian/rules
|
||||||
sed -i "s/@RUST_VERSION@/1.80/g" .build/debian/rules
|
sed -i "s/@RUST_VERSION@/1.80/g" .build/debian/rules
|
||||||
@@ -89,7 +92,7 @@ jobs:
|
|||||||
repository: "yuezk/globalprotect-openconnect"
|
repository: "yuezk/globalprotect-openconnect"
|
||||||
gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
|
gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
|
||||||
gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
|
gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
|
||||||
tarball: publish-ppa/globalprotect-openconnect-*/.build/tarball/*.tar.gz
|
tarball: publish-ppa/globalprotect-openconnect-*.tar.gz
|
||||||
debian_dir: publish-ppa/globalprotect-openconnect-*/.build/debian
|
debian_dir: publish-ppa/globalprotect-openconnect-*/.build/debian
|
||||||
deb_email: "k3vinyue@gmail.com"
|
deb_email: "k3vinyue@gmail.com"
|
||||||
deb_fullname: "Kevin Yue"
|
deb_fullname: "Kevin Yue"
|
||||||
|
17
.github/workflows/release.yaml
vendored
17
.github/workflows/release.yaml
vendored
@@ -96,15 +96,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Prepare workspace
|
- name: Prepare workspace
|
||||||
run: rm -rf build-${{ matrix.package }} && mkdir -p build-${{ matrix.package }}
|
run: rm -rf build-${{ matrix.package }} && mkdir -p build-${{ matrix.package }}
|
||||||
|
|
||||||
- name: Download ${{ inputs.tag }} source code
|
- name: Download ${{ inputs.tag }} source code
|
||||||
uses: robinraju/release-downloader@v1.9
|
env:
|
||||||
with:
|
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
token: ${{ secrets.GH_PAT }}
|
run: |
|
||||||
tag: ${{ inputs.tag }}
|
gh -R yuezk/GlobalProtect-openconnect \
|
||||||
fileName: globalprotect-openconnect-*.tar.gz
|
release download ${{ inputs.tag }} \
|
||||||
tarBall: false
|
--pattern '*[^offline].tar.gz' \
|
||||||
zipBall: false
|
--dir build-${{ matrix.package }}
|
||||||
out-file-path: build-${{ matrix.package }}
|
|
||||||
- name: Docker Login
|
- name: Docker Login
|
||||||
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
||||||
- name: Build ${{ matrix.package }} package in Docker
|
- name: Build ${{ matrix.package }} package in Docker
|
||||||
|
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -176,7 +176,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"block2",
|
"block2",
|
||||||
@@ -642,7 +642,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"is_executable",
|
"is_executable",
|
||||||
]
|
]
|
||||||
@@ -1590,7 +1590,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -1626,7 +1626,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@@ -1645,7 +1645,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1667,7 +1667,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1685,7 +1685,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -2951,7 +2951,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"common",
|
"common",
|
||||||
|
@@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.80"
|
rust-version = "1.80"
|
||||||
version = "2.4.2"
|
version = "2.4.3"
|
||||||
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
|
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
|
||||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
@@ -70,7 +70,7 @@ The GUI version is also available after you installed it. You can launch it from
|
|||||||
|
|
||||||
### Debian/Ubuntu based distributions
|
### Debian/Ubuntu based distributions
|
||||||
|
|
||||||
#### Install from PPA (Ubuntu > 18.04)
|
#### Install from PPA
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
|
sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
|
||||||
@@ -81,10 +81,6 @@ sudo apt-get install globalprotect-openconnect
|
|||||||
>
|
>
|
||||||
> For Linux Mint, you might need to import the GPG key with: `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7937C393082992E5D6E4A60453FC26B43838D761` if you encountered an error `gpg: keyserver receive failed: General error`.
|
> For Linux Mint, you might need to import the GPG key with: `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7937C393082992E5D6E4A60453FC26B43838D761` if you encountered an error `gpg: keyserver receive failed: General error`.
|
||||||
|
|
||||||
#### **Ubuntu 18.04**
|
|
||||||
|
|
||||||
The latest package is not available in the PPA, but you still needs to add the `ppa:yuezk/globalprotect-openconnect` repo beforehand to use the required `openconnect` package. Then you can follow the [Install from deb package](#install-from-deb-package) section to install the latest package.
|
|
||||||
|
|
||||||
#### Install from deb package
|
#### Install from deb package
|
||||||
|
|
||||||
Download the latest deb package from [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page. Then install it with `apt`:
|
Download the latest deb package from [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page. Then install it with `apt`:
|
||||||
|
@@ -1,17 +1,21 @@
|
|||||||
use std::{env::temp_dir, fs::File};
|
use std::{env::temp_dir, fs::File, str::FromStr};
|
||||||
|
|
||||||
|
use anyhow::bail;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use gpapi::{
|
use gpapi::{
|
||||||
clap::{handle_error, Args, InfoLevelVerbosity},
|
clap::{handle_error, Args, InfoLevelVerbosity},
|
||||||
utils::openssl,
|
utils::openssl,
|
||||||
};
|
};
|
||||||
use log::info;
|
use log::info;
|
||||||
|
use sysinfo::{Pid, System};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
use tokio::fs;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
connect::{ConnectArgs, ConnectHandler},
|
connect::{ConnectArgs, ConnectHandler},
|
||||||
disconnect::{DisconnectArgs, DisconnectHandler},
|
disconnect::{DisconnectArgs, DisconnectHandler},
|
||||||
launch_gui::{LaunchGuiArgs, LaunchGuiHandler},
|
launch_gui::{LaunchGuiArgs, LaunchGuiHandler},
|
||||||
|
GP_CLIENT_LOCK_FILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", compile_time::date_str!(), ")");
|
const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", compile_time::date_str!(), ")");
|
||||||
@@ -77,6 +81,25 @@ impl Args for Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Cli {
|
impl Cli {
|
||||||
|
async fn is_running(&self) -> bool {
|
||||||
|
let Ok(c) = fs::read_to_string(GP_CLIENT_LOCK_FILE).await else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
let Ok(pid) = Pid::from_str(c.trim()) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
let s = System::new_all();
|
||||||
|
let Some(p) = s.process(pid) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
p.exe()
|
||||||
|
.map(|exe| exe.to_string_lossy().contains("gpclient"))
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
fn fix_openssl(&self) -> anyhow::Result<Option<NamedTempFile>> {
|
fn fix_openssl(&self) -> anyhow::Result<Option<NamedTempFile>> {
|
||||||
if self.fix_openssl {
|
if self.fix_openssl {
|
||||||
let file = openssl::fix_openssl_env()?;
|
let file = openssl::fix_openssl_env()?;
|
||||||
@@ -87,6 +110,11 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run(&self) -> anyhow::Result<()> {
|
async fn run(&self) -> anyhow::Result<()> {
|
||||||
|
// check if an instance is running
|
||||||
|
if self.is_running().await {
|
||||||
|
bail!("Another instance of the client is already running");
|
||||||
|
}
|
||||||
|
|
||||||
// The temp file will be dropped automatically when the file handle is dropped
|
// The temp file will be dropped automatically when the file handle is dropped
|
||||||
// So, declare it here to ensure it's not dropped
|
// So, declare it here to ensure it's not dropped
|
||||||
let _file = self.fix_openssl()?;
|
let _file = self.fix_openssl()?;
|
||||||
|
@@ -87,8 +87,8 @@ pub(crate) struct ConnectArgs {
|
|||||||
#[arg(long, value_enum, default_value_t = ConnectArgs::default_os())]
|
#[arg(long, value_enum, default_value_t = ConnectArgs::default_os())]
|
||||||
os: Os,
|
os: Os,
|
||||||
|
|
||||||
#[arg(long, default_value_t = ConnectArgs::default_os_version())]
|
#[arg(long, help = "If not specified, it will be computed based on the --os option")]
|
||||||
os_version: String,
|
os_version: Option<String>,
|
||||||
|
|
||||||
#[arg(long, help = "Disable DTLS and ESP")]
|
#[arg(long, help = "Disable DTLS and ESP")]
|
||||||
no_dtls: bool,
|
no_dtls: bool,
|
||||||
@@ -121,8 +121,12 @@ impl ConnectArgs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_os_version() -> String {
|
fn os_version(&self) -> String {
|
||||||
match ConnectArgs::default_os() {
|
if let Some(os_version) = self.os_version.as_deref() {
|
||||||
|
return os_version.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
match self.os {
|
||||||
Os::Linux => format!("Linux {}", whoami::distro()),
|
Os::Linux => format!("Linux {}", whoami::distro()),
|
||||||
Os::Windows => String::from("Microsoft Windows 11 Pro , 64-bit"),
|
Os::Windows => String::from("Microsoft Windows 11 Pro , 64-bit"),
|
||||||
Os::Mac => String::from("Apple Mac OS X 13.4.0"),
|
Os::Mac => String::from("Apple Mac OS X 13.4.0"),
|
||||||
@@ -149,7 +153,7 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
GpParams::builder()
|
GpParams::builder()
|
||||||
.user_agent(&self.args.user_agent)
|
.user_agent(&self.args.user_agent)
|
||||||
.client_os(ClientOs::from(&self.args.os))
|
.client_os(ClientOs::from(&self.args.os))
|
||||||
.os_version(self.args.os_version.clone())
|
.os_version(self.args.os_version())
|
||||||
.ignore_tls_errors(self.shared_args.ignore_tls_errors)
|
.ignore_tls_errors(self.shared_args.ignore_tls_errors)
|
||||||
.certificate(self.args.certificate.clone())
|
.certificate(self.args.certificate.clone())
|
||||||
.sslkey(self.args.sslkey.clone())
|
.sslkey(self.args.sslkey.clone())
|
||||||
@@ -359,7 +363,7 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let os_version = self.args.os_version.clone();
|
let os_version = self.args.os_version();
|
||||||
let verbose = self.shared_args.verbose.to_verbose_arg();
|
let verbose = self.shared_args.verbose.to_verbose_arg();
|
||||||
let auth_launcher = SamlAuthLauncher::new(&self.args.server)
|
let auth_launcher = SamlAuthLauncher::new(&self.args.server)
|
||||||
.gateway(is_gateway)
|
.gateway(is_gateway)
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.4.3 - 2025-01-21
|
||||||
|
|
||||||
|
- Do not use static default value for `--os-version` option.
|
||||||
|
|
||||||
## 2.4.2 - 2025-01-20
|
## 2.4.2 - 2025-01-20
|
||||||
|
|
||||||
- Disconnect the VPN when sleep (fix [#166](https://github.com/yuezk/GlobalProtect-openconnect/issues/166), [#267](https://github.com/yuezk/GlobalProtect-openconnect/issues/267))
|
- Disconnect the VPN when sleep (fix [#166](https://github.com/yuezk/GlobalProtect-openconnect/issues/166), [#267](https://github.com/yuezk/GlobalProtect-openconnect/issues/267))
|
||||||
|
@@ -28,7 +28,7 @@ release_snapshot() {
|
|||||||
|
|
||||||
echo "Uploading new assets..."
|
echo "Uploading new assets..."
|
||||||
gh -R "$REPO" release upload "$TAG" \
|
gh -R "$REPO" release upload "$TAG" \
|
||||||
"$PROJECT_DIR"/.build/artifacts/artifact-source/* \
|
"$PROJECT_DIR"/.build/artifacts/artifact-source*/* \
|
||||||
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
|
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ release_tag() {
|
|||||||
gh -R "$REPO" release create $TAG \
|
gh -R "$REPO" release create $TAG \
|
||||||
--title "$TAG" \
|
--title "$TAG" \
|
||||||
--notes "$RELEASE_NOTES" \
|
--notes "$RELEASE_NOTES" \
|
||||||
"$PROJECT_DIR"/.build/artifacts/artifact-source/* \
|
"$PROJECT_DIR"/.build/artifacts/artifact-source*/* \
|
||||||
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
|
"$PROJECT_DIR"/.build/artifacts/artifact-gpgui-*/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user