Welcome to graduate2professional.blogspot.com

Sunday, December 2, 2012

Overview of wpa_cli


Wpa_cli:

The wpa_cli utility is a text-based front-end program for interacting with wpa_supplicant. You can use it to query the current status, change the configuration, trigger events, and request interactive user input. 
 
Prerequisites to using wpa_cli:
A working wireless interface with wpa_supplicant running on it
The wpa_cli utility can show the current authentication status, selected security mode, dot11 and dot1x MIBs, etc. In addition, it can configure some variables like EAPOL state machine parameters and trigger events like reassociation and IEEE 802.1X logoff/logon. 

The wpa_cli utilities supports interactive and command-line modes. Both modes share the same command set, and the main difference is in interactive mode providing access to unsolicited messages (event messages, user name/password requests).


Interactive mode is started when wpa_cli is executed without any parameters on the command line. Commands are then entered from the controlling terminal in response to the wpa_cli prompt.
In command line mode, the same commands are entered as command line arguments.

Syntax:

wpa_cli  [-p path to ctrl sockets] 
         [-i ifname] 
         [-hvB] [-a action file] 
         [-P pid file] [command ... ]


Options:

-p path
Change the path where control sockets should be found.
Eg:wpa_cli -p /var/run/ctrl_interface
 
-i ifname
Specify the interface that is being configured. By default, choose the first interface found with a control socket in the socket path. 
Eg: wpa_cli -iwlan0 
-h
Help. Show a usage message.
-v
Show version information. 
-B
Run as a daemon in the background.
-a file
Run in daemon mode executing the action file based on events from wpa_supplicant. The specified file will be executed with the first argument set to the interface name, and the second to CONNECT or DISCONNECT, depending on the event.
-P file
Set the location of the PID file.
command
Run a command
  Eg: p2p_find, p2p_connect, p2p_group_add, p2p_group_remove, p2p_peer, p2p_peers, all_sta e.t.c.

Saturday, December 1, 2012

Overview of WPA_Supplicant


WPA_Supplicant:

wpa_supplicant is a WPA Supplicant for Linux, BSD, Mac OS X, and Windows with support for WPA and WPA2 (IEEE 802.11i / RSN). It is suitable for both desktop/laptop computers and embedded systems.

wpa_supplicant is designed to be a "daemon" program that runs in the background and acts as the backend component controlling the wireless connection. wpa_supplicant supports separate frontend programs and a text-based frontend (wpa_cli) and a GUI (wpa_gui) are included with wpa_supplicant.

wpa_supplicant implements a control interface that can be used by external programs to control the operations of the wpa_supplicant daemon and to get status information and event notifications.
wpa_supplicant was designed to be portable for different drivers and operating systems. Hopefully, support for more wlan cards and OSes will be added in the future.

Before wpa_supplicant can do its work, the network interface must be available. That means that the physical device must be present and enabled, and the driver for the device must have be loaded. Note, however, that the -w option of the wpa_supplicant daemon instructs the daemon to continue to run and to wait for the interface to become available. Without the -w option, the daemon will exit immediately if the device isn't already available.
The wpa_supplicant utility is an implementation of the WPA Supplicant component, i.e., the part that runs in the client stations. It implements WPA key negotiation with a WPA Authenticator and EAP authentication with Authentication Server. In addition, it controls the roaming and IEEE 802.11 authentication/association of the wireless LAN driver.


After wpa_supplicant has configured the network device, higher level configuration such as DHCP may proceed.
The following steps are used when associating with an AP using WPA:
  1. wpa_supplicant requests the driver to scan neighboring BSSes
  2. wpa_supplicant selects a BSS based on its configuration
  3. wpa_supplicant requests the driver to associate with the chosen BSS
  4. If WPA-EAP: integrated IEEE 802.1X Supplicant or external Xsupplicant completes EAP authentication with the authentication server (proxied by the Authenticator in the AP)
  5. If WPA-EAP: master key is received from the IEEE 802.1X Supplicant
  6. If WPA-PSK: wpa_supplicant uses PSK as the master session key
  7. wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake with the Authenticator (AP)
  8. wpa_supplicant configures encryption keys for unicast and broadcast
  9. normal data packets can be transmitted and received 

    Syntax:

    wpa_supplicant [-BddehLqqvw] [-iifname]  
                   [-cconfig file]  
                   [-Ddriver]

    Options:

    -p path
    Change the path where control sockets should be found.
    -i ifname
    Specify the interface that is being configured. By default, choose the first interface found with a control socket in the socket path.
    -h
    Help. Show a usage message.
    -v
    Show version information.
    -B
    Run as a daemon in the background.
    -a file
    Run in daemon mode executing the action file based on events from wpa_supplicant. The specified file will be executed with the first argument set to interface name and second to "CONNECT" or "DISCONNECT" depending on the event. This can be used
    -P file
    Set the location of the PID file.
    command
    Run a command. The available commands are listed in the next section.
    The following commands are available:
    -B
    Run daemon in the background.
    -i ifname
    Interface to listen on.
    -c filename
    Path to configuration file.
    -D driver
    Driver to use. See the available options below.
    -d
    Increase debugging verbosity (-dd even more).
    -K
    Include keys (passwords, etc.) in debug output.
    -t
    Include timestamp in debug messages.
    -e
    Use external IEEE 802.1X Supplicant (e.g., xsupplicant) (this disables the internal Supplicant).
    -h
    Help. Show a usage message.
    -L
    Show license (GPL and BSD).
    -q
    Decrease debugging verbosity (-qq even less).
    -v
    Show version.
    -w
    Wait for the interface to be added, if needed. Normally, wpa_supplicant exits if the interface isn't there yet.
    -N
    Start describing new interface.