Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Connect to WiFi with wpa_supplicant and connman using PSK (Read 6035 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] Connect to WiFi with wpa_supplicant and connman using PSK

I have managed to connect to my WiFi using wpa_supplicant and connmand. However, I don't feel comfortable with having the passphrase written in unencrypted form in the connman settings.

in /etc/wpa_supplicant/wpa_supplicant.conf created by wpa_cli and wpa_passphrase I have deleted the plain text passphrase (which was a commented line, anyway) leaving only this:
Spoiler (click to show/hide)

But this did not suffice to connect automatically at startup, so I then used connmanctl to create a setting for my WiFi access point, /var/lib/connamn/wifi_*_managed_psk/settings. However, this file contains the Passphrase in unencrypted form.

Is there a way to secure this and make it use PSK instead?

Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #1
You can install wpa_supplicant-runit and enable the service on startup. The only thing other thing you need to do is is edit the conf file that comes with it (/etc/runit/sv/wpa_supplicant/conf I think) to make sure it matches the name of whatever your wireless interface is.

Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #2
Wait, does this mean that I don't need the connmand at all? Maybe I should still keep connman installed, because I would sometimes use wired ethernet, for which I need it, I guess.

After I installed wpa_supplicant-runit, it had only a simple ./run script in /etc/runit/sv/wpa_supplicant
Code: [Select]
#!/bin/sh
[ -r ./conf ] && . ./conf
exec 2>&1
exec wpa_supplicant -c ${CONF_FILE:=/etc/wpa_supplicant/wpa_supplicant.conf} -i ${WPA_INTERFACE:=wlan0} ${OPTS:=-s}

So this bash script sources a conf file if it is present, and then somehow executes wpa_supplicant with stderr redirected to stdout. Currently there is no conf file present. When I create one, what should it contain?

Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #3
I tried to remove connmand from /run/runit/service. I got this:

Code: [Select]
wlp2s0: CTRL-EVENT-DISCONNECTED bssid=... reason=3 locally_generated=1
nl80211: deinit ifname=wlp2s0 disabled_11b_rates=0
I lost network connection, no surprise there.
I then enabled wpa_supplicant like this:
Code: [Select]
ln -s /etc/runit/sv/wpa_supplicant /run/runit/service
and I started it
Code: [Select]
sv start wpa_supplicant

but it doesn't run, I think, I get this:
Code: [Select]
timeout: down: wpa_supplicant: 0s, normally up, want up


Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #4
Oh my mistake, I thought it came with a conf file on runit. Well you could go about this in a couple of different ways. You could just edit "wlan0" directly if you wanted to. That would work just fine. If you wanted to create a separate file, then you just need to make a file called "conf" in the same directory. It would need to contain:
Code: [Select]
#!/bin/sh
WPA_INTERFACE="interface_name"

With that, it should be able to source whatever interface name you put in and use it for the command.

As for needing connmand, you don't have to. I'm not sure how the dependency chain exactly works on runit, but wpa_supplicant does depend on dhcpcd. In this case, you don't need any other internet daemon since dhcpcd will handle any wired connections for you.

but it doesn't run, I think, I get this:

Yeah that's not running. Maybe try starting dhcpcd first and then wpa_supplicant?

Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #5
Still not working.


I created the /etc/runit/sv/wpa_supplicant/conf file
Code: [Select]
#!/bin/sh
WPA_INTERFACE="wlp2s0"

I stopped wpa_supplicant, restarted connmand to have notwork connection, downloaded and installed dhcpcd-runit, stopped connmand again (got again the deinit)

I told runit about dhcpcd:
Code: [Select]
ln -s /etc/runit/sv/dhcpcd /run/runit/service/

I also started dhcpcd and wpa_supplicant
Code: [Select]
sv start dhcpcd
ok: run: dhcpcd (pid ...) 11 s
sv start wpa_supplicant
ok: run: wpa_supplicant (pid ...) 1s

I still have no connection.

 

Re: Connect to WiFi with wpa_supplicant and connman using PSK

Reply #6
Ha, now I manually ran /etc/runit/sv/wpa_supplicant/run and now I have network connection.
And I get connected after startup.
Thanks. I guess this solves my question.