Commit dfbcf8b1 authored by Alejandro Valdes's avatar Alejandro Valdes Committed by Jan Grulich

Added new option to use GlobalProtect with openconnect

Summary:
This adds a new option to the dropdown and a new desktop file to create a connection to a Palo Alto / Global Protect network

FEATURE: 405389

Reviewers: jgrulich

Reviewed By: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D21111
parent 59672b81
......@@ -59,6 +59,7 @@ if (OPENCONNECT_FOUND)
install(TARGETS plasmanetworkmanagement_openconnectui DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES plasmanetworkmanagement_openconnectui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(FILES plasmanetworkmanagement_openconnect_juniperui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(FILES plasmanetworkmanagement_openconnect_globalprotectui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
else()
message("ERROR: OpenConnection version '${OPENCONNECT_VERSION}' does not match minimum required (${MINIMUM_OPENCONNECT_VERSION_REQUIRED})")
message("OpenConnect plugin will not be built")
......
......@@ -123,6 +123,11 @@
<string>Juniper/Pulse Network Connect</string>
</property>
</item>
<item>
<property name="text">
<string>PAN Global Protect</string>
</property>
</item>
</widget>
</item>
</layout>
......
......@@ -183,7 +183,16 @@ void OpenconnectSettingWidget::loadConfig(const NetworkManager::Setting::Ptr &se
// General settings
const NMStringMap dataMap = setting.staticCast<NetworkManager::VpnSetting>()->data();
d->ui.cmbProtocol->setCurrentIndex(dataMap[NM_OPENCONNECT_KEY_PROTOCOL] != QLatin1String("anyconnect"));
int cmbProtocolIndex;
if (dataMap[NM_OPENCONNECT_KEY_PROTOCOL] == QLatin1String("anyconnect")) {
cmbProtocolIndex = 0;
} else if (dataMap[NM_OPENCONNECT_KEY_PROTOCOL] == QLatin1String("nc")) {
cmbProtocolIndex = 1;
} else {
cmbProtocolIndex = 2; // paloAlto/GlobalProtect (gp)
}
d->ui.cmbProtocol->setCurrentIndex(cmbProtocolIndex);
d->ui.leGateway->setText(dataMap[NM_OPENCONNECT_KEY_GATEWAY]);
d->ui.leCaCertificate->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_CACERT]));
d->ui.leProxy->setText(dataMap[NM_OPENCONNECT_KEY_PROXY]);
......@@ -237,8 +246,19 @@ QVariantMap OpenconnectSettingWidget::setting() const
NMStringMap data;
NMStringMap secrets;
QString protocol;
switch (d->ui.cmbProtocol->currentIndex()) {
case 0:
protocol = QLatin1String("anyconnect");
break;
case 1:
protocol = QLatin1String("nc");
break;
default:
protocol = QLatin1String("gp");
}
data.insert(NM_OPENCONNECT_KEY_PROTOCOL, d->ui.cmbProtocol->currentIndex() ? QLatin1String("nc") : QLatin1String("anyconnect"));
data.insert(NM_OPENCONNECT_KEY_PROTOCOL, protocol);
data.insert(QLatin1String(NM_OPENCONNECT_KEY_GATEWAY), d->ui.leGateway->text());
if (d->ui.leCaCertificate->url().isValid()) {
data.insert(QLatin1String(NM_OPENCONNECT_KEY_CACERT), d->ui.leCaCertificate->url().toLocalFile());
......
[Desktop Entry]
Type=Service
Icon=
ServiceTypes=PlasmaNetworkManagement/VpnUiPlugin
X-KDE-Library=plasmanetworkmanagement_openconnectui
X-NetworkManager-Services=org.freedesktop.NetworkManager.openconnect
X-NetworkManager-Services-Subtype=gp
X-KDE-PluginInfo-Author=Jan Grulich
X-KDE-PluginInfo-Email=jgrulich@redhat.com
X-KDE-PluginInfo-Name=plasmanetworkmanagement_openconnectui
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=VPNService
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
Name=PAN Global Protect (openconnect)
Comment=Compatible with PAN GlobalProtect SSL VPN
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment