[CentOS] wpa_supplicant

Thu Sep 8 21:41:29 UTC 2005
Paul Heinlein <heinlein at madboa.com>

On Thu, 8 Sep 2005, centos at 911networks.com wrote:

> Hi,
>
> I am running Centos 4.1 on a Dell D610 with ipw2200.
>
> Any good howto for running wpa-psk?
>
> I have searched and not found much related to RHEL or CentOS.

Faced with a similar dilemma a couple weeks ago, I just rolled my own 
and installed madwifi and wpa_supplicant manually. I'd guess dag or 
someone has them in RPM format somewhere.

I built an extremely simple launching script (below) and did minor 
tweaking to /etc/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=2
ap_scan=1
fast_reauth=1
network={
   ssid="YourNetworkID"
   psk="YourObnoxiouslyLongSharedKey"
   scan_ssid=1
   key_mgmt=WPA-PSK
}

It's by no means an exemplary system, particularly the init script 
which does no error checking and fails to handle return codes 
correctly. In the meantime, however, it works....

-- 
Paul Heinlein <> heinlein at madboa.com <> www.madboa.com

#!/bin/bash
#
# wireless      This shell script takes care of starting and stopping
#               wireless networking.
#
# chkconfig: - 80 30
# processname: wpa_supplicant
# config: /etc/wpa_supplicant.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

RETVAL=0
fullname=/usr/local/sbin/wpa_supplicant
[ -f "$fullname" ] || exit 0

start() {
   echo -n $"Starting wireless interface: "
   # load up some modules
   /sbin/modprobe -s ath_pci
   $fullname -Bq -c/etc/wpa_supplicant.conf -iath0
   /sbin/ifup ath0
   echo
}

stop() {
   echo -n $"Stopping wireless interface: "
   # bring down interface
   /sbin/ifdown ath0 || :
   killproc wpa_supplicant || :
   /sbin/modprobe -s -r ath_pci wlan_tkip
   echo
}

# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   status)
         status wpa_supplicant
         RETVAL=$?
         ;;
   *)
         echo $"Usage: $0 {start|stop|status}"
         exit 1
esac