Commit graph

22 commits

Author SHA1 Message Date
Jiří Klimeš ea54b7f2c0 clients: add a helper function to get required openconnect VPN secrets
OpenConnect needs three secrets - COOKIE, HOST and FINGERPRINT. They can be
obtained by authenticating to the server. This can be performed by running
"openconnect --authenticate <host>" and the three values are printed to stdout.

Note that the function may (probably will) interactively ask user for
his credentials.

Alternatively, it would be possible to dlopen() libopenconnect and call its
functions. However, as that would be more complicated and would also require
implementing functionality that openconnect simply does for free for us, it is
not worth it, I think.
2015-12-12 17:37:30 +01:00
Jiří Klimeš 8dfafac17c clients: add vpn_type member to secret structure in secret agent
It is useful to know what VPN type the secret belongs to.
2015-12-12 17:37:30 +01:00
Jiří Klimeš 6dd1e2673e clients: move vpn_get_secret_names() to nm-vpn-helpers
It should eventually move into libnm and ideally the data be obtained from VPN
plugins.

(No functional change, only moving the function).
2015-12-12 17:37:30 +01:00
Jiří Klimeš de86c23fbe clients: enable VPN secrets for nmtui/nmcli secret agent (rh #975185)
It allows nmcli and nmtui to ask for VPN passwords and thus successfully
activate VPN connections.

https://bugzilla.redhat.com/show_bug.cgi?id=975185
2015-12-12 17:37:30 +01:00
Jiří Klimeš f28d311d13 clients: accept service without org.freedesktop.NetworkManager prefix
in nm_vpn_get_plugin_by_service()
2015-12-05 21:29:00 +01:00
Jiří Klimeš 96ab3a8a5c clients: add GError parameter to nm_vpn_get_plugin_by_service() 2015-12-05 21:29:00 +01:00
Jiří Klimeš 191f213c49 clients: (trivial) remove unused commented code in nm-vpn-helpers 2015-11-26 11:09:15 +01:00
Jiří Klimeš b8d6bd1a98 clients: move clients/tui/vpn-helpers.c to clients/common/nm-vpn-helpers.c
The file has not been used up to now. But it is going to be used by both
nmtui and nmcli later.
2015-11-26 11:08:44 +01:00
Jiří Klimeš 542200f539 clients: check errors of polkit_unix_session_new_for_process_sync()
polkit_unix_session_new_for_process_sync() can fail. And calling
polkit_agent_listener_register() with NULL PolkitSubject results in errors.

https://bugzilla.gnome.org/show_bug.cgi?id=758625
2015-11-25 12:08:07 +01:00
Dan Winship 22e1a97e12 all: drop includes to <glib/gi18n.h> for "nm-default.h"
The localization headers are now included via "nm-default.h".

Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
instead of <glib/gi18n.h>. For example under "clients/" directory.
2015-08-05 15:35:51 +02:00
Thomas Haller 19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship 3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Jiří Klimeš 55c3f70ec8 clients: fix bad array loop in nm-secret-agent-simple.c:strv_has (bgo #752137)
https://bugzilla.gnome.org/show_bug.cgi?id=752137
2015-07-10 12:41:47 +02:00
Dan Winship 71b4c05fca libnm: rename NMSecretAgent to NMSecretAgentOld
As with NMVpnPluginOld, rename NMSecretAgent to NMSecretAgentOld, to
leave the name "NMSecretAgent" open for a new-and-improved version in
NM 1.2.
2014-11-21 12:17:41 -05:00
Dan Williams 88c9c6a6ac clients: merge nm_secret_agent_simple_set_connection_path() into nm_secret_agent_simple_enable()
set_connection_path() is almost always called right before enable(),
and it's unclear why it would be called anywhere else.  So just
merge the two methods.
2014-11-21 12:14:48 -05:00
Dan Winship a1f746351a clients: NMSecretAgentSimple API fixups
nm_secret_agent_simple_*() functions should take an
NMSecretAgentSimple, not an NMSecretAgent.

The type macros were incorrectly validating against
NM_TYPE_SECRET_AGENT rather than NM_TYPE_SECRET_AGENT_SIMPLE.
2014-11-21 12:08:35 -05:00
Jiří Klimeš a1f16d255d clients: fix processing a secret agent request 2014-11-20 16:28:45 +01:00
Lubomir Rintel 991df80408 cli: Process secret agent request for a connection only if we know its path
If we're activating the device without knowing the connection in advance, defer
servicing the requests for the secrets until we set the path.

[lkundrak@fedora20-2 ~]$ nmcli --ask c ifname wlan0

(process:18405): libnm-CRITICAL **: nm_object_get_path: assertion 'NM_IS_OBJECT (object)' failed
Error: Connection activation failed: The device has no connections available.
[lkundrak@fedora20-2 ~]$
2014-11-20 16:00:58 +01:00
Jiří Klimeš a928ce89ef clients: only handle secret requests for connection being explicitly activated
When a connection is being activated, nmcli could ask for secrets for another
connection, which might confuse users. We check the request now and only ask
for secrets of connection being activated.

Test case:
$ nmcli con up my-ethernet0
Passwords or encryption keys are required to access the wireless network 'Red Hat'.
Warning: password for '802-1x.identity' not given in 'passwd-file' and nmcli cannot ask without '--ask' option.
2014-11-12 13:41:49 +01:00
Jiří Klimeš ca5d6be99c clients: add common code for polkit agent listener
that can be used by nmcli and nmtui
2014-11-07 11:37:42 +01:00
Jiří Klimeš b41cb60b45 clients: add real property name to NNSecretAgentSimpleSecret
It is necessary to identify secrets uniquely in nmcli.
2014-11-07 09:32:32 +01:00
Jiří Klimeš 801fc34d6f clients: move secret agent to common directory
The agent code will be shared by both nmtui and nmcli.
2014-11-07 09:32:24 +01:00