Commit graph

2336 commits

Author SHA1 Message Date
Dan Williams
aafe74ee34 vpn: get existing secrets before asking VPN service if we need more
This allows administrators to define VPN connections that use all
or partial system-owned secrets that users aren't allowed to modify.
2011-02-09 00:54:00 -06:00
Dan Williams
b94fb03197 settings: mark secrets as not required if they aren't sent to an agent
If the agent doesn't have privileges for secrets, mark them as not
required to help any UI validation the agent might have to do.
2011-02-07 23:45:19 -06:00
Dan Williams
007ca5bf1f settings: use new NMSettingConnection permissions helpers 2011-02-07 18:43:08 -06:00
Dan Williams
d8cbecec8b settings: streamline system-owned secret handling during agent requests
Do the check for system-owned secrets once, before kicking off the
request, instead of each time we ask an agent.  As a bonus, this
change ensures priv->secrets doesn't store anything except
system-owned secrets too, simplifying some checks later on.
2011-02-07 13:58:05 -06:00
Dan Williams
899b8a40dc libnm-util: NM_SETTING_SECRET_FLAG_SYSTEM_OWNED -> NM_SETTING_SECRET_FLAG_NONE
Make it a bit clearer that this value is not actually a value that
can be used as a flag, since its 0x00.
2011-02-06 23:37:39 -06:00
Dan Williams
e2d297e5ff settings: fix loading of keyfile connections
Updating unmanaged specs may cause load_connections() to be called,
and the keyfile plugin needs to be registered before that.
2011-02-02 20:32:15 -06:00
Dan Williams
77239854f4 agents: send system-owned secrets to the agent if it has 'modify' permission
If we can authenticate the agent for 'modify' permission, then send
any existing system secrets to it as the user has permission to change
those secrets.  This means the agent doesn't have to call GetSecrets()
itself, which means simpler code on the agent side for a slight LoC
hit in NM itself.

This also moves the permissions checking into the NMAgentManager to
check each agent, which is sub-optimal since now the agent manager
has to do PolicyKit stuff, but hey that's life.  Agents need secrets,
and we do need to authenticate every agent before we send secrets to
them, and the NMSettingsConnection doesn't know about individual
agents at all.
2011-02-02 16:19:15 -06:00
Dan Williams
dc78aa19c9 wifi: don't need secrets if the connection says we don't 2011-02-02 16:17:10 -06:00
Dan Williams
76aabe4b72 settings: ensure an agent is authorized before overwriting system-owned secrets
If the agent returns system-owned secrets, like when activating a new
connection which was created with no secrets, make sure the agent is
authorized to modify network settings before saving or using the
new secrets.
2011-02-02 12:17:58 -06:00
Dan Williams
4ff0b5f0b7 core: add method to start authentication with a D-Bus sender 2011-02-02 12:17:26 -06:00
Dan Williams
f9147ec369 settings: don't pass all secrets to agents when requesting secrets
The agent can and will get the secrets it needs itself, since it's providing
secrets anyway.
2011-02-01 12:19:58 -06:00
Dan Williams
570c0eb2df settings: implement deleting secrets from agents when connection is deleted 2011-01-31 23:33:46 -06:00
Dan Williams
393bcf8d12 settings: implement saving secrets to agents on Update() 2011-01-31 23:10:33 -06:00
Dan Williams
ac757766e6 settings: fix plugin capabilities max value
It's a bitfield, not a single value.
2011-01-31 21:11:18 -06:00
Dan Williams
1f7143b5df settings: remove obsolete comment 2011-01-31 20:52:18 -06:00
Dan Williams
f130089735 settings: use less memory in error handling of GetSecrets 2011-01-30 13:53:37 -06:00
Dan Williams
b285c6467a settings: simplify GetSecrets handling of sender UID
We've already gotten the UI when doing the PK auth checks, so
it's pointless to get it again.  Just pass the known UID through.
2011-01-30 13:49:56 -06:00
Dan Williams
3a97939525 settings: move agent code into settings directory
Since that's where it's used, and it doesn't need to be exposed
to any other code.
2011-01-30 11:00:33 -06:00
Dan Williams
0e6a5365d4 core: move secrets handling to NMSettingsConnection
It's the thing that owns the secrets anyway, and it simplifies things to
have the secrets handling there instead of half in NMActRequest and
half in NMManager.  It also means we can get rid of the ugly signals
that NMSettingsConnection had to emit to get agent's secrets, and
we can consolidate the requests for the persistent secrets that the
NMSettingsConnection owned into NMSettingsConnection itself instead
of also in NMAgentManager.

Since the NMActRequest and the NMVPNConnection classes already tracked
the underlying NMSettingsConnection representing the activation, its
trivial to just have them ask the NMSettingsConnection for secrets
instead of talking to the NMAgentManager.  Thus, only the
NMSettingsConnection now has to know about the agent manager, and it
presents a cleaner interface to other objects further up the chain,
instead of having bits of the secrets request splattered around the
activation request, the VPN connection, the NMManager, etc.
2011-01-27 10:41:02 -06:00
Dan Williams
4427774d57 agents: filter agents by UID for user-requested connections
When a user makes an explicit request for secrets via GetSecrets
or activates a device, don't ask other users' agents for secrets.
Restrict secrets request to agents owned by the user that made the
initial activate or GetSecrets request.

Automatic activations still request secrets from any available agent.
2011-01-26 18:36:08 -06:00
Dan Williams
68812f61d9 settings: request secrets from agents when clients call GetSecrets
A client calling GetSecrets on the connection should also request
secrets from agents in that client's session.  ie, a connection
editor should be able to call GetSecrets, and get the secrets
stored by the agent in that session (the applet).
2011-01-26 17:13:15 -06:00
Dan Williams
75af6105b7 settings: update signal prototypes
No functional change, but makes the internal API clearer.
2011-01-26 15:24:41 -06:00
Dan Williams
e68e27aa75 libnm-util: add 'flags' argument to nm_connection_to_hash() and nm_setting_to_hash()
Simplifies code internally, and makes it easier for clients as well in
some cases where they want to control what ends up in the resulting
hash and what does not.
2011-01-26 14:14:37 -06:00
Dan Williams
6fc469d74a agent: pass setting name back in secrets callback 2011-01-26 13:32:25 -06:00
Dan Williams
b3959aefa3 core: rename NMSysconfigConnection -> NMSettingsConnection 2011-01-26 11:38:12 -06:00
Dan Williams
d1979ba63e secrets: simplify GetSecrets call flow
The Settings.Connection interface is now only provided by NetworkManager
itself since there is only one settings service.  NM can validate
requests for secrets internally and thus there's no need to lock down
GetSecrets using a separate D-Bus interface, since PolicyKit provides
that functionality on systems where this is desirable (ie multi-user).
Single-user systems that do not have PolicyKit will inherently trust
the user already, or if not D-Bus auth is flexible enough to lock
down the GetSecrets method individually even if it's not on a separate
D-Bus interface.

Second, since only clients like connection editors or applets will be
calling the GetSecrets method, there's no need for 'hints' or
'request_new' arguments here since this  method should never trigger
an interactive secrets request.  Only NM should send those requests
when it knows it needs to ask the user, either during connection or
after validating the incoming GetSecrets request.  A connection editor
type application should never be able to trigger the normal
"What's your passphrase" dialog thats provided by the secret agent
for that user's session.
2011-01-26 10:17:07 -06:00
Dan Williams
4b6a86d748 dbus: remove obsolete interfaces from permissions 2011-01-26 09:58:22 -06:00
Dan Williams
9806a92eaa trivial: fix some possible uninitialized variable usage in error cases 2011-01-25 15:41:14 -06:00
Dan Williams
b7259fd2a8 Merge remote branch 'origin/master' into rm-userset 2011-01-25 15:41:03 -06:00
Dan Williams
bc6fc7b910 vpn: fix VPN active connection D-Bus API handling (bgo #569294)
Due to limitations in dbus-glib, where one GObject cannot have more
than one introspection XML object attached to it, we used to include
more than one <interface> in the VPNConnection object introspection
XML.  This was suboptimal for two reasons:

1) it duplicated the Connection.Active introspection XML which
made it harder for clients to use the introspection data in a
dynamic fashion, besides looking ugly in the docs

2) not many other programs use this feature of dbus-glib, which
means it didn't get a lot of testing, and broke, which sucks
for NM.

To fix this issue, create a base class for NMVpnConnection that
handles the Connection.Active API, and make NMVpnConnection itself
handle just the VPN pieces that it layers on top.  This  makes
dbus-glib happy because we aren't using two <interface> blocks
in the same introspection XML, and it makes the NM code more
robust because we can re-use the existing Connection.Active
introspection XML in the NMVpnConnectionBase class.
2011-01-25 12:41:03 -06:00
Giovanni Campagna
9067356856 core: fix policy handling of connections-loaded signal 2011-01-21 14:20:38 -06:00
Dan Williams
ec55e32ee6 agent: pass the right call-id in the secrets callback 2011-01-19 17:17:41 -06:00
Dan Williams
8ff556be3c agent: fix current agent removal if agent goes away
The current agent isn't in the 'pending' list, so don't check
the list for the agent and bail if it's not found since that
won't handle the current agent going away.
2011-01-19 17:16:21 -06:00
Dan Williams
85409427be agent: add some debug logging 2011-01-19 16:58:26 -06:00
Dan Williams
223c00fdee core: don't require connection path for AddAndActivate
There is no path yet since we haven't added the connection yet.
2011-01-18 20:40:58 -06:00
Dan Williams
c804909f83 wired: clear wired secrets tries counter when appropriate
If NM asks for secrets, and then a client calls ActivateDevice on
that same connection, the secrets tries counter doesn't get reset
and NM then thinks we need completely new secrets when we really
don't since the old secrets request isn't valid anymore.

Also ensure the secrets tries gets reset on success and failure
to match behavior of wifi.
2011-01-18 18:35:35 -06:00
Dan Williams
9f7f02b3b8 wifi: clear wireless secrets tries counter when deactivating
If NM asks for secrets, and then a client calls ActivateDevice on
that same connection, the secrets tries counter doesn't get reset
and NM then thinks we need completely new secrets when we really
don't since the old secrets request isn't valid anymore.

Found by Evan Broder
2011-01-18 18:29:56 -06:00
Dan Williams
68ab26143b core: use GetSecrets flags everywhere 2011-01-18 14:57:44 -06:00
Dan Williams
a2f36e8bd4 agent: add CancelGetSecrets D-Bus API
Allows NM to signal to an agent that an in-progress secrets
request is no longer needed.  This could happen if the device
for which the request was started was removed, disabled, or the
network being connected to changed, or whatever.
2011-01-18 13:19:29 -06:00
Dan Williams
1187922adf core: lack of an IPv4 setting indicates DHCP (novell #664640)
It shouldn't assert.
2011-01-14 14:02:02 -06:00
Dan Williams
bba24a0e00 core: allow minimal completion of VPN connections for AddAndActivate
We can at least fill in the connection setting if we're just given
the VPN setting.
2011-01-13 13:30:30 -06:00
Dan Williams
53766ae291 core: move generic connection complete function to a generic location
Out of NMDevice specific places to the utils code, so it can be used
more easily from everywhere.  There's nothing device-specific about
it anyway.
2011-01-13 13:28:52 -06:00
Dan Williams
2d9cd80c87 wifi: use less memory converting SSID
nm_utils_ssid_to_utf8() handles null termination for us, so no
need to copy the SSID to a buffer first.
2011-01-13 12:42:52 -06:00
Dan Williams
b38f39cfc6 core: build keyfile plugin into NetworkManager
Since settings storage is now handled by NetworkManager, we must
have the ability to read/write all connection types at all times.
Since the 'keyfile' plugin is the only plugin that can handle all
connection types, build it into NetworkManager.
2011-01-12 18:12:23 -06:00
Dan Williams
8259b35ee5 wimax: add connection completion function 2011-01-12 17:46:43 -06:00
Dan Williams
f9ceafd4a1 Merge remote branch 'origin/master' into rm-userset 2011-01-12 15:46:37 -06:00
Dan Williams
c1ee4fce68 tests: add some comments to the wifi connection completion tests 2011-01-12 13:20:37 -06:00
Dan Williams
3a160af5ab wifi: add RSN connection completion tests 2011-01-12 00:25:07 -06:00
Dan Williams
f7a8d53ac4 wifi: ensure shared auth is rejected for WPA APs when completing connections 2011-01-12 00:24:41 -06:00
Dan Williams
54c58bcf1f wifi: add more AP connection completion tests for EAP 2011-01-12 00:11:29 -06:00