| 1 |
kelmo-guest |
814 |
Modes of Operation in wpasupplicant for Debian |
| 2 |
|
|
============================================== |
| 3 |
|
|
|
| 4 |
|
|
The Debian wpasupplicant package provides two (2) convenient modes of operation |
| 5 |
|
|
that are closely integrated to the core networking infrastructure; ifupdown. |
| 6 |
|
|
|
| 7 |
|
|
Table of Contents |
| 8 |
|
|
================= |
| 9 |
|
|
|
| 10 |
|
|
1. Specifying the wpa_supplicant driver backend |
| 11 |
kelmo-guest |
929 |
- Table of supported drivers |
| 12 |
|
|
- Common Driver Recommendations |
| 13 |
kelmo-guest |
814 |
|
| 14 |
|
|
2. Mode #1: Managed Mode |
| 15 |
kelmo-guest |
929 |
- Examples |
| 16 |
|
|
- Table of Common Options |
| 17 |
|
|
- Important Notes About Managed Mode |
| 18 |
|
|
- How It Works |
| 19 |
kelmo-guest |
814 |
|
| 20 |
|
|
3. Mode #2: Roaming Mode |
| 21 |
kelmo-guest |
929 |
- wpa_supplicant.conf |
| 22 |
|
|
- /etc/network/interfaces |
| 23 |
kelmo-guest |
942 |
- Interacting with wpa_supplicant with wpa_cli and wpa_gui |
| 24 |
kelmo-guest |
929 |
- Controlling the Roaming Daemon with wpa_action |
| 25 |
|
|
- Fine Tuning the Roaming Setup |
| 26 |
|
|
- The Logfile |
| 27 |
|
|
- Using External Mapping Scripts (e.g. guessnet) |
| 28 |
|
|
- /etc/network/interfaces with external mapping |
| 29 |
kelmo-guest |
814 |
|
| 30 |
|
|
4. Troubleshooting |
| 31 |
kelmo-guest |
929 |
- Hidden ssids |
| 32 |
kelmo-guest |
814 |
|
| 33 |
|
|
5. Security Considerations |
| 34 |
kelmo-guest |
929 |
- Configuration File Permissions |
| 35 |
kelmo-guest |
814 |
|
| 36 |
|
|
|
| 37 |
|
|
1. Specifying the wpa_supplicant driver backend |
| 38 |
|
|
=============================================== |
| 39 |
|
|
|
| 40 |
|
|
The wext driver backend will be used for all interfaces that do not explicitly |
| 41 |
|
|
set 'wpa-driver' to the driver type required for that device. Users of linux |
| 42 |
|
|
2.4 kernels, or 2.6 kernels less than 2.6.14 will be required to specify a |
| 43 |
|
|
wpa-driver type. |
| 44 |
|
|
|
| 45 |
|
|
Table of supported drivers |
| 46 |
|
|
========================== |
| 47 |
|
|
|
| 48 |
|
|
A summary of supported drivers follows: |
| 49 |
|
|
|
| 50 |
kelmo-guest |
929 |
Driver Description |
| 51 |
|
|
====== =========== |
| 52 |
|
|
hostap Host AP driver (Intersil Prism2/2.5/3) |
| 53 |
|
|
madwifi MADWIFI 802.11 support (Atheros, etc.) |
| 54 |
|
|
atmel ATMEL AT76C5XXx (USB, PCMCIA) |
| 55 |
|
|
wext Linux wireless extensions (generic) |
| 56 |
|
|
wired wired Ethernet driver |
| 57 |
|
|
test test driver |
| 58 |
kelmo-guest |
814 |
|
| 59 |
|
|
Common Driver Recommendations |
| 60 |
|
|
============================= |
| 61 |
|
|
|
| 62 |
|
|
The Intel Pro Wireless adapters (ipw2100, ipw2200 and ipw3945) all use the |
| 63 |
kelmo-guest |
986 |
'wext' backend, the 'ipw' backend is deprecated and no longer provided. |
| 64 |
kelmo-guest |
814 |
|
| 65 |
|
|
Madwifi supports both the 'wext' and 'madwifi' driver backends. 'wext' is |
| 66 |
kelmo-guest |
959 |
the preferred driver interface. |
| 67 |
kelmo-guest |
814 |
|
| 68 |
|
|
Ndiswrapper NO LONGER SUPPORTS the 'ndiswrapper' driver backend as of version |
| 69 |
kelmo-guest |
986 |
1.16. Therefore, 'wext' must be used. |
| 70 |
kelmo-guest |
814 |
|
| 71 |
|
|
Set the driver type in the interfaces(5) stanza for your device with the |
| 72 |
|
|
'wpa-driver' option. For example: |
| 73 |
|
|
|
| 74 |
|
|
iface eth0 inet dhcp |
| 75 |
kelmo-guest |
986 |
wpa-driver madwifi |
| 76 |
kelmo-guest |
929 |
. . . . . more options |
| 77 |
kelmo-guest |
814 |
|
| 78 |
kelmo-guest |
986 |
If no wpa-driver configuration is supplied, the wext backend is used. |
| 79 |
kelmo-guest |
814 |
|
| 80 |
|
|
2. Mode #1: Managed Mode |
| 81 |
|
|
======================= |
| 82 |
|
|
|
| 83 |
|
|
This mode provides the ability to establish a connection via wpa_supplicant to |
| 84 |
|
|
one known network. It is similar to how the wireless-tools package works. Each |
| 85 |
|
|
element required to establish the connection via wpa_supplicant is prefixed |
| 86 |
|
|
with 'wpa-' and followed by the value that will be used for that element. |
| 87 |
|
|
|
| 88 |
|
|
Examples |
| 89 |
|
|
======== |
| 90 |
|
|
|
| 91 |
|
|
NOTE: the 'wpa-psk' value is only valid if: |
| 92 |
kelmo-guest |
929 |
1) It is a plaintext (ascii) string between 8 and 63 characters in |
| 93 |
|
|
length |
| 94 |
|
|
2) It is a hexadecimal string of 64 characters |
| 95 |
kelmo-guest |
814 |
|
| 96 |
|
|
# Connect to access point of ssid 'NETBEER' with an encryption type of |
| 97 |
|
|
# WPA-PSK/WPA2-PSK. It assumes the driver will use the 'wext' driver backend |
| 98 |
|
|
# of wpa_supplicant because no wpa-driver option has been specified. |
| 99 |
|
|
# The passphrase is given as a ASCII (plaintext) string. DHCP is used to |
| 100 |
|
|
# obtain a network address. |
| 101 |
|
|
# |
| 102 |
|
|
iface wlan0 inet dhcp |
| 103 |
kelmo-guest |
986 |
wpa-ssid MyNetWork |
| 104 |
kelmo-guest |
929 |
# plaintext passphrase |
| 105 |
kelmo-guest |
986 |
wpa-psk plaintextsecret |
| 106 |
kelmo-guest |
814 |
|
| 107 |
|
|
# Connect to access point of ssid 'homezone' with an encryption type of |
| 108 |
|
|
# WPA-PSK/WPA2-PSK, using the 'wext' driver backend of wpa_supplicant. |
| 109 |
|
|
# The psk is given as an encoded hexadecimal string. DHCP is used to obtain |
| 110 |
|
|
# a network address. |
| 111 |
|
|
# |
| 112 |
|
|
iface wlan0 inet dhcp |
| 113 |
kelmo-guest |
929 |
wpa-driver wext |
| 114 |
|
|
wpa-ssid homezone |
| 115 |
|
|
# hexadecimal psk is encoded from a plaintext passphrase |
| 116 |
|
|
wpa-psk 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f |
| 117 |
kelmo-guest |
814 |
|
| 118 |
|
|
# Connect to access point of ssid 'HotSpot1' and bssid of '00:1a:2b:3c:4d:5e' |
| 119 |
|
|
# with an encryption type of WPA-PSK/WPA2-PSK, using the the 'madwifi' driver |
| 120 |
|
|
# backend of wpa_supplicant. The passphrase is given as a plaintext string. |
| 121 |
|
|
# A static network address assignment is used. |
| 122 |
|
|
# |
| 123 |
|
|
iface ath0 inet static |
| 124 |
kelmo-guest |
929 |
wpa-driver madwifi |
| 125 |
|
|
wpa-ssid HotSpot1 |
| 126 |
|
|
wpa-bssid 00:1a:2b:3c:4d:5e |
| 127 |
|
|
# plaintext passphrase |
| 128 |
|
|
wpa-psk madhotspot |
| 129 |
kelmo-guest |
814 |
wpa-key-mgmt WPA-PSK |
| 130 |
|
|
wpa-pairwise TKIP CCMP |
| 131 |
|
|
wpa-group TKIP CCMP |
| 132 |
|
|
wpa-proto WPA RSN |
| 133 |
kelmo-guest |
929 |
# static ip settings |
| 134 |
kelmo-guest |
814 |
address 192.168.0.100 |
| 135 |
|
|
netmask 255.255.255.0 |
| 136 |
|
|
network 192.168.0.0 |
| 137 |
|
|
broadcast 192.168.0.255 |
| 138 |
|
|
gateway 192.168.0.1 |
| 139 |
|
|
|
| 140 |
|
|
# User supplied wpa_supplicant.conf is used for eth1. All network information |
| 141 |
|
|
# is contained within the user supplied wpa_supplicant.conf. No wpa-driver type |
| 142 |
|
|
# is specified, so wext is used. DHCP is used to obtain a network address. |
| 143 |
|
|
# |
| 144 |
|
|
iface eth1 inet dhcp |
| 145 |
kelmo-guest |
929 |
wpa-conf /path/to/wpa_supplicant.conf |
| 146 |
kelmo-guest |
814 |
|
| 147 |
|
|
Table of Common Options |
| 148 |
|
|
======================= |
| 149 |
|
|
|
| 150 |
|
|
A brief summary of common 'wpa-' options that may be used in the |
| 151 |
|
|
/etc/network/interfaces stanza for a wireless device. See the |
| 152 |
|
|
'Important Notes About Managed Mode' section for information about |
| 153 |
|
|
valid and invalid 'wpa-' values. |
| 154 |
|
|
|
| 155 |
|
|
NOTE: ALL values are CASE SeNsItVe |
| 156 |
|
|
|
| 157 |
kelmo-guest |
929 |
Element Example Value Description |
| 158 |
|
|
======= ============= =========== |
| 159 |
|
|
wpa-ssid plaintextstring sets the ssid of your network |
| 160 |
kelmo-guest |
814 |
|
| 161 |
kelmo-guest |
929 |
wpa-bssid 00:1a:2b:3c:4d:5e the bssid of your AP |
| 162 |
|
|
|
| 163 |
|
|
wpa-psk 0123456789...... your preshared wpa key. Use |
| 164 |
|
|
wpa_passphrase(8) to generate your psk |
| 165 |
|
|
from a passphrase and ssid pair |
| 166 |
|
|
|
| 167 |
|
|
wpa-key-mgmt NONE, WPA-PSK, WPA-EAP, list of accepted authenticated key |
| 168 |
|
|
IEEE8021X management protocols |
| 169 |
|
|
|
| 170 |
|
|
wpa-group CCMP, TKIP, WEP104, list of accepted group ciphers for WPA |
| 171 |
|
|
WEP40 |
| 172 |
|
|
|
| 173 |
|
|
wpa-pairwise CCMP, TKIP, NONE list of accepted pairwise ciphers for |
| 174 |
|
|
WPA |
| 175 |
|
|
|
| 176 |
|
|
wpa-auth-alg OPEN, SHARED, LEAP list of allowed IEEE 802.11 |
| 177 |
|
|
authentication algorithms |
| 178 |
|
|
|
| 179 |
|
|
wpa-proto WPA, RSN list of accepted protocols |
| 180 |
|
|
|
| 181 |
|
|
wpa-identity myplaintextname administrator provided username |
| 182 |
|
|
(EAP authentication) |
| 183 |
|
|
|
| 184 |
|
|
wpa-password myplaintextpassword your password (EAP authentication) |
| 185 |
|
|
|
| 186 |
|
|
wpa-scan-ssid 0 or 1 toggles scanning of ssid with specific |
| 187 |
|
|
Probe Request frames |
| 188 |
|
|
|
| 189 |
|
|
wpa-ap-scan 0 or 1 or 2 adjusts the scanning logic of |
| 190 |
|
|
wpa_supplicant |
| 191 |
|
|
|
| 192 |
kelmo-guest |
814 |
The complete functionality of wpa_cli(8) should be implemented. Anything |
| 193 |
|
|
missing is considered a bug and should be reported as such. Patches are always |
| 194 |
|
|
welcome. |
| 195 |
|
|
|
| 196 |
|
|
Important Notes About Managed Mode |
| 197 |
|
|
================================== |
| 198 |
|
|
|
| 199 |
|
|
Almost all 'wpa-' options require there is at least a ssid specified. Only a |
| 200 |
|
|
handful of options have a global effect. These are: 'wpa-ap-scan' and |
| 201 |
|
|
'wpa-preauthenticate'. |
| 202 |
|
|
|
| 203 |
|
|
Any 'wpa-' option given for a device in the interfaces(5) file is sufficient to |
| 204 |
|
|
trigger the wpa_supplicant daemon into action. |
| 205 |
|
|
|
| 206 |
|
|
The wpasupplicant ifupdown script makes assumptions about the 'type' of input |
| 207 |
|
|
that is valid for each option. For example, it assumes that some input is |
| 208 |
|
|
plaintext and wraps quotation marks around the input before passing it on |
| 209 |
|
|
to wpa_cli, which then adds the input to the network block being formed via |
| 210 |
|
|
the wpa_supplicant ctrl_interface socket. Running ifup manually with the |
| 211 |
|
|
'--verbose' option will reveal all of the commands used to form the network |
| 212 |
|
|
block via wpa_cli. If the value you used for any wpa-* option in |
| 213 |
|
|
/etc/network/interfaces is surrounded by double quotes, than it has been |
| 214 |
|
|
assumed to be of "plaintext" or "ascii" type input. |
| 215 |
|
|
|
| 216 |
|
|
Some input is assumed to be a hexadecimal string (eg. wpa-wep-key*). The value |
| 217 |
|
|
'type' of the wpa-psk option however, is determined via a simple check for more |
| 218 |
|
|
than one non hexadecimal character. |
| 219 |
|
|
|
| 220 |
|
|
|
| 221 |
|
|
How It Works |
| 222 |
|
|
============ |
| 223 |
|
|
|
| 224 |
|
|
As mentioned earlier, each wpa_supplicant specific element is prefixed with |
| 225 |
|
|
'wpa-'. Each element correlates to a property of wpa_supplicant described in |
| 226 |
|
|
the wpa_supplicant.conf(5), wpa_supplicant(8) and wpa_cli(8) manpages. The |
| 227 |
|
|
supplicant is launched without any pre-configuration whatsoever, and wpa_cli |
| 228 |
|
|
forms a network configuration from the input provided by the 'wpa-*' lines. |
| 229 |
|
|
Initially, wpa_supplicant/wpa_cli does not directly set the properties of the |
| 230 |
|
|
device (like setting an essid with iwconfig, for example), rather it informs |
| 231 |
|
|
the device of what access point is suitable to associate with. Once the device |
| 232 |
|
|
has scanned the area, and found that the suitable access point is available for |
| 233 |
|
|
use, these properties are set. |
| 234 |
|
|
|
| 235 |
kelmo-guest |
929 |
The scripts that do all the work are located at: |
| 236 |
kelmo-guest |
930 |
|
| 237 |
kelmo-guest |
929 |
/etc/wpa_supplicant/ifupdown.sh |
| 238 |
kelmo-guest |
930 |
/etc/wpa_supplicant/functions.sh |
| 239 |
kelmo-guest |
814 |
|
| 240 |
kelmo-guest |
929 |
ifupdown.sh is executed by run-parts, which in turn is invoked by ifupdown |
| 241 |
|
|
during the 'pre-up', 'pre-down' and 'post-down' phases. |
| 242 |
kelmo-guest |
814 |
|
| 243 |
|
|
In the 'pre-up' phase, a wpa_supplicant daemon is launched followed by a series |
| 244 |
|
|
of wpa_cli commands that set up a network configuration according to what |
| 245 |
|
|
'wpa-' options were used in /etc/network/interfaces for the physical device. |
| 246 |
|
|
|
| 247 |
kelmo-guest |
929 |
If wpa-roam is used, a wpa_cli daemon is launched in the 'post-up' phase. |
| 248 |
kelmo-guest |
814 |
|
| 249 |
kelmo-guest |
929 |
In the 'pre-down' phase, the wpa_cli daemon is terminated. |
| 250 |
kelmo-guest |
814 |
|
| 251 |
kelmo-guest |
929 |
In the 'post-down' phase, the wpa_supplicant daemon is terminated. |
| 252 |
kelmo-guest |
814 |
|
| 253 |
|
|
|
| 254 |
|
|
3. Mode #2: Roaming Mode |
| 255 |
|
|
======================== |
| 256 |
|
|
|
| 257 |
|
|
A self contained, simplistic roaming mechanism is provided by this package. It |
| 258 |
|
|
is in the form of a wpa_cli action script, /sbin/wpa_action, and it assumes |
| 259 |
|
|
control of ifupdown once activated. The wpa_action(8) manpage describes its |
| 260 |
|
|
technical details in great depth. |
| 261 |
|
|
|
| 262 |
|
|
To activate a roaming interface, adapt the following example interfaces(5) |
| 263 |
|
|
stanza: |
| 264 |
|
|
|
| 265 |
|
|
iface eth1 inet manual |
| 266 |
kelmo-guest |
929 |
wpa-driver wext |
| 267 |
kelmo-guest |
941 |
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf |
| 268 |
kelmo-guest |
814 |
|
| 269 |
|
|
Two daemons are spawned from the above example; wpa_supplicant and wpa_cli. It |
| 270 |
kelmo-guest |
941 |
is required to provide a wpa_supplicant.conf containing a minimal amout of |
| 271 |
|
|
global options, and any known network blocks that should be connected to |
| 272 |
|
|
without interaction. A good starting point is provided by an example |
| 273 |
|
|
configuration file: |
| 274 |
kelmo-guest |
814 |
|
| 275 |
kelmo-guest |
941 |
# copy the template to /etc/wpa_supplicant/ |
| 276 |
kelmo-guest |
934 |
cp /usr/share/doc/wpasupplicant/examples/wpa-roam.conf \ |
| 277 |
kelmo-guest |
929 |
/etc/wpa_supplicant/wpa_supplicant.conf |
| 278 |
kelmo-guest |
986 |
# allow only root to read and write to file |
| 279 |
|
|
chmod 0600 /etc/wpa_supplicant/wpa_supplicant.conf |
| 280 |
kelmo-guest |
814 |
|
| 281 |
|
|
NOTE: it is critical that the used wpa_supplicant.conf defines the location of |
| 282 |
|
|
the 'ctrl_interface' so that a communication socket is created for the |
| 283 |
kelmo-guest |
941 |
wpa_cli (wpa-roam daemon) to attach. The mentioned example configuration, |
| 284 |
|
|
/usr/share/doc/wpasupplicant/examples/wpa-roam.conf, has been set to a |
| 285 |
kelmo-guest |
934 |
sane default. |
| 286 |
kelmo-guest |
814 |
|
| 287 |
|
|
It is required to edit this configuration file, and add the network blocks for |
| 288 |
|
|
all known networks. If you do not understand what this means, start reading the |
| 289 |
|
|
wpa_supplicant.conf(5) manpage now. |
| 290 |
|
|
|
| 291 |
|
|
For each network, you may specify a special option 'id_str'. It should be set to |
| 292 |
|
|
a simple text string. This text string forms the basis for network profiling; it |
| 293 |
|
|
correlates to a logical interface defined in the interfaces(5) file. When no |
| 294 |
|
|
'id_str' is given for a network, wpa_action assumes it will use the 'default' |
| 295 |
|
|
logical interface as fallback. The fallback interface can be chosen via the |
| 296 |
kelmo-guest |
870 |
'wpa-roam-default-iface' option. |
| 297 |
kelmo-guest |
814 |
|
| 298 |
|
|
So what does all this mean? Lets illustrate it with a small example taken from |
| 299 |
|
|
the wpa_action(8) manpage. |
| 300 |
|
|
|
| 301 |
|
|
wpa_supplicant.conf |
| 302 |
|
|
=================== |
| 303 |
|
|
network={ |
| 304 |
kelmo-guest |
929 |
ssid="foo" |
| 305 |
kelmo-guest |
941 |
key_mgmt=NONE |
| 306 |
kelmo-guest |
929 |
# this id_str will notify /sbin/wpa_action to 'ifup uni' |
| 307 |
|
|
id_str="uni" |
| 308 |
kelmo-guest |
814 |
} |
| 309 |
|
|
|
| 310 |
|
|
network={ |
| 311 |
kelmo-guest |
929 |
ssid="bar" |
| 312 |
kelmo-guest |
941 |
psk=123456789... |
| 313 |
kelmo-guest |
929 |
# this id_str will notify /sbin/wpa_action to 'ifup home_static' |
| 314 |
|
|
id_str="home_static" |
| 315 |
kelmo-guest |
814 |
} |
| 316 |
|
|
|
| 317 |
|
|
network={ |
| 318 |
kelmo-guest |
929 |
ssid="" |
| 319 |
|
|
key_mgmt=NONE |
| 320 |
kelmo-guest |
941 |
# no 'id_str' parameter is given, /sbin/wpa_action will 'ifup default' |
| 321 |
kelmo-guest |
814 |
} |
| 322 |
|
|
|
| 323 |
|
|
/etc/network/interfaces |
| 324 |
|
|
======================= |
| 325 |
|
|
# the roaming interface MUST use the manual inet method |
| 326 |
|
|
# 'allow-hotplug' or 'auto' ensures the daemon starts automatically |
| 327 |
|
|
allow-hotplug eth1 |
| 328 |
|
|
iface eth1 inet manual |
| 329 |
kelmo-guest |
929 |
wpa-driver wext |
| 330 |
|
|
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf |
| 331 |
kelmo-guest |
814 |
|
| 332 |
|
|
# no id_str, 'default' is used as the fallback mapping target |
| 333 |
|
|
iface default inet dhcp |
| 334 |
|
|
|
| 335 |
|
|
# id_str="uni" |
| 336 |
|
|
iface uni inet dhcp |
| 337 |
|
|
|
| 338 |
|
|
# id_str="home_static" |
| 339 |
|
|
iface home_static inet static |
| 340 |
|
|
address 192.168.0.20 |
| 341 |
|
|
netmask 255.255.255.0 |
| 342 |
|
|
network 192.168.0.0 |
| 343 |
|
|
broadcast 192.168.0.255 |
| 344 |
|
|
gateway 192.168.0.1 |
| 345 |
|
|
|
| 346 |
|
|
A logical interface is brought up via ifup, and taken down via ifdown, as |
| 347 |
|
|
wpa_supplicant associates and de-associates with the network associated |
| 348 |
|
|
to it by the 'id_str' option used in the wpa_supplicant.conf configuration file. |
| 349 |
|
|
|
| 350 |
kelmo-guest |
978 |
A log of /sbin/wpa_action's actions is created at |
| 351 |
|
|
/var/log/wpa_action.$IFACE.log, please attach the log when reporting problems. |
| 352 |
kelmo-guest |
814 |
|
| 353 |
kelmo-guest |
942 |
Interacting with wpa_supplicant with wpa_cli and wpa_gui |
| 354 |
|
|
======================================================== |
| 355 |
|
|
|
| 356 |
|
|
The wpa_supplicant process can be interacted with by members of the "netdev" |
| 357 |
|
|
group if the example roaming configuration was used as is (or by whatever |
| 358 |
|
|
group or gid specified by the GROUP= crtl_interface parameter). |
| 359 |
|
|
|
| 360 |
|
|
# the default ctrl_interface option used in the example file |
| 361 |
|
|
# /usr/share/doc/wpasupplicant/examples/wpa-roam.conf |
| 362 |
|
|
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev |
| 363 |
|
|
|
| 364 |
|
|
To interact with the supplicant, the wpa_cli (command line) and wpa_gui (QT) |
| 365 |
|
|
have been provided. With these you may connect, disconnect, add/delete new |
| 366 |
|
|
network blocks, provide required interactive security information and so on. |
| 367 |
|
|
|
| 368 |
kelmo-guest |
814 |
Controlling the Roaming Daemon with wpa_action |
| 369 |
|
|
============================================== |
| 370 |
|
|
|
| 371 |
|
|
Once the roaming daemon is started, it assumes control of ifupdown. That is; |
| 372 |
|
|
wpa_cli calls ifup when wpa_supplicant has successfully associated with an |
| 373 |
|
|
access point, and calls ifdown when the connection is lost or terminated. |
| 374 |
|
|
While the roaming daemon is active, ifupdown should not be controlled directly |
| 375 |
|
|
by manually issued commands, rather /sbin/wpa_action is supplied to stop and |
| 376 |
|
|
reload the roaming daemon. For example, to stop the |
| 377 |
|
|
romaing daemon on the device 'eth1': |
| 378 |
|
|
|
| 379 |
kelmo-guest |
929 |
wpa_action eth1 stop |
| 380 |
kelmo-guest |
814 |
|
| 381 |
|
|
When it is required to update the roaming daemon with a new networks details, |
| 382 |
|
|
it can be done without stopping it. Edit the wpa_supplicant.conf file that is |
| 383 |
|
|
being used by the daemon with the new networks details, add optional network |
| 384 |
|
|
settings to /etc/network/interfaces that are specific to the new network |
| 385 |
|
|
(linked by the 'id_str') and then 'reload' the daemon like so: |
| 386 |
|
|
|
| 387 |
kelmo-guest |
929 |
wpa_action eth1 reload |
| 388 |
kelmo-guest |
814 |
|
| 389 |
|
|
For the complete technical details of what wpa_action can do, read the |
| 390 |
|
|
wpa_action(8) manpage. |
| 391 |
|
|
|
| 392 |
|
|
Fine Tuning the Roaming Setup |
| 393 |
|
|
============================= |
| 394 |
|
|
|
| 395 |
|
|
You may face situations where multiple known access points are in close |
| 396 |
|
|
proximity. You can choose which one is preferred manually, with wpa_cli or |
| 397 |
|
|
wpa_gui, or you can give each network its own priority. This is provided by the |
| 398 |
|
|
'priority' option of wpa_supplicant.conf. |
| 399 |
|
|
|
| 400 |
|
|
The Logfile |
| 401 |
|
|
=========== |
| 402 |
|
|
|
| 403 |
|
|
All activity of the roaming dameon is logged to /var/log/wpa_action.log. The |
| 404 |
|
|
following information is logged: |
| 405 |
|
|
|
| 406 |
kelmo-guest |
929 |
* time and date |
| 407 |
|
|
* interface name and action event |
| 408 |
|
|
* values of enviromental variables (WPA_ID, WPA_ID_STR, WPA_CTRL_DIR) |
| 409 |
|
|
* ifupdown command executed |
| 410 |
|
|
* wpa_cli status (based on WPA-PSK network, may display different info) |
| 411 |
|
|
- bssid |
| 412 |
|
|
- ssid |
| 413 |
|
|
- id |
| 414 |
|
|
- id_str |
| 415 |
|
|
- pairwise_cipher |
| 416 |
|
|
- group_cipher |
| 417 |
|
|
- key_mgmt |
| 418 |
|
|
- wpa_state |
| 419 |
|
|
- ip_address |
| 420 |
kelmo-guest |
814 |
|
| 421 |
|
|
Using External Mapping Scripts (e.g. guessnet) |
| 422 |
|
|
============================================== |
| 423 |
|
|
|
| 424 |
|
|
In addition to the internal mapping of logical interfaces via 'id_str', |
| 425 |
|
|
wpa_action can call external mapping scripts. A mapping script should return |
| 426 |
|
|
the name of the logical interface which should be brought up. Any mapping |
| 427 |
|
|
script that works from ifupdowns mapping mechanism (see man interfaces) should |
| 428 |
|
|
also work when called from wpa_action. |
| 429 |
|
|
|
| 430 |
|
|
To call a mapping script add a line 'wpa-mapping-script name-of-the-script' to |
| 431 |
|
|
the interfaces stanza of the physical roaming device. (You may have to specify |
| 432 |
|
|
the absolute path to the mapping script.) |
| 433 |
|
|
|
| 434 |
|
|
The contents of lines starting with wpa-map are passed to stdin of the mapping |
| 435 |
|
|
script. Since ifupdown allows only one wpa-map line you can append any number |
| 436 |
|
|
to wpa-map for additional lines. For example: |
| 437 |
|
|
|
| 438 |
|
|
iface wlan0 inet manual |
| 439 |
kelmo-guest |
929 |
wpa-driver wext |
| 440 |
|
|
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf |
| 441 |
|
|
wpa-mapping-script guessnet-ifupdown |
| 442 |
|
|
wpa-map0 home |
| 443 |
|
|
wpa-map1 work |
| 444 |
|
|
wpa-map2 school |
| 445 |
|
|
# ... additional wpa-mapX lines as required |
| 446 |
kelmo-guest |
814 |
|
| 447 |
|
|
|
| 448 |
|
|
By default the mapping script will only be used when no 'id_str' is available |
| 449 |
|
|
for the current network. If you want to completely disable 'id_str' matching |
| 450 |
|
|
and use only an external mapping script, use the |
| 451 |
|
|
'wpa-mapping-script-priority 1' option to override default behaviour. |
| 452 |
|
|
|
| 453 |
|
|
If the mapping script returns an empty string wpa_action will fallback to using |
| 454 |
|
|
the 'default' interface, unless an alternative is defined by the |
| 455 |
|
|
'wpa-roam-default-iface' option. |
| 456 |
|
|
|
| 457 |
|
|
Below is an advanced example, using guessnet-ifupdown as the external mapping |
| 458 |
|
|
script. |
| 459 |
|
|
|
| 460 |
|
|
/etc/network/interfaces with external mapping |
| 461 |
|
|
============================================= |
| 462 |
|
|
|
| 463 |
|
|
allow-hotplug wlan0 |
| 464 |
|
|
iface wlan0 inet manual |
| 465 |
|
|
wpa-driver wext |
| 466 |
|
|
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf |
| 467 |
kelmo-guest |
929 |
wpa-roam-default-iface default-wparoam |
| 468 |
kelmo-guest |
814 |
wpa-mapping-script guessnet-ifupdown |
| 469 |
kelmo-guest |
929 |
wpa-map default: default-guessnet |
| 470 |
|
|
wpa-map0 home_static |
| 471 |
|
|
wpa-map1 work_static |
| 472 |
kelmo-guest |
814 |
|
| 473 |
|
|
# school can only be chosen via 'id_str' matching |
| 474 |
|
|
iface school inet dhcp |
| 475 |
kelmo-guest |
929 |
# resolvconf |
| 476 |
|
|
dns-nameservers 11.22.33.44 55.66.77.88 |
| 477 |
kelmo-guest |
814 |
|
| 478 |
|
|
iface home_static inet static |
| 479 |
|
|
address 192.168.0.20 |
| 480 |
|
|
netmask 255.255.255.0 |
| 481 |
|
|
network 192.168.0.0 |
| 482 |
|
|
broadcast 192.168.0.255 |
| 483 |
|
|
gateway 192.168.0.1 |
| 484 |
kelmo-guest |
929 |
test peer address 192.168.0.1 mac 00:01:02:03:04:05 |
| 485 |
kelmo-guest |
814 |
|
| 486 |
|
|
iface work_static inet static |
| 487 |
kelmo-guest |
929 |
address 192.168.3.200 |
| 488 |
kelmo-guest |
814 |
netmask 255.255.255.0 |
| 489 |
|
|
network 192.168.3.0 |
| 490 |
|
|
broadcast 192.168.3.255 |
| 491 |
|
|
gateway 192.168.3.1 |
| 492 |
kelmo-guest |
929 |
test peer address 192.168.3.1 mac 00:01:02:03:04:05 |
| 493 |
kelmo-guest |
814 |
|
| 494 |
|
|
iface default-guessnet inet dhcp |
| 495 |
|
|
|
| 496 |
|
|
iface default-wparoam inet dhcp |
| 497 |
|
|
|
| 498 |
|
|
In this example wpa_action will use guessnet for the selection of a suitable |
| 499 |
|
|
logical interface only when no 'id_str' option has been provided for the |
| 500 |
|
|
current network in the provided wpa_supplicant.conf. |
| 501 |
|
|
|
| 502 |
|
|
The 'wpa-map' lines provide guessnet with the logical interfaces that are to be |
| 503 |
|
|
tested as well as the default interface to be used when all tests fail. The |
| 504 |
|
|
'test' lines of each logical interface are used by guessnet to determine if |
| 505 |
|
|
we are actually connected to that network. For instance, guessnet will choose |
| 506 |
|
|
the logical interface 'home_static' if there's a device with an IP address of |
| 507 |
|
|
192.168.0.1 and MAC of 00:01:02:03:04:05 on the current network. If all tests |
| 508 |
|
|
fail, the 'default-guessnet' interface will be configured. |
| 509 |
|
|
|
| 510 |
|
|
Please, read the guessnet(8) manpage for more information. |
| 511 |
|
|
|
| 512 |
|
|
|
| 513 |
|
|
4. Troubleshooting |
| 514 |
|
|
================== |
| 515 |
|
|
|
| 516 |
|
|
In order to debug connection, association and authentication problems, |
| 517 |
kelmo-guest |
959 |
increase the verbosity level of wpa_supplicant in order to log debug |
| 518 |
|
|
output to /var/log/wpa_supplicant.$iface.log. |
| 519 |
kelmo-guest |
814 |
|
| 520 |
kelmo-guest |
959 |
iface eth1 inet dhcp |
| 521 |
|
|
wpa-verbosity-level 3 |
| 522 |
|
|
... |
| 523 |
|
|
|
| 524 |
|
|
Verbosity level number 3 starts the supplicant with the -ddd command line |
| 525 |
kelmo-guest |
979 |
option, level 2 with -dd an level 1 with -d. Values of -1 and -2 will cause |
| 526 |
|
|
wpa_supplicant to be started with -q and -qq options respectively (quiet mode). |
| 527 |
|
|
Any other wpa-verbosity-level value will cause the supplicant to be started |
| 528 |
|
|
with default verbosity level. |
| 529 |
kelmo-guest |
959 |
|
| 530 |
|
|
Another method is to start `wpa_cli -i <interface>` in another shell before |
| 531 |
|
|
starting the interface. Use the command 'level 0' first, to get all debug |
| 532 |
|
|
messages sent to the control socket by wpa_supplicant. |
| 533 |
|
|
|
| 534 |
|
|
To debug the ifupdown scripts that start wpa_supplicant and friends, use |
| 535 |
|
|
`ifup --verbose <interface>` to get verbose messages, or set |
| 536 |
|
|
wpa-maint-debug to any value to see shell code execution (set -x). |
| 537 |
|
|
|
| 538 |
kelmo-guest |
814 |
Hidden ssids |
| 539 |
|
|
============ |
| 540 |
|
|
|
| 541 |
kelmo-guest |
941 |
For reference, see #358137 [1]. In order to be able to associate to hidden |
| 542 |
kelmo-guest |
929 |
ssids, please try to set the option 'ap_scan=1' in the global section, and |
| 543 |
kelmo-guest |
814 |
'scan_ssid=1' in your network block section of your wpa_supplicant.conf file. |
| 544 |
|
|
If you are using the managed mode, you can do so by these stanzas: |
| 545 |
|
|
|
| 546 |
|
|
iface eth1 inet dhcp |
| 547 |
kelmo-guest |
929 |
wpa-ap-scan 1 |
| 548 |
|
|
wpa-scan-ssid 1 |
| 549 |
|
|
# ... additional options for your setup |
| 550 |
kelmo-guest |
814 |
|
| 551 |
kelmo-guest |
941 |
According to #368770 [2], association can take a very long time under certain |
| 552 |
kelmo-guest |
929 |
circumstances. In some cases, setting the parameter 'ap_scan=2' in the |
| 553 |
kelmo-guest |
814 |
config file, (or using a 'wpa-ap-scan 2' stanza, which is equivalent) can |
| 554 |
kelmo-guest |
929 |
greatly help to speed up association. Please note that setting ap_scan to the |
| 555 |
|
|
value of 2 also requires that all networks have a precisely defined security |
| 556 |
|
|
policy for for key_mgmt, pairwise, group and proto network policy variables. |
| 557 |
kelmo-guest |
814 |
|
| 558 |
kelmo-guest |
941 |
[1] http://bugs.debian.org/358137 |
| 559 |
|
|
[2] http://bugs.debian.org/368770 |
| 560 |
kelmo-guest |
814 |
|
| 561 |
kelmo-guest |
929 |
|
| 562 |
kelmo-guest |
814 |
5. Security Considerations |
| 563 |
|
|
========================== |
| 564 |
|
|
|
| 565 |
|
|
Configuration File Permissions |
| 566 |
|
|
============================== |
| 567 |
|
|
It is important to keep PSK's and other sensitive information concerning your |
| 568 |
|
|
network settings private, therefore ensure that important configuration files |
| 569 |
|
|
containing such data are only readable by their owner. For example: |
| 570 |
|
|
|
| 571 |
kelmo-guest |
929 |
chmod 0600 /etc/network/interfaces |
| 572 |
|
|
chmod 0600 /etc/wpa_supplicant/wpa_supplicant.conf |
| 573 |
kelmo-guest |
814 |
|
| 574 |
|
|
By default, /etc/network/interfaces is world readable, and thus unsuitable for |
| 575 |
|
|
containing secret keys and passwords. |