Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to tune the VPN useragent #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions auth-dialog/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,10 @@ static int get_config (auth_ui_data *ui_data,
if (!g_strcmp0(protocol, "pulse"))
ui_data->connect_urlpath = TRUE;

useragent = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_USERAGENT);
if (useragent)
openconnect_set_useragent(vpninfo, OC3DUP(useragent));

cafile = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_CACERT);
if (cafile)
openconnect_set_cafile(vpninfo, OC3DUP (cafile));
Expand Down
12 changes: 12 additions & 0 deletions properties/nm-openconnect-editor-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
if (buf)
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PROXY, buf);

/* UserAgent */
buf = g_key_file_get_string (keyfile, "openconnect", "UserAgent", NULL);
if (buf)
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_USERAGENT, buf);

/* Cisco Secure Desktop */
bval = g_key_file_get_boolean (keyfile, "openconnect", "CSDEnable", NULL);
if (bval)
Expand Down Expand Up @@ -290,6 +295,7 @@ export (NMVpnEditorPlugin *iface,
const char *cacert = NULL;
const char *protocol = NULL;
const char *proxy = NULL;
const char *useragent = NULL;
gboolean csd_enable = FALSE;
const char *csd_wrapper = NULL;
const char *reported_os = NULL;
Expand Down Expand Up @@ -338,6 +344,10 @@ export (NMVpnEditorPlugin *iface,
if (value && strlen (value))
proxy = value;

value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERAGENT);
if (value && strlen (value))
useragent = value;

value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_ENABLE);
if (value && !strcmp (value, "yes"))
csd_enable = TRUE;
Expand Down Expand Up @@ -387,6 +397,7 @@ export (NMVpnEditorPlugin *iface,
"Protocol=%s\n"
"Proxy=%s\n"
"CSDEnable=%s\n"
"UserAgent=%s\n"
"CSDWrapper=%s\n"
"ReportedOS=%s\n"
"UserCertificate=%s\n"
Expand All @@ -401,6 +412,7 @@ export (NMVpnEditorPlugin *iface,
/* Protocol */ protocol ? protocol : "anyconnect",
/* Proxy */ proxy ? proxy : "",
/* Cisco Secure Desktop */ csd_enable ? "1" : "0",
/* UserAgent */ useragent ? useragent : "",
/* CSD Wrapper Script */ csd_wrapper ? csd_wrapper : "",
/* Reported OS */ reported_os ? reported_os : "",
/* User Certificate */ usercert ? usercert : "",
Expand Down
5 changes: 5 additions & 0 deletions properties/nm-openconnect-editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ update_connection (NMVpnEditor *iface,
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PROXY, str);

widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_agent_entry"));
str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_USERAGENT, str);

widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "fsid_button"));
str = gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))?"yes":"no";
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID, str);
Expand Down
1 change: 1 addition & 0 deletions shared/nm-service-defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#define NM_OPENCONNECT_KEY_PROTOCOL "protocol"
#define NM_OPENCONNECT_KEY_PROXY "proxy"
#define NM_OPENCONNECT_KEY_CSD_ENABLE "enable_csd_trojan"
#define NM_OPENCONNECT_KEY_USERAGENT "useragent"
#define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper"
#define NM_OPENCONNECT_KEY_TOKEN_MODE "stoken_source"
#define NM_OPENCONNECT_KEY_TOKEN_SECRET "stoken_string"
Expand Down