The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Package:WPA Supplicant"
(add nano because nano is easy) |
|||
(9 intermediate revisions by 8 users not shown) | |||
Line 2: | Line 2: | ||
|Summary=wpa_supplicant is a cross-platform supplicant with support for open, WEP, WPA and WPA2. It handles scanning, connection and automatic reconnect to access points. wpa_supplicant has <code>wpa_cli</code> and <code>wpa_gui</code> frontends and <code>wpa_supplicant</code> daemon. | |Summary=wpa_supplicant is a cross-platform supplicant with support for open, WEP, WPA and WPA2. It handles scanning, connection and automatic reconnect to access points. wpa_supplicant has <code>wpa_cli</code> and <code>wpa_gui</code> frontends and <code>wpa_supplicant</code> daemon. | ||
|CatPkg=net-wireless/wpa_supplicant | |CatPkg=net-wireless/wpa_supplicant | ||
|Homepage=http://hostap.epitest.fi/wpa_supplicant/ | |Homepage=http://hostap.epitest.fi/wpa_supplicant/ | ||
}} | }} | ||
=== Installation === | |||
{{console|body= | |||
###i## echo 'net-wireless/wpa_supplicant wps' >> /etc/portage/package.use/wpa_supplicant | |||
#for a gui widget run the second command. | |||
###i## echo 'net-wireless/wpa_supplicant qt' >> /etc/portage/package.use/wpa_supplicant}} | |||
== Configuration == | {{console|body=###i## emerge net-wireless/wpa_supplicant}} | ||
=== Configuration === | |||
You can configure <code>wpa_supplicant</code> daemon by editing <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>. | You can configure <code>wpa_supplicant</code> daemon by editing <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>. | ||
{{console|body= | |||
###i## nano /etc/wpa_supplicant/wpa_supplicant.conf | |||
}} | |||
{{file|name=/etc/wpa_supplicant/wpa_supplicant.conf|lang=|desc=wpa_supplicant daemon config|body= | {{file|name=/etc/wpa_supplicant/wpa_supplicant.conf|lang=|desc=wpa_supplicant daemon config|body= | ||
# provide control interface for wpa_cli and wpa_gui frontends | # provide control interface for wpa_cli and wpa_gui frontends | ||
Line 17: | Line 28: | ||
network={ | network={ | ||
ssid="SSID" | ssid="SSID" | ||
psk=" | psk="passphrase" | ||
} | } | ||
Line 25: | Line 36: | ||
} | } | ||
}} | }} | ||
{{file|name=/etc/wpa_supplicant/wpa_supplicant.conf|lang=|desc=MOAR wpa_supplicant daemon config|body= | |||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel | |||
#ap_scan=0 | |||
#update_config=1 | |||
network={ | |||
ssid="YourSSID" | |||
psk="your-secret-key" | |||
scan_ssid=1 | |||
proto=RSN | |||
key_mgmt=WPA-PSK | |||
group=CCMP TKIP | |||
pairwise=CCMP TKIP | |||
priority=5 | |||
} | |||
}} | |||
Another way would be to run | |||
<console> | |||
###i## wpa_passphrase ssidname | tee /etc/wpa_supplicant.conf | |||
secretpassword | |||
#reading passphrase from stdin | |||
network={ | |||
ssid="ssidname" | |||
#psk="secretpassword" | |||
psk="552324234" | |||
} | |||
</console> | |||
Like this the configuration file will be created automatically, so you cant make any typing mistakes like forgetting a tick. Use your SSID name instead of ''ssidname'' and after running the command it will wait for you to enter the password, then will save the output of ''wpa_passphrase'' into <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>. | |||
== Daemon == | == Daemon == | ||
Line 38: | Line 80: | ||
The daemon can work independently or you can use wpa_cli and wpa_gui frontends. You can also alter configs with frontends. | The daemon can work independently or you can use wpa_cli and wpa_gui frontends. You can also alter configs with frontends. | ||
== | == Wpa_cli CLI Frontend == | ||
You can start cli frontend by running <code>wpa_cli</code>. | You can start cli frontend by running <code>wpa_cli</code>. | ||
<console> | <console> | ||
Line 75: | Line 117: | ||
</console> | </console> | ||
== | == Wpa_gui GUI Frontend == | ||
<code>wpa_gui</code> is simple gui frontend. You can start it by running <code>wpa_gui</code>. | <code>wpa_gui</code> is simple gui frontend. You can start it by running <code>wpa_gui</code>. | ||
<console> | <console> | ||
Line 81: | Line 123: | ||
</console> | </console> | ||
If you use Openbox and want to put wpa_gui in your autostart, you will run into some difficulties. You need to run wpa_gui as root, or you will not be able to access any adapters. On some other distributions, you can run <code>chmod +s /usr/bin/wpa_gui</code> in a terminal to allow other users to pretend they are root for this executable, but this is blocked on Funtoo for security reasons (wpa_gui will not start if you do this, so if you have done that, remove it with <code>-s</code> in the same command). The way to do it is to install the sudo package: | |||
<console> | |||
###i## emerge sudo | |||
###i## nano /etc/sudoers | |||
</console> | |||
The <code>/etc/sudoers</code> file contains the rules for who is able to use sudo to gain root access with their own personal password. However, we don't want to get stuck on a password question when we start <code>wpa_gui</code> in the autostart for Openbox. Therefore, we need to add to this file that the <code>wpa_gui</code> executable can be run with sudo without any need for a password. I'm sure you can figure out the security implications of this. Add the following to the <code>/etc/sudoers</code> file: | |||
<console> | |||
%wheel ALL=(ALL) ALL | |||
%wheel ALL=(ALL) NOPASSWD: /usr/bin/wpa_gui | |||
</console> | |||
The first line enables everyone in the <code>wheel</code> user group to use sudo with their personal password for root access. The second line says that all those users are also allowed to execute <code>/usr/bin/wpa_gui</code> without a password. | |||
Now you can add <code>sudo wpa_gui -t &</code> to your <code>~/.config/openbox/autostart</code> and that should put <code>wpa_gui</code> in your panel every time you start Openbox. | |||
== Autoconfigure IP with dhcpcd == | == Autoconfigure IP with dhcpcd == | ||
You can use [[Package:dhcpcd]] to | You can use [[Package:dhcpcd]] to automatically configure an ip address. Start dhcpcd daemon by | ||
<console> | <console> | ||
###i## /etc/init.d/dhcpcd start | ###i## /etc/init.d/dhcpcd start | ||
</console> | </console> | ||
To make it work automatically with system start, add dhcpcd to default runlevel: | |||
<console> | |||
###i## rc-update add dhcpcd default | |||
</console> | |||
{{EbuildFooter}} | {{EbuildFooter}} |
Latest revision as of 13:07, January 3, 2021
WPA Supplicant
We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.
Installation
root # echo 'net-wireless/wpa_supplicant wps' >> /etc/portage/package.use/wpa_supplicant root #for a gui widget run the second command. root # echo 'net-wireless/wpa_supplicant qt' >> /etc/portage/package.use/wpa_supplicant
root # emerge net-wireless/wpa_supplicant
Configuration
You can configure wpa_supplicant
daemon by editing /etc/wpa_supplicant/wpa_supplicant.conf
.
root # nano /etc/wpa_supplicant/wpa_supplicant.conf
/etc/wpa_supplicant/wpa_supplicant.conf
- wpa_supplicant daemon config# provide control interface for wpa_cli and wpa_gui frontends ctrl_interface=/run/wpa_supplicant # allow wpa_cli and wpa_gui to update config update_config=1 network={ ssid="SSID" psk="passphrase" } network={ ssid="SSID2" key_mgmt=NONE }
/etc/wpa_supplicant/wpa_supplicant.conf
- MOAR wpa_supplicant daemon configctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel #ap_scan=0 #update_config=1 network={ ssid="YourSSID" psk="your-secret-key" scan_ssid=1 proto=RSN key_mgmt=WPA-PSK group=CCMP TKIP pairwise=CCMP TKIP priority=5 }
Another way would be to run
root # wpa_passphrase ssidname | tee /etc/wpa_supplicant.conf secretpassword root #reading passphrase from stdin network={ ssid="ssidname" #psk="secretpassword" psk="552324234" }
Like this the configuration file will be created automatically, so you cant make any typing mistakes like forgetting a tick. Use your SSID name instead of ssidname and after running the command it will wait for you to enter the password, then will save the output of wpa_passphrase into /etc/wpa_supplicant/wpa_supplicant.conf
.
Daemon
Start daemon with openrc.
root # /etc/init.d/wpa_supplicant start
You can also add it to default runlevel.
root # rc-update add wpa_supplicant default
The daemon can work independently or you can use wpa_cli and wpa_gui frontends. You can also alter configs with frontends.
Wpa_cli CLI Frontend
You can start cli frontend by running wpa_cli
.
root # wpa_cli
Scan Access Points
> scan OK <3>CTRL-EVENT-SCAN-STARTED <3>CTRL-EVENT-SCAN-RESULTS > scan_results bssid / frequency / signal level / flags / ssid 50:32:75:ee:b6:fb 2462 -41 [WPA2-PSK-CCMP][ESS] AndroidAP 00:3a:98:99:12:f3 2412 -71 [WPA2-EAP-CCMP][ESS] wEKSOTE 00:3a:98:99:12:f0 2412 -71 [WPA2-EAP-CCMP][ESS] wULAPPA 00:23:33:a2:7d:14 2462 -85 [WPA2-EAP-CCMP][ESS] SaitaBYOD 00:3a:98:99:12:f1 2412 -70 [ESS] saitaOpen
Connect to Access Point
> add_network 0 > set_network 0 ssid "SSID" > set_network 0 psk "passphrase" > enable_network 0 <2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]
Save config
> save_config
OK
Wpa_gui GUI Frontend
wpa_gui
is simple gui frontend. You can start it by running wpa_gui
.
root # wpa_gui
If you use Openbox and want to put wpa_gui in your autostart, you will run into some difficulties. You need to run wpa_gui as root, or you will not be able to access any adapters. On some other distributions, you can run chmod +s /usr/bin/wpa_gui
in a terminal to allow other users to pretend they are root for this executable, but this is blocked on Funtoo for security reasons (wpa_gui will not start if you do this, so if you have done that, remove it with -s
in the same command). The way to do it is to install the sudo package:
root # emerge sudo root # nano /etc/sudoers
The /etc/sudoers
file contains the rules for who is able to use sudo to gain root access with their own personal password. However, we don't want to get stuck on a password question when we start wpa_gui
in the autostart for Openbox. Therefore, we need to add to this file that the wpa_gui
executable can be run with sudo without any need for a password. I'm sure you can figure out the security implications of this. Add the following to the /etc/sudoers
file:
wheel ALL=(ALL) ALL wheel ALL=(ALL) NOPASSWD: /usr/bin/wpa_gui
The first line enables everyone in the wheel
user group to use sudo with their personal password for root access. The second line says that all those users are also allowed to execute /usr/bin/wpa_gui
without a password.
Now you can add sudo wpa_gui -t &
to your ~/.config/openbox/autostart
and that should put wpa_gui
in your panel every time you start Openbox.
Autoconfigure IP with dhcpcd
You can use Package:dhcpcd to automatically configure an ip address. Start dhcpcd daemon by
root # /etc/init.d/dhcpcd start
To make it work automatically with system start, add dhcpcd to default runlevel:
root # rc-update add dhcpcd default