After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719852 - Use WPA encryption for AP-mode hotspots
Use WPA encryption for AP-mode hotspots
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Network
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
: 678287 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-12-04 16:21 UTC by Dan Williams
Modified: 2014-09-02 14:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-wifi-create-WPA-protected-hotspot-if-supported-by-de.patch (4.70 KB, patch)
2014-01-07 08:48 UTC, Stanislaw Gruszka
needs-work Details | Review
0001-wifi-create-WPA-protected-AP-hotspot-if-supported-by.patch (4.53 KB, patch)
2014-01-10 09:22 UTC, Stanislaw Gruszka
committed Details | Review

Description Dan Williams 2013-12-04 16:21:54 UTC
Ad-hoc mode hotspots cannot (yet) use WPA for kernel-related reasons, but AP-mode hotspots should have no problem using WPA.  The default hotspot creation code only creates WEP connections though.

panels/network/net-device-wifi.c::start_shared_connection() should get updated to do something like:

	/* Use real AP mode if the device supports it */
        if (nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device)) & NM_WIFI_DEVICE_CAP_AP) {
		mode = NM_SETTING_WIRELESS_MODE_AP;
		is_ap = TRUE;
        } else
                mode = NM_SETTING_WIRELESS_MODE_ADHOC;

...

        sws = (NMSettingWirelessSecurity*) nm_setting_wireless_security_new ();
	if (is_ap) {
            wpa_passphrase = generate_wpa_passphrase (device_wifi);
            g_object_set (sws,
                          "key-mgmt", "wpa-psk",
                          "psk", wpa_passphrase,
                          NULL);
            g_free (wpa_passphrase);
        } else {
            wep_key = generate_wep_key (device_wifi);
            g_object_set (sws,
                          "key-mgmt", "none",
                          "wep-key0", wep_key,
                          "wep-key-type", NM_WEP_KEY_TYPE_KEY,
                          NULL);
            g_free (wep_key);
        }

Generating the WPA key is going to be a bit different than doing the WEP key, since a hex WPA PSK is 64 characters long, and that's a b*tch to type.  So you really want to generate a WPA passphrase, which is between 8 and 63 *ASCII* characters long (inclusive).  Probably hit up a dictionary or something?
Comment 1 Stanislaw Gruszka 2014-01-07 08:48:42 UTC
Created attachment 265515 [details] [review]
0001-wifi-create-WPA-protected-hotspot-if-supported-by-de.patch

Proposed fix for this bug.
Comment 2 Bastien Nocera 2014-01-09 16:45:51 UTC
Review of attachment 265515 [details] [review]:

Rest looks fine.

::: panels/network/net-device-wifi.c
@@ +863,3 @@
+        gint i;
+
+        /* generate a 8-digits assci WPA key */

ASCII

@@ +864,3 @@
+
+        /* generate a 8-digits assci WPA key */
+        for (i = 0; i < 8; i++) {

sizeof(key)?

@@ +885,2 @@
 {
+        char key[11];

switching gchar to char is not something that should be done in this patch.
Comment 3 Stanislaw Gruszka 2014-01-10 09:09:09 UTC
(In reply to comment #2)

> @@ +864,3 @@
> +
> +        /* generate a 8-digits assci WPA key */
> +        for (i = 0; i < 8; i++) {
> 
> sizeof(key)?
I'm going to introduce constant to define size of key.
Comment 4 Stanislaw Gruszka 2014-01-10 09:22:01 UTC
Created attachment 265899 [details] [review]
0001-wifi-create-WPA-protected-AP-hotspot-if-supported-by.patch

Proposed fix - v2.
Comment 5 Michael Catanzaro 2014-08-09 21:35:23 UTC
(In reply to comment #2)
> Review of attachment 265515 [details] [review]:
> 
> Rest looks fine.

Bastien, ping!
Comment 6 Bastien Nocera 2014-08-15 13:58:49 UTC
Pushed with a few fixes and changes to the commit message.

Thanks for the patch!
Comment 7 Bastien Nocera 2014-09-02 14:11:56 UTC
*** Bug 678287 has been marked as a duplicate of this bug. ***