From 0643fb9c87c59c28bb78dd53f141f6b54327d8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jani=20V=C3=A4limaa?= Date: Sun, 7 Jun 2020 13:54:30 +0300 Subject: Add basic support for connecting to WPA2-PSK network with net_applet when networkmanager is used We need to set KEY_MGMT and WPA_PSK in ifcfg file for networkmanager. --- lib/network/connection/wireless.pm | 3 +++ lib/network/network.pm | 2 ++ 2 files changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm index f6a28b7..4b74310 100644 --- a/lib/network/connection/wireless.pm +++ b/lib/network/connection/wireless.pm @@ -708,6 +708,9 @@ sub build_ifcfg_settings { WIRELESS_ENC_KEY => convert_wep_key_for_iwconfig($self->{access}{network}{key}, $self->{access}{network}{force_ascii_key})), if_(member($self->{access}{network}{encryption}, qw(open restricted)), WIRELESS_ENC_MODE => $self->{access}{network}{encryption}), + if_($self->{access}{network}{encryption} eq 'wpa-psk', + KEY_MGMT => 'WPA-PSK', + WPA_PSK => $self->{access}{network}{key}), if_($self->need_rt2x00_iwpriv, #- use iwpriv for WPA with rt2400/rt2500 drivers, they don't plan to support wpa_supplicant WIRELESS_IWPRIV => qq(set AuthMode=WPAPSK diff --git a/lib/network/network.pm b/lib/network/network.pm index ba1e022..9e157a4 100644 --- a/lib/network/network.pm +++ b/lib/network/network.pm @@ -190,6 +190,7 @@ sub write_interface_settings { my ($intf, $file) = @_; setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST GATEWAY ONBOOT HWADDR MACADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR ATM_DEVICE ETHTOOL_OPTS VLAN MTU DNS1 DNS2 DOMAIN RESOLV_MODS LINK_DETECTION_DELAY), qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_ENC_MODE WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV WIRELESS_WPA_DRIVER WIRELESS_WPA_REASSOCIATE CRDA_DOMAIN), + qw(KEY_MGMT WPA_PSK), qw(DVB_ADAPTER_ID DVB_NETWORK_DEMUX DVB_NETWORK_PID), qw(IPV6INIT IPV6TO4INIT), qw(MRU REMIP PPPOPTIONS HARDFLOWCTL DEFABORT RETRYTIMEOUT PAPNAME LINESPEED MODEMPORT DEBUG ESCAPECHARS INITSTRING), @@ -204,6 +205,7 @@ sub write_interface_settings { ); substInFile { s/^DEVICE='(`.*`)'/DEVICE=$1/g } $file; #- remove quotes if DEVICE is the result of a command chmod $intf->{WIRELESS_ENC_KEY} ? 0700 : 0755, $file; #- hide WEP key for non-root users + chmod $intf->{WPA_PSK} ? 0700 : 0755, $file; #- hide WPA key log::explanations("written $intf->{DEVICE} interface configuration in $file"); } -- cgit v1.2.1