mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
feat: support client certificate authentication (related #363)
This commit is contained in:
@@ -14,6 +14,8 @@ pub(crate) struct ConnectOptions {
|
||||
pub script: *const c_char,
|
||||
pub os: *const c_char,
|
||||
pub certificate: *const c_char,
|
||||
pub sslkey: *const c_char,
|
||||
pub key_password: *const c_char,
|
||||
pub servercert: *const c_char,
|
||||
|
||||
pub csd_uid: u32,
|
||||
|
@@ -63,6 +63,8 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
INFO("OS: %s", options->os);
|
||||
INFO("CSD_USER: %d", options->csd_uid);
|
||||
INFO("CSD_WRAPPER: %s", options->csd_wrapper);
|
||||
INFO("CERTIFICATE: %s", options->certificate);
|
||||
INFO("SSLKEY: %s", options->sslkey);
|
||||
INFO("RECONNECT_TIMEOUT: %d", options->reconnect_timeout);
|
||||
INFO("MTU: %d", options->mtu);
|
||||
INFO("DISABLE_IPV6: %d", options->disable_ipv6);
|
||||
@@ -80,6 +82,11 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
openconnect_set_protocol(vpninfo, "gp");
|
||||
openconnect_set_hostname(vpninfo, options->server);
|
||||
openconnect_set_cookie(vpninfo, options->cookie);
|
||||
openconnect_set_client_cert(vpninfo, options->certificate, options->sslkey);
|
||||
|
||||
if (options->key_password) {
|
||||
openconnect_set_key_password(vpninfo, options->key_password);
|
||||
}
|
||||
|
||||
if (options->os) {
|
||||
openconnect_set_reported_os(vpninfo, options->os);
|
||||
|
@@ -15,6 +15,8 @@ typedef struct vpn_options
|
||||
const char *script;
|
||||
const char *os;
|
||||
const char *certificate;
|
||||
const char *sslkey;
|
||||
const char *key_password;
|
||||
const char *servercert;
|
||||
|
||||
const uid_t csd_uid;
|
||||
|
Reference in New Issue
Block a user