📄 readme
字号:
use.ctrl_interface=/var/run/wpa_supplicantctrl_interface_group=wheelnetwork={ ssid="example" scan_ssid=1 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE pairwise=CCMP TKIP group=CCMP TKIP WEP104 WEP40 psk="very secret passphrase" eap=TTLS PEAP TLS identity="user@example.com" password="foobar" ca_cert="/etc/cert/ca.pem" client_cert="/etc/cert/user.pem" private_key="/etc/cert/user.prv" private_key_passwd="password" phase1="peaplabel=0" ca_cert2="/etc/cert/ca2.pem" client_cert2="/etc/cer/user.pem" private_key2="/etc/cer/user.prv" private_key2_passwd="password"}6) Authentication for wired Ethernet. This can be used with 'wired' interface (-Dwired on command line).ctrl_interface=/var/run/wpa_supplicantctrl_interface_group=wheelap_scan=0network={ key_mgmt=IEEE8021X eap=MD5 identity="user" password="password" eapol_flags=0}Certificates------------Some EAP authentication methods require use of certificates. EAP-TLSuses both server side and client certificates whereas EAP-PEAP andEAP-TTLS only require the server side certificate. When clientcertificate is used, a matching private key file has to also beincluded in configuration. If the private key uses a passphrase, thishas to be configured in wpa_supplicant.conf ("private_key_passwd").wpa_supplicant supports X.509 certificates in PEM and DERformats. User certificate and private key can be included in the samefile.If the user certificate and private key is received in PKCS#12/PFXformat, they need to be converted to suitable PEM/DER format forwpa_supplicant. This can be done, e.g., with following commands:# convert client certificate and private key to PEM formatopenssl pkcs12 -in example.pfx -out user.pem -clcerts# convert CA certificate (if included in PFX file) to PEM formatopenssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeyswpa_cli-------wpa_cli is a text-based frontend program for interacting withwpa_supplicant. It is used to query current status, changeconfiguration, trigger events, and request interactive user input.wpa_cli can show the current authentication status, selected securitymode, dot11 and dot1x MIBs, etc. In addition, it can configure somevariables like EAPOL state machine parameters and trigger events likereassociation and IEEE 802.1X logoff/logon. wpa_cli provides a userinterface to request authentication information, like username andpassword, if these are not included in the configuration. This can beused to implement, e.g., one-time-passwords or generic token cardauthentication where the authentication is based on achallenge-response that uses an external device for generating theresponse.The control interface of wpa_supplicant can be configured to allownon-root user access (ctrl_interface_group in the configurationfile). This makes it possible to run wpa_cli with a normal useraccount.wpa_cli supports two modes: interactive and command line. Both modesshare the same command set and the main difference is in interactivemode providing access to unsolicited messages (event messages,username/password requests).Interactive mode is started when wpa_cli is executed without includingthe command as a command line parameter. Commands are then entered onthe wpa_cli prompt. In command line mode, the same commands areentered as command line arguments for wpa_cli.Interactive authentication parameters requestWhen wpa_supplicant need authentication parameters, like username andpassword, which are not present in the configuration file, it sends arequest message to all attached frontend programs, e.g., wpa_cli ininteractive mode. wpa_cli shows these requests with"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, orOTP (one-time-password). <id> is a unique identifier for the currentnetwork. <text> is description of the request. In case of OTP request,it includes the challenge from the authentication server.The reply to these requests can be given with 'identity', 'password',and 'otp' commands. <id> needs to be copied from the the matchingrequest. 'password' and 'otp' commands can be used regardless ofwhether the request was for PASSWORD or OTP. The main differencebetween these two commands is that values given with 'password' areremembered as long as wpa_supplicant is running whereas values givenwith 'otp' are used only once and then forgotten, i.e., wpa_supplicantwill ask frontend for a new value for every use. This can be used toimplement one-time-password lists and generic token card -basedauthentication.Example request for password and a matching reply:CTRL-REQ-PASSWORD-1:Password needed for SSID foobar> password 1 mysecretpasswordExample request for generic token card challenge-response:CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar> otp 2 9876wpa_cli commands status = get current WPA/EAPOL/EAP status mib = get MIB variables (dot1x, dot11) help = show this usage help interface [ifname] = show interfaces/select interface level <debug level> = change debug level license = show full wpa_cli license logoff = IEEE 802.1X EAPOL state machine logoff logon = IEEE 802.1X EAPOL state machine logon set = set variables (shows list of variables when run without arguments) pmksa = show PMKSA cache reassociate = force reassociation reconfigure = force wpa_supplicant to re-read its configuration file preauthenticate <BSSID> = force preauthentication identity <network id> <identity> = configure identity for an SSID password <network id> <password> = configure password for an SSID pin <network id> <pin> = configure pin for an SSID otp <network id> <password> = configure one-time-password for an SSID passphrase <network id> <passphrase> = configure private key passphrase for an SSID bssid <network id> <BSSID> = set preferred BSSID for an SSID list_networks = list configured networks select_network <network id> = select a network (disable others) enable_network <network id> = enable a network disable_network <network id> = disable a network add_network = add a network remove_network <network id> = remove a network set_network <network id> <variable> <value> = set network variables (shows list of variables when run without arguments) get_network <network id> <variable> = get network variables save_config = save the current configuration disconnect = disconnect and wait for reassociate command before connecting scan = request new BSS scan scan_results = get latest scan results get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies terminate = terminate wpa_supplicant quit = exit wpa_cliwpa_cli command line optionswpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \ [-P<pid file>] [-g<global ctrl>] [command..] -h = help (show this usage text) -v = shown version information -a = run in daemon mode executing the action file based on events from wpa_supplicant -B = run a daemon in the background default path: /var/run/wpa_supplicant default interface: first interface found in socket pathUsing wpa_cli to run external program on connect/disconnect-----------------------------------------------------------wpa_cli can used to run external programs whenever wpa_supplicantconnects or disconnects from a network. This can be used, e.g., toupdate network configuration and/or trigget DHCP client to update IPaddresses, etc.One wpa_cli process in "action" mode needs to be started for eachinterface. For example, the following command starts wpa_cli for thedefault ingterface (-i can be used to select the interface in case ofmore than one interface being used at the same time):wpa_cli -a/sbin/wpa_action.sh -BThe action file (-a option, /sbin/wpa_action.sh in this example) willbe executed whenever wpa_supplicant completes authentication (connectevent) or detects disconnection). The action script will be calledwith two command line arguments: interface name and event (CONNECTEDor DISCONNECTED). If the action script needs to get more informationabout the current network, it can use 'wpa_cli status' to querywpa_supplicant for more information.Following example can be used as a simple template for an actionscript:#!/bin/shIFNAME=$1CMD=$2if [ "$CMD" == "CONNECTED" ]; then SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=` # configure network, signal DHCP client, etc.fiif [ "$CMD" == "DISCONNECTED" ]; then # remove network configuration, if neededfiIntegrating with pcmcia-cs/cardmgr scripts------------------------------------------wpa_supplicant needs to be running when using a wireless network withWPA. It can be started either from system startup scripts or frompcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must becompleted before data frames can be exchanged, so wpa_supplicantshould be started before DHCP client.Command line option '-w' can be used if wpa_supplicant is startedbefore the wireless LAN interface is present (e.g., before insertingthe PC Card) or is not yet up.For example, following small changes to pcmcia-cs scripts can be usedto enable WPA support:Add MODE="Managed" and WPA="y" to the network scheme in/etc/pcmcia/wireless.opts.Add the following block to the end of 'start' action handler in/etc/pcmcia/wireless: if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \ -i$DEVICE fiAdd the following block to the end of 'stop' action handler (may needto be separated from other actions) in /etc/pcmcia/wireless: if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then killall wpa_supplicant fiThis will make cardmgr start wpa_supplicant when the card is pluggedin. wpa_supplicant will wait until the interface is set up--eitherwhen a static IP address is configured or when DHCP client isstarted--and will then negotiate keys with the AP.Dynamic interface add and operation without configuration files---------------------------------------------------------------wpa_supplicant can be started without any configuration files ornetwork interfaces. When used in this way, a global (i.e., perwpa_supplicant process) control interface is used to add and removenetwork interfaces. Each network interface can then be configuredthrough a per-network interface control interface. For example,following commands show how to start wpa_supplicant without anynetwork interfaces and then add a network interface and configure anetwork (SSID):# Start wpa_supplicant in the backgroundwpa_supplicant -g/var/run/wpa_supplicant-global -B# Add a new interface (wlan0, no configuration file, driver=wext, and# enable control interface)wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \ "" wext /var/run/wpa_supplicant# Configure a network using the newly added network interface:wpa_cli -iwlan0 add_networkwpa_cli -iwlan0 set_network 0 ssid '"test"'wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSKwpa_cli -iwlan0 set_network 0 psk '"12345678"'wpa_cli -iwlan0 set_network 0 pairwise TKIPwpa_cli -iwlan0 set_network 0 group TKIPwpa_cli -iwlan0 set_network 0 proto WPAwpa_cli -iwlan0 enable_network 0# At this point, the new network interface should start trying to associate# with the WPA-PSK network using SSID test.# Remove network interfacewpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -