Bug 195824 - Networkmanager fails connect to WPA-PSK network
Summary: Networkmanager fails connect to WPA-PSK network
Status: RESOLVED FIXED
Alias: None
Product: Network Management
Classification: Miscellaneous
Component: Plasma Widget (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Will Stephenson
URL:
Keywords:
: 191951 196874 199037 205165 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-06-09 23:04 UTC by Łukasz Siudut
Modified: 2009-08-26 22:39 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
psk patch (827 bytes, application/octet-stream)
2009-06-14 21:55 UTC, Łukasz Siudut
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Łukasz Siudut 2009-06-09 23:04:31 UTC
Version:           r978289 (using KDE 4.2.4)
Compiler:          gcc 4.4.0 gentoo patched
OS:                Linux
Installed from:    Gentoo Packages

Networkmanager applet fails connect to WPA-PSK network. I tried svn versions from r916398 up to r974457. I configured connection manually, and i'am absolutely sure, that password is correct. I also tried to connect via cnetworkmanager - there are no problems.

Output from cnetworkmanager in monitor mode, when networkmanager applet is connecting:

cnetworkmanager 0.8.4 - Command Line Interface for NetworkManager                                                                    
ABBR /o/f/DB is /org/freedesktop/DBus                                                                                                
ABBR o.f.DB is org.freedesktop.DBus                                                                                                  
SIG /o/f/DB: o.f.DB.NameAcquired(dbus.String(u':1.93'),)                                                                             
        WPAS DISCONNECTED       (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was 4way_handshake)                                  
        WPAS SCANNING   (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was disconnected)
        WPAS ASSOCIATED (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was scanning)
        WPAS 4WAY_HANDSHAKE     (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associated)
        PROP    Strength        100     (/org/freedesktop/NetworkManager/AccessPoint/36)
        WPAS DISCONNECTED       (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was 4way_handshake)
        WPAS SCANNING   (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was disconnected)
        WPAS ASSOCIATED (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was scanning)
        WPAS 4WAY_HANDSHAKE     (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associated)
        Device State NEED_AUTH  (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0, was config)
        PROP    State   6       (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0)
        WPAS DISCONNECTED       (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was 4way_handshake)
        Device State PREPARE    (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0, was need_auth)
        PROP    State   4       (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0)
ABBR /o/f/NM is /org/freedesktop/NetworkManager
ABBR o.f.NM is org.freedesktop.NetworkManager
SIG /o/f/NM: o.f.NM.PropertiesChanged(dbus.Dictionary({dbus.String(u'ActiveConnections'): dbus.Array([dbus.ObjectPath('/org/freedesktop/NetworkManager/ActiveConnection/19')], signature=dbus.Signature('o'), variant_level=1)}, signature=dbus.Signature('sv')),)
        Device State CONFIG     (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0, was prepare)
        PROP    State   5       (/org/freedesktop/Hal/devices/net_xx_xx_xx_xx_71_78_0)
        WPAS SCANNING   (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was disconnected)
        WPAS ASSOCIATING        (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was scanning)
        WPAS ASSOCIATED (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associating)
        WPAS 4WAY_HANDSHAKE     (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associated)
        PROP    Strength        72      (/org/freedesktop/NetworkManager/AccessPoint/35)
        PROP    Strength        37      (/org/freedesktop/NetworkManager/AccessPoint/39)
        PROP    Strength        34      (/org/freedesktop/NetworkManager/AccessPoint/40)
        PROP    Strength        31      (/org/freedesktop/NetworkManager/AccessPoint/41)
        PROP    Strength        31      (/org/freedesktop/NetworkManager/AccessPoint/42)
        PROP    Strength        30      (/org/freedesktop/NetworkManager/AccessPoint/43)
        PROP    Strength        35      (/org/freedesktop/NetworkManager/AccessPoint/44)
        WPAS DISCONNECTED       (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was 4way_handshake)
        WPAS SCANNING   (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was disconnected)
        WPAS ASSOCIATED (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was scanning)
        WPAS 4WAY_HANDSHAKE     (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associated)
        WPAS DISCONNECTED       (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was 4way_handshake)
        WPAS SCANNING   (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was disconnected)
        WPAS ASSOCIATED (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was scanning)
        WPAS 4WAY_HANDSHAKE     (/fi/epitest/hostap/WPASupplicant/Interfaces/1, was associated)

So problems always occurs on 4WAY_HANDSHAKE.

Networkmanager version: 0.8.4.
KDE: 4.2.4 (QT 4.5.1)
Comment 1 Łukasz Siudut 2009-06-09 23:08:27 UTC
Sorry for mistake, networkmanager version is 0.7.1.
Comment 2 Kevin Kofler 2009-06-10 20:49:31 UTC
Are you using an ASCII passphrase or a hex key? I already filed a bug about hex keys not working.
Comment 3 Łukasz Siudut 2009-06-11 11:01:31 UTC
ASCII passphrase. My password is quiet complicated. But i changed it for tests to simple one, and effect was the same. What's more, i was trying to connect using hex key and again - effect was the same.
Comment 4 Kevin Kofler 2009-06-11 20:58:09 UTC
See also https://bugzilla.redhat.com/show_bug.cgi?id=505292 - it looks like this is related to the version of NetworkManager. The same snapshot (revision 963263 committed 2009-05-04 10:57 UTC) works on Fedora 10 (NetworkManager-0.7.1-1.fc10), but not on Fedora 11 (NetworkManager-0.7.1-4.git20090414.fc11).

We also found the probable cause: with the new NetworkManager, we have this additional line in the logs:
Jun 10 20:00:44 nbecker1 NetworkManager: <info>  Config: added 'auth_alg' value
'OPEN'
which makes no sense for WPA networks.
Comment 5 Łukasz Siudut 2009-06-11 22:01:59 UTC
Can't confirm. I've just tested networkmanager 0.7.0, without change. Still
hans on 4 way handshake. Should older versions of networkmanager be checked?

And why auth_alg=OPEN makes no sense? As far as i know authentication is independed of wpa authorization.
Comment 6 Kevin Kofler 2009-06-11 22:40:30 UTC
I suspect there may be multiple different bugs with similar symptoms.
Comment 7 Kevin Kofler 2009-06-13 20:26:58 UTC
It's not the NetworkManager version, we had affected users try downgrading it to the same version as in Fedora 10 and it didn't help.
Comment 8 Łukasz Siudut 2009-06-14 19:52:07 UTC
We'll, i've just updated kubuntu on my father's notebook, from 9.04 to 9.10 alpha. Same problem, we had to disable NetworkManager and use tradicional ifup/down way. Looks like it may be a big problem in nearest future.
Comment 9 Łukasz Siudut 2009-06-14 21:55:34 UTC
Created attachment 34535 [details]
psk patch
Comment 10 Łukasz Siudut 2009-06-14 21:56:24 UTC
Ok, i've just fixed my networkmanager. I'll try to explain what's wrong, i hope you'll understand my english :).

File libs/storage/settings/802-11-wireless-securitydbus.cpp contain code responsible for hashing wpa passphrase. First i thought there's something wrong with pbkdf2_sha1 function, but it's ok (tested). Then i removed hashing at all (patch attached), and everything works fine.

I suppose that problems are connected with storing hashed passphrare.
Comment 11 Kevin Kofler 2009-06-14 22:25:58 UTC
The current NM snapshots accept unhashed passphrases and will hash them themselves. However, your patch breaks support for versions <= 0.7.1 (this includes the latest stable release, which is 0.7.1) which don't do that.

That said, we can try that patch in Fedora >= 11.
Comment 12 Kevin Kofler 2009-06-14 22:28:44 UTC
By the way, most likely this also addresses https://bugs.kde.org/show_bug.cgi?id=191879 . But I think applying this unconditionally to the current NM plasmoid sources is the wrong fix, as it relies on an unreleased snapshot of NM. The hashWpaPsk function needs to be fixed instead (it can be a no-op for NM >= 0.7.2, but not for <= 0.7.1).
Comment 13 Łukasz Siudut 2009-06-14 22:47:02 UTC
I would try to fix hashWpaPsk, but i'm not familiar with structures used in code, and exams on my mind, so i don't have time. Anyway, i hope somebody can fix that now.
Comment 14 Stefan Neufeind 2009-06-18 14:16:54 UTC
Duplicate of #191951
Comment 15 Kevin Kofler 2009-06-18 18:56:27 UTC
I think there's more than one bug. One of the users at https://bugzilla.redhat.com/show_bug.cgi?id=505292 tried the workaround patch from comment #7 and it did NOT fix the issue for him.
Comment 16 Will Stephenson 2009-07-23 08:51:45 UTC
*** Bug 196874 has been marked as a duplicate of this bug. ***
Comment 17 Will Stephenson 2009-07-23 09:30:20 UTC
*** Bug 199037 has been marked as a duplicate of this bug. ***
Comment 18 Will Stephenson 2009-07-25 21:14:58 UTC
*** Bug 191951 has been marked as a duplicate of this bug. ***
Comment 19 Will Stephenson 2009-07-25 21:22:03 UTC
The unnecessary auth-alg key is no longer sent for non-WEP connections as of r1002366
Comment 20 Will Stephenson 2009-07-25 22:52:33 UTC
Łukasz:  If I understand correctly, on current fedora/kubuntu (which? both?) passing through the WPA passphrase as-is fixes the bug for you?

This is my understanding of NM git head:

if the 'psk' string is a 64 bit hex string, 
->  hex PSK, do nothing 
otherwise
->  hash the passphrase itself 

so IFF the version you are using when you patched out the hashing has this feature, in theory your patch is not make any difference to the hashing and it succeeds for another reason.  Of course it is also possible that their is some subtle encoding bug that I don't know about in the hashWpaPsk() function - my bet is that calling toLatin1() to get the bytes of the passphrase fails on non latin1 characters...

It's hard to tell which NM versions do have hashing - current openSUSE Factory NM 0.7.1 does not.  If you can get the sources of your NM, look in src/supplicant-manager/nm-supplicant-config.c for "if (psk_len == 64)" for the relevant code.
Comment 21 Will Stephenson 2009-07-26 08:12:49 UTC
I used the greek string "Επικοινωνία" as a WPA passphrase and it fails in KDE and with nm-applet (with client side hashing), surprisingly.

Can you check whether you have any "funny foreign letters" in your passphrase and try again without them?
Comment 22 Will Stephenson 2009-07-26 09:25:32 UTC
I checked the spec, ascii only and 8 to 63 chars in length. so the greek example above is pointless.  Am adding validation to the UI.
Comment 23 Łukasz Siudut 2009-07-26 10:42:31 UTC
That's right - when I use psk hex, applet connects correctly. And there are no foreign letters in my passphrase, only common letters and numbers.
Comment 24 Will Stephenson 2009-07-26 16:54:14 UTC
SVN commit 1002613 by wstephens:

Validate WPA-PSK secrets are either a valid passphrase or a valid PSK.
CCBUG: 195824


 M  +2 -0      internals/CMakeLists.txt  
 A             internals/wpasecretidentifier.cpp   [License: LGPL]
 A             internals/wpasecretidentifier.h   [License: LGPL]
 M  +8 -6      ui/security/wpapskwidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1002613
Comment 25 Will Stephenson 2009-07-26 17:22:39 UTC
I was able to reproduce this just now.  Both knetworkmanager (monolithic, but
that's not significant) and nm-applet were sending the same PSK and had the
same other settings. 

I restarted my router, killed and restarted NetworkManager and wpa_supplicant,
and the problem went away.

Can you check the hashed key being sent by knetworkmanager or kded4 (in the
console output (if you are using the plasmoid, killall kded4 & sleep 2 && kded4
in a shell) and compare that to the hashed key stored by nm-applet?  If these
are the same try restarting wpa_supplicant.
Comment 26 Łukasz Siudut 2009-07-26 18:52:50 UTC
Unfortunately I can't check it now. Hopefully I'll do it in 3 hours. Sorry for delay, it's independent of me.
Comment 27 Will Stephenson 2009-07-31 20:22:53 UTC
Ping, please try latest SVN this weekend, have made more fixes.
Comment 28 Łukasz Siudut 2009-08-05 14:32:54 UTC
Unfortunately, still the same problem here. What's more, even hashed psk doesn't work. Interesting fact is, that when i was trying for the last time, after restarting networkmanager, icon stuck to mobile phone or something (not wireless signal, as usual), and i definitely don't have any of mobile broadband device.
Comment 29 Will Stephenson 2009-08-11 13:21:42 UTC
See the tooltip on mobile phone icon on the plasmoid, then install knetworkmanager instead.
Comment 30 Will Stephenson 2009-08-16 23:08:57 UTC
#194128 has a number of confirmations that WPA-PSK is working now.  Closing this report too.
Comment 31 Will Stephenson 2009-08-26 22:39:45 UTC
*** Bug 205165 has been marked as a duplicate of this bug. ***