Re: Change the Password



On Thursday 27 of January 2011 13:46:14 Bastien Nocera wrote:
> On Thu, 2011-01-27 at 17:34 +0530, Jos Collin-ERS,HCLTech wrote:
> > Thanks a lot, Bastien. I will work on that.
> > 
> > I found that the GetSettings doesn't give the encryption key. I have
> > tried GetSecrets function also, to see where the key is stored, but
> > how ever there is no function to set the secrets.
> 
> My guess is that this functionality is only available through the native
> APIs. seahorse (the gnome-keyring manager) can change this, so there's
> most certainly a way.
> 

Yeah, you can browse and change secrets via seahorse GUI for user connections, 
because nm-applet uses gnome-keyring for secrets storage.
Note especially the 'Details' tab in secret properties, that shows you which 
settings name and key the particular password belongs to.
E.g. for a WiFi WPA password, there will be:
setting-key: psk
setting-name: 802-11-wireless-security
On the other hand, system connection plugins store secrets to their specific 
locations, mostly plain files that you can edit.

When you want to get secrets via D-Bus, you have to call GetSecrets() method, 
because GetSetting() doesn't list the secrets for security reasons. Only root 
is allowed to call GetSecrets(). Example for a WiFi WEP connection:
sudo dbus-send  --system --print-reply --
dest='org.freedesktop.NetworkManagerUserSettings' 
'/org/freedesktop/NetworkManagerSettings/19' 
org.freedesktop.NetworkManagerSettings.Connection.Secrets.GetSecrets 
string:802-11-wireless-security array:string:wep-key0 boolean:false

The first argument says which settings you want secrets from. The second 
argument is the array of keys you require.

There is no specific D-Bus call to change secrets. You should use Update() 
method to provide all settings including the new secrets. The secrets are 
specified as key:value pairs in the correponding settings (the key and setting-
name in seahorse).

I've added an python change-secrets example here:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/update-
secrets.py

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]