Re: using NetworkManager to connect with 802.1X over a wired connection



> Hi all,
>
> I'm quite desperate for help, I've posted threads on lots of forums with
> requests for help, but so far nobody has been able to help me. Please
> read the following: http://ubuntuforums.org/showthread.php?t=411843
>
> In short, I've got no luck with wpa_supplicant if I want to connect to
> my university's network on Ubuntu 7.04, and nobody has been able to help
> me (on Windows it works fine). I'm getting sick and tired of
> wpa_supplicant's user-unfriendliness, and now that 0.6.5 is released I
> want to try to connect with NetworkManager, since I assume that 0.6.5
> has added support for 802.1X with EAP-TTLS/PAP according to comments -
> http://bugzilla.gnome.org/show_bug.cgi?id=359369#c13 - on Bugzilla. I
> know that NM uses wpa_supplicant as it's backend, but possibly the way
> NM will handle it will work for me.
>
> I haven't got NM 0.6.5 installed yet, because I don't want to compile
> from source. As soon as it's in the Gutsy Gibbon (Ubuntu's codename for
> the next release) repositories I will install it, but I think I still
> have a problem.
>
> Currently, if you use 0.6.4 and you are connected through a wired
> connection, and you click the NM applet, it lists two options: "Wired
> Network" and "Manual configuration". Assuming this has not changed in NM
> 0.6.5, there is no way for me to configure NM to connect to a network
> with 802.1X and EAP-TTLS/PAP over a wired connection, is there?
>
> Is there any way to solve this? Or, at least, can anyone tell me why
> wpa_supplicant can't connect to the network, what I am doing wrong? I'd
> really appreciate any help, because having to use Windows XP because I
> can't access the network under Ubuntu sucks.
>
> Greetings and thanks in advance for any help,
> Alexander van Loon
>
> P.S.: why is there no NEWS file -
> http://svn.gnome.org/viewcvs/NetworkManager/tags/NETWORKMANAGER_0_6_5_RELEASE/NEWS?revision=2558&view=markup
> - for the 0.6.5 release?
>
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list
>

Here�s a script that hooks you up with 802.1x
I came across. hope that NetworkManager which will be in FC7
will have 802.1x support and pptpd vpn support :)
just change the script according to your needs

Hope it will help..

Best Regards
           Johann B.

#!/bin/bash
#
#               eduroam configuration script for Linux
#
# Version 0.1
# Depending on the name with witch the script is called
# it will configure eduroam for TLS, TTLS-PAP or PEAP
# We assume that the wireless card is alreay installed ie. visible under
# iwconfig.
# Sucessfuly tested under the following list of Linux distributions
# Aurox 10.2
# Fedora Core 5
# Fedora Core 6
# Knoppix 5.0.1
# Suse 10.0
# Suse 10.1
# Ubuntu 6.06,
#
# Writen by Tomasz Wolniewicz (twoln umk pl)
# with contribitions from Andrzej Angowski
#
# Please change the org and tls_script_name to fit your needs
# Please modify the script by substituting the coorect certificate
# following line 482
#
# When setting up TLS we assume that the user certificate is in p12 format
# and it makes life easier if the certificates have the extension defined
# below as p12_ext
#

org="Universtity of wherever"

# allowed script names
tls_script_name="eduroam_config_tls"
peap_script_name="eduroam_config_peap"
ttls_script_name="eduroam_config_ttls"

# filename extension for p12/pfx files
p12_ext="p12"

# directories under which things get installed
EDUROAM_CONF_PATH="/etc/eduroam"
EDUROAM_SBIN_PATH="/sbin"
EDUROAM_BIN_PATH="/usr/bin"
# EDUROAM_BIN_PATH must be in user's PATH

# If the main part of the LANG setting matches prefered_lang then
# the non-English text will be used, otherwise we use English.
# This distribution can only work in Polish under pl_PL or
# English under any other locale.
# In order to customise it for another language, you should change the lines
# between  "begin language customisation" and "end language customisation".
# The English meaning of all these phrases is visible in the following
# section. You must also check all instances of lprint and lprintn and
# change the first argument to your language
#
prefered_lang="pl_PL"

l=`echo $LANG | sed -e 's/\..*$//'`
if [ "$TERM" = "xterm" ] ; then
bf="";
n="";
fi


if [ "$l" == "$prefered_lang" ]; then
# begin language customisation
  cannot_locate='Nie moge odnalezc'
  cont="Kontynuowac"
  enter_path="Wprowadz pelna sciezke do"
  yes_no=("T" "N")
  atn="UWAGA"
  org="UMK"
  found="znalazlem"
  usage="Uzycie"
  interface_not_found="nie znalazlem aktywnego interfejsu bezprzewodowego,
nie mozna kontynuowac"
welcome=("      Skrypt konfigurujacy dostep do sieci ${bf}eduroam$n"
"${bf}$atn!$n przeznaczony tylko dla pracownikow i studentow ${bf}${org}$n")
driver_desc=(
"podstawowy sterownik jadra"
"karty na ukladzie Atheros"
"karty Intel 2100/2200 - obecnie zazwyczaj stosuje sie wext"
"sterownik Windows XP i ndiswrapper - obecnie zazwyczaj stosuje sie wext"
)
# end language customisation
else
  cannot_locate='Cannot locate'
  cont="Continue"
  enter_path="enter the path to"
  yes_no=("Y" "N")
  atn="ATTENTION"
  found="found"
  usage="Usage"
  interface_not_found="Could not find any active wirelerss interfaces,
cannot continue"
welcome=("      This sctipt will configure access to ${bf}eduroam$n"
"${bf}$atn!$n to be used only by students and staff of ${bf}${org}$n")
driver_desc=(
"basic kernel driver"
"Atheros based cards"
"Intel 2100/2200 - currently wext is normally used"
"Windows XP driver and ndiswrapper - currently wext is normally used"
)
fi

drivers=("wext" "madwifi" "ipw" "ndiswrapper")
attention="${bf}$atn!${n}"

# functions
#
# lprint takes two string aguments, prints the first if the script
# is running within the preferred language envitonment and the second
otherwise
#
lprintn() {
if [ "$l" == "$prefered_lang" ]; then
  echo -n $1
else
  echo -n $2
fi
}

lprint() {
  lprintn "$1" "$2"
  echo ""
}


# ask uses the yes_no array to ask for confirmation
# the first argument is the user prompt
# if the second argument is 0 then the first element of yes_no array
# will be the default value prompted to the user

ask() {
  while true
  do
  read -p "${bf}${1} ${yes_no[0]}/${yes_no[1]}? [${yes_no[$2]}]:$n " answer
  if [ -z "$answer" ] ; then
    answer=${yes_no[$2]}
  else
    answer=`echo $answer | awk '{ print toupper($0) }'`
  fi
  case "$answer" in
    ${yes_no[0]})
       return 0
       ;;
    ${yes_no[1]})
       return 1
       ;;
  esac
  done
}

myname=`basename $0`
case "$myname" in
   "$tls_script_name")
        tls=1
        ttls=0
        ;;
   "$ttls_script_name")
        tls=0
        ttls=1
        ;;
    "$peap_script_name")
        tls=0
        ttls=0
        ;;
     *)
        lprint "Ten skrypt powinien byc uruchamiany pod jedna z nazw:"
"This script should be named one of the following:"
        echo "$tls_script_name, $peap_script_name, ttls_script_name"
        exit
esac

set -- `getopt ih $*`
for i
do
  case "$i" in
    -h)
      echo "$usage $0 [-i]"
      exit 2 ;;
    -i)
       flag="i"; shift;;
    --)
       shift; break;;
  esac
done

user=`whoami`
if [ "$user" != "root" ]; then
  echo  -n "${attention} "
  lprint "ten skrypt powinien byc uruchomiony z uprawnieniami
administratora" "this script must be started with administrator rights"
  exit
fi

clear
echo ""
echo ${welcome[0]}
echo ${welcome[1]}
echo ""
if ! ask "$cont" 0 ; then exit; fi
clear

# locate iwconfig
#
if [ -x /sbin/iwconfig ]; then
  IWCONFIG="/sbin/iwconfig"
elif [ -x /usr/sbin/iwconfig ]; then
  IWCONFIG="/usr/sbin/iwconfig"
elif [ "$flag" ! = "-i" ] ; then
  echo "${cannot_locate} iwconfig"
  read -p "$enter_path iwconfig: " IWCONFIG
  if [ ! -x $IWCONFIG ] ; then
    echo "${cannot_locate}  $IWCONFIG";
    exit
  fi
fi

if [ "$flag" = "i" ] ; then
  read -p "iwconfig: [${IWCONFIG}] " iwcfg
  if [ "$iwcfg" ] ; then
    IWCONFIG=$iwcfg
  fi
  if [ ! -x $IWCONFIG ] ; then
    echo "${cannot_locate} $IWCONFIG";
    exit
  fi
fi

# locate wireless interface
iface=`${IWCONFIG} 2>/dev/null | awk '/^[a-z]/ {print $1 }'`

if [ -z "${iface}" ] ; then
  echo $interface_not_found
  exit
fi

# locate wpa_supplicant
#
if which wpa_supplicant 1>/dev/null 2>&1 ; then
  WPA_SUPPLICANT=`which wpa_supplicant`
elif [ -x /sbin/wpa_supplicant ]; then
  WPA_SUPPLICANT="/sbin/wpa_supplicant"
elif [ -x /usr/sbin/wpa_supplicant ]; then
  WPA_SUPPLICANT="/usr/sbin/wpa_supplicant"
elif [ "$flag" != "-i" ] ; then
  while [ ! -x "$WPA_SUPPLICANT" -o "$WPA_SUPPLICANT" = "" ]
  do
    echo "${cannot_locate} wpa_supplicant"
    read -p "$enter_path wpa_supplicant: " WPA_SUPPLICANT
  done
fi

if [ "$flag" = "i" ] ; then
  read -p "wpa_supplicant: [${WPA_SUPPLICANT}] " iwcfg
  if [ "$iwcfg" ] ; then
    WPA_SUPPLICANT=$iwcfg
  fi
  while [ ! -x "$WPA_SUPPLICANT" -o "$WPA_SUPPLICANT" = "" ]
  do
    echo "${cannot_locate} wpa_supplicant"
    read -p "$enter_path wpa_supplicant: " WPA_SUPPLICANT
  done
fi

# locate wpa_cli
#
if which wpa_cli 1>/dev/null 2>&1 ; then
   WPA_CLI=`which wpa_cli`
fi

# select the wireless interface
#
iface_count=`${IWCONFIG} 2>/dev/null | awk '/^[a-z]/ {print $1 }'| wc -l`
if [ $iface_count -gt 1 ] ; then
  lprint "Znalazlem aktywne interfejsy bezprzewodowe:" "Found the
following active wirelerss interfaces:"
  echo "$bf${iface}$n"
else
  lprintn  "Znalazlem aktywny interfejs bezprzewodowy" "Found active
wirelerss interface"
  echo ": $bf${iface}$n"
fi

if [ $iface_count -gt 1 ] ; then
  lprint "wybierz jeden z nich" "please choose one"
  ifc=""
  while [ -z $ifc ]
  do
    read -p "${n}interface: ${bf}" ifc
  done
  iface=$ifc
elif [ "$flag" = "i" ] ; then
  read -p "interface: [${iface}] " ifc
  if [ "$ifc" ] ; then
     iface=$ifc
  fi
fi

# select wireless driver
#
case $iface in
  ath[0-9])
    driver="madwifi"
    ;;
  eth[0-9] | wlan[0-9])
    driver="wext"
    ;;
esac

if [ "$flag" = "i" ] ; then
  lprint "dostepne sterowniki:" "available drivers:"

i=0
for ifs in ${drivers[*]}
do
  printf  " %-19s - %s\n" "${bf}$ifs${n}" "${driver_desc[$i]}"
  let i++
done
prompt=`lprint "sterownik" "driver"`
read -p "${prompt}: [${driver}] " dr
  if [ "$dr" ] ; then
     driver=$dr
  fi
fi


if [ -x /sbin/dhcpcd ] ; then
dhclient="/sbin/dhcpcd"
fi

if [ -x /sbin/dhclient ] ; then
dhclient="/sbin/dhclient"
fi

if [ -x /sbin/pump ] ; then
dhclient="/sbin/pump -i"
fi

# check for gksu
GKSU=""
if which gksu 1>/dev/null 2>&1 ; then
   GKSU=`which gksu`
fi

echo ""
echo "--------------------------------------------------------------------"
lprintn "Konfiguruje siec dla" "Configuring eduroam on"; echo " $bf$iface$n"
echo " ${found} $bf$WPA_SUPPLICANT$n"
echo " ${found} $bf$IWCONFIG$n"
echo " ${found} $bf$dhclient$n"
echo -n " "; lprintn "ustawiam sterownik" "setting driver"; echo "
$bf$driver$n"
echo -n " "; lprintn "utworze katalog" "will create directory"; echo "
$bf$EDUROAM_CONF_PATH$n"
echo -n " "; lprint " utworze polecenia" "will create commands:"
echo "  $bf${EDUROAM_SBIN_PATH}/eduroam$n"
echo "  $bf${EDUROAM_BIN_PATH}/eduroam-start$n"
echo "  $bf${EDUROAM_BIN_PATH}/eduroam-stop$n"
if [ -n "$GKSU" ] ; then
echo -n " "; lprint "oraz polecenia pomocnicze:" "and auxilaty commands:"
echo "  $bf${EDUROAM_BIN_PATH}/xeduroam-start$n"
echo "  $bf${EDUROAM_BIN_PATH}/xeduroam-stop$n"
fi
echo "--------------------------------------------------------------------"
echo ""
lprint "Jezeli chcesz cos zmienic w tych ustawieniach, to przerwij
instalacje" "If you would like to change some settings, then stop the
installation"
lprint "i uruchom skrypt ponownie z opcja -i" "and start the script with
-i option"
echo ""

if ! ask "$cont" 1 ; then exit; fi

if [ -z "$GKSU" ]; then
  if which sudo 1>/dev/null 2>&1 ; then
    SUDO=`which sudo`
    prompt=`lprint "czy chcesz uzywac ${n}sudo${bf} przy uruchamianiu
eduroam" "would you like to use ${n}sudo${bf} for starting eduroam"`
    if ask "$prompt" 1; then
      lprintn "OK, uzyje" "OK, will use"
      echo " ${bf}${SUDO}$n"
    else
      lprintn "OK, uzyje" "OK, will use"
      echo " ${bf}su${n}"
      SUDO=""
    fi
  fi
fi

if [ -d "$EDUROAM_CONF_PATH" ] ; then
  echo -n "${attention} "
  lprint "Katalog $EDUROAM_CONF_PATH istnieje" "Directory
$EDUROAM_CONF_PATH exists"
  lprint "niektore pliki moga zostac zmodyfikowane" "some files can be
modified"
  if ! ask "$cont" 1 ; then exit; fi
else
  lprintn "tworze" "creating"; echo " $EDUROAM_CONF_PATH"
  if ! mkdir $EDUROAM_CONF_PATH ; then
    lprintn "blad tworzenia katalogu" "directory creation error for"; echo
" $EDUROAM_CONF_PATH"
    exit
  fi
fi


if [ $tls -eq 1 ] ; then

  cert=`ls *[0-9][0-9].${p12_ext} 2>/dev/null `
  prompt=`lprint "nazwa pliku z certyfikatem indywidualnym" "personal
certificate file"`
  read -p "personal certificate file [$bf$cert${n}]" pfx
  if [ "$pfx" ] ; then
     cert=$pfx
  fi

  if [ ! "$cert" -o ! -f $cert ] ; then
     lprint "nie moge kontynuowac bez poprawnej nazwy pliku" "cannot
conntinue without the correct filename"
     exit;
  fi


  PASSWORD=""
  prompt=`lprint "wprowadz haslo do pliku z certyfikatem" "enter the
password for the certificate file"`
  while [ ! "$PASSWORD" ]
  do
    read -s -r -p "${prompt}: " PASSWORD
    echo ""
  if openssl pkcs12 -in $cert -passin pass:"$PASSWORD" -noout 2>/dev/null;
then
  USER=`openssl pkcs12 -in $cert -passin pass:"$PASSWORD" -nokeys
2>/dev/null | awk -F/ '/subject=/ {print $4}' | sed -e 's/^cn=//i'`

  lid=`echo $USER | sed -e 's/\  *//i'`
  openssl pkcs12 -in $cert -passin pass:"$PASSWORD" -passout
pass:"$PASSWORD" -nocerts -out $lid.key 1>/dev/null 2>&1
  openssl pkcs12 -in $cert -passin pass:"$PASSWORD" -nokeys -out $lid.crt
1>/dev/null 2>&1
  else
   lprint "niepoprawne haslo" "wrong password"
   PASSWORD=""
  fi
  done
  eap="TLS
      client_cert=\"${EDUROAM_CONF_PATH}/${lid}.crt\"
      private_key=\"${EDUROAM_CONF_PATH}/${lid}.key\"
      private_key_passwd=\"${PASSWORD}\""
else
  PASSWORD="a"
  PASSWORD1="b"
  prompt=`lprint "wprowadz swoj identyfikator pocztowy w postaci
id domena" "enter your userid in the form id domain"`
  read -p "${prompt}: " USER
  while [ "$PASSWORD" != "$PASSWORD1" ]
  do
    prompt=`lprint "wprowadz swoje haslo" "enter your password"`
    read -s -r -p "${prompt}: " PASSWORD
    echo ""
    prompt=`lprint "powtorz swoje haslo" "repeat your password"`
    read -s -r -p "repeat your password: " PASSWORD1
    echo ""
  if [ "$PASSWORD" != "$PASSWORD1" ] ; then
    lprint "niezgodne hasla" "passwords do not match"
  fi
  done
  if [ $ttls -eq 1 ] ; then
  eap="TTLS
      password=\"${PASSWORD}\"
      phase2=\"auth=PAP\""
  else
  eap="PEAP
      password=\"${PASSWORD}\"
      phase2=\"auth=MSCHAPV2\""
  fi
fi

echo "ctrl_interface=/var/run/wpa_supplicant

network={
      ssid=\"eduroam\"
      key_mgmt=WPA-EAP
      ca_cert=\"${EDUROAM_CONF_PATH}/ca.cer\"
      identity=\"${USER}\"
      eap=$eap
     }
network={
      ssid=\"eduroam\"
      key_mgmt=IEEE8021X
      ca_cert=\"${EDUROAM_CONF_PATH}/ca.cer\"
      identity=\"${USER}\"
      eap=$eap
     }

" > ${EDUROAM_CONF_PATH}/wpa_supplicant.conf


chown root ${EDUROAM_CONF_PATH}/wpa_supplicant.conf
chmod 600 ${EDUROAM_CONF_PATH}/wpa_supplicant.conf

# Please substitute the correct root certificate below

echo "-----BEGIN CERTIFICATE-----
MIIEZzCCA0+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBgzELMAkGA1UEBhMCUEwx
MTAvBgNVBAoTKFVuaXdlcnN5dGV0IE1pa29sYWphIEtvcGVybmlrYSB3IFRvcnVu
aXUxITAfBgNVBAMTGENlbnRydW0gQ2VydHlmaWthY2ppIFVNSzEeMBwGCSqGSIb3
DQEJARYPY2FAdW5pLnRvcnVuLnBsMB4XDTA0MDcwNjA4MjcyOFoXDTI0MDcwMTA4
MjcyOFowgYMxCzAJBgNVBAYTAlBMMTEwLwYDVQQKEyhVbml3ZXJzeXRldCBNaWtv
bGFqYSBLb3Blcm5pa2EgdyBUb3J1bml1MSEwHwYDVQQDExhDZW50cnVtIENlcnR5
ZmlrYWNqaSBVTUsxHjAcBgkqhkiG9w0BCQEWD2NhQHVuaS50b3J1bi5wbDCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMIusJAHVNh7mD5siWL1QSygQMxw
MKx4IJsMx2XIkcM/zEYjQ3xZyzltJjHf9nmubyKZ8dUsywI3L/2pTxWbmGlqTbpt
idR9fe5iTTb4z3LeMuoYweIPwQQ7rslYll3a5ybVeyZtsyD5qoA4j539pqipGrox
EqzAG/J8ii7sIG1GpVmrJwtojJfVmN0sAbKMn6VrXNnuQBMlbuhAl6i0vIzmm1bw
wRPJkUQCtHGtN2A7jlVJOAzIbVbCCEtOxhFFC+Di+z9y3522qKfysrcZ3WlPrLtE
0Tep68hrhNmH+vjmGHqXycGSyDjCaztb3+jR7wvtUQib2KWgTssF3hiAklsCAwEA
AaOB4zCB4DAdBgNVHQ4EFgQUgGVB2gg4MndTcwLrYuD61S6bKTAwgbAGA1UdIwSB
qDCBpYAUgGVB2gg4MndTcwLrYuD61S6bKTChgYmkgYYwgYMxCzAJBgNVBAYTAlBM
MTEwLwYDVQQKEyhVbml3ZXJzeXRldCBNaWtvbGFqYSBLb3Blcm5pa2EgdyBUb3J1
bml1MSEwHwYDVQQDExhDZW50cnVtIENlcnR5ZmlrYWNqaSBVTUsxHjAcBgkqhkiG
9w0BCQEWD2NhQHVuaS50b3J1bi5wbIIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3
DQEBBAUAA4IBAQCZaR6CcRdkbrajSXv/zTVP8cnspDKEwv2Cybz1eK7lWvyYILQQ
RJUvd3NRmtcUjmbE6sbuyPmh5nsHJqRfcEuMGWP6RkKDg3R5BsWgZIvKpxSJmy2I
hd5n9SL20L2XP3ipJscQ3N6/PmbSLM95qDce5YvfuLR2y1u9Vn/sUEfN0H5uhcKs
vfGtDMIytF38hUa+qmKoH6t8KVUBC0ZUWG8ozAiMyaRk8sfFyd7y6PjoO7G+CDLw
vO5MMYDEeCZIrgzgalfZs/UrAyLk6sM+WkDlo03NyhXekCAFZIWYO0NZ33TpKThx
6yygDhqpydaLN+AjdbXLgTfB62rzjI2ETmmp
-----END CERTIFICATE-----" > ${EDUROAM_CONF_PATH}/ca.cer

starting=`lprint "startuje siec na" "starting network on"`
stopping=`lprint "wylaczam siec na" "stopping network on"`
waiting=`lprint "czekam na polaczenie" "waiting for connection"`
connected=`lprint "polaczono z siecia" "connected to"`
restarting=`lprint "restartuje" "restarting"`
assinging_ip=`lprint "pobieram adres IP" "setting IP"`

echo "#!/bin/sh
WPA_SUPPLICANT=\"$WPA_SUPPLICANT\"" > ${EDUROAM_SBIN_PATH}/eduroam
if [ "$WPA_CLI" ] ; then
echo "WPA_CLI=\"$WPA_CLI\"" >> ${EDUROAM_SBIN_PATH}/eduroam
fi

echo "DRIVER=\"${driver}\"
WPA_CONF=\"${EDUROAM_CONF_PATH}/wpa_supplicant.conf\"
DHCPD=\"${dhclient}\"
INTERFACE=\"${iface}\"
case \"\$1\" in
	start)
            echo \"$starting \${INTERFACE}\"
    	    pkill wpa_supplicant
    	    kill \`ps -ef | awk '/dhclient/ && /${iface}/ && ! /awk/ {print
\$2}'\` 1>/dev/null 2>&1
    	    kill \`ps -ef | awk '/dhcpcd/ && /${iface}/ && ! /awk/ {print
\$2}'\` 1>/dev/null 2>&1
	    \${WPA_SUPPLICANT} -B -D \${DRIVER} -c \${WPA_CONF} -i \${INTERFACE}
-P /var/run/wpa_supplicant.pid 1>/dev/null 2>&1
    	    if [ \"\$WPA_CLI\" ] ; then
    		i=1
		echo \"$waiting\"
    		while ! \$WPA_CLI status | grep -q AUTHENTICATED ; do
            	    sleep 1
            	    i=\`expr \$i + 1\`
            	    if [ \$i -gt 40 ] ; then
                	echo \"$restarting wpa_supplicant\"
			echo \"$waiting\"
                	pkill wpa_supplicant
                	sleep 1
		        \${WPA_SUPPLICANT} -B -D \${DRIVER} -c \${WPA_CONF} -i
\${INTERFACE} -P /var/run/wpa_supplicant.pid 1>/dev/null 2>&1
                	i=1
                	sleep 1
            	    fi
                done
		echo \"$connected eduroam\"
    	    else
		sleep 10
    	    fi
    	    echo \"$assinging_ip\"
	    \${DHCPD} \${INTERFACE}
	;;
        stop)
            echo \"$stopping \${INTERFACE}\"
    	    pkill wpa_supplicant
    	    kill  \`ps -ef | awk '/dhclient/ && /${iface}/ && ! /awk/ {print
\$2}'\` 1>/dev/null 2>&1
    	    kill  \`ps -ef | awk '/dhcpcd/ && /${iface}/ && ! /awk/ {print
\$2}'\` 1>/dev/null 2>&1
	;;
        *)
	    echo \"$usage \$0 {start|stop}\"
	    exit 1
	;;
esac
"  >> ${EDUROAM_SBIN_PATH}/eduroam
chmod 755 ${EDUROAM_SBIN_PATH}/eduroam
if [ -n "$GKSU" ]; then
  msg=`lprint "wywolaj ${EDUROAM_SBIN_PATH}/eduroam start jako root"
"execute ${EDUROAM_SBIN_PATH}/eduroam start as root"`
echo "#!/bin/sh
xterm -geometry 80x5 -e '${EDUROAM_SBIN_PATH}/eduroam start; sleep 2'
" > ${EDUROAM_BIN_PATH}/xeduroam-start
echo "#!/bin/sh
xterm -geometry 80x5 -e '${EDUROAM_SBIN_PATH}/eduroam stop; sleep 2'
" > ${EDUROAM_BIN_PATH}/xeduroam-stop
chmod 755 ${EDUROAM_BIN_PATH}/xeduroam-*

echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  ${GKSU} xeduroam-start 1>/dev/null 2>&1
else
  echo $msg
fi
" > ${EDUROAM_BIN_PATH}/eduroam-start

  msg=`lprint "wywolaj ${EDUROAM_SBIN_PATH}/eduroam stop jako root"
"execute ${EDUROAM_SBIN_PATH}/eduroam stop as root"`

echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  ${GKSU} xeduroam-stop 1>/dev/null 2>&1
else
  echo $msg
fi
" > ${EDUROAM_BIN_PATH}/eduroam-stop
else
if [ -n "$SUDO" ]; then
echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  xterm -geometry 80x4 -e \"${SUDO} ${EDUROAM_SBIN_PATH}/eduroam start\"
else
  ${SUDO} ${EDUROAM_SBIN_PATH}/eduroam start
fi
" > ${EDUROAM_BIN_PATH}/eduroam-start

echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  xterm -geometry 80x4 -e \"${SUDO} ${EDUROAM_SBIN_PATH}/eduroam stop\"
else
  ${SUDO} ${EDUROAM_SBIN_PATH}/eduroam stop
fi
" > ${EDUROAM_BIN_PATH}/eduroam-stop
else
echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  xterm -geometry 80x4 -e \"su -c '${EDUROAM_SBIN_PATH}/eduroam start'\"
else
  su -c '${EDUROAM_SBIN_PATH}/eduroam start'
fi
" > ${EDUROAM_BIN_PATH}/eduroam-start

echo "#!/bin/sh
if [ -n \"\$DISPLAY\" ] ; then
  xterm -geometry 80x4 -e \"su -c '${EDUROAM_SBIN_PATH}/eduroam stop'\"
else
  su -c '${EDUROAM_SBIN_PATH}/eduroam stop'
fi
" > ${EDUROAM_BIN_PATH}/eduroam-stop
fi
fi

chmod 755 ${EDUROAM_BIN_PATH}/eduroam-*


if [ $tls -eq 1 ] ; then
  mv ${lid}.crt ${EDUROAM_CONF_PATH}
  mv ${lid}.key ${EDUROAM_CONF_PATH}
fi

echo ""
lprint "Konfiguracja zakonczona" "Configuration successful"
lprintn "Siec mozesz uruchomic poleceniem" "You can start the network by";
echo " ${bf}eduroam-start$n"
lprintn "Siec mozesz zatrzymac poleceniem" "You can stop the network by";
echo " ${bf}eduroam-stop$n"
echo ""

-- 
J�n B. Gu�dsson. RHCE,CCSA
Unix Kerfistj�
Kerfistj�
Reiknistofnun H���lands.
T�igar�Dunhaga 5.
107 Reykjav�
�land.
Rafp�r:        johannbg hi is
S�:             525-4267
Br�s�:        552-8801

Johann B. Gudmundsson. RHCE,CCSA
Unix System Engineer.
IT Management.
Reiknistofnun University of Iceland.
Taeknigardi, Dunhaga 5.
107 Reykjavik.
Iceland.
Email:              johannbg hi is
Phone:              +354-525-4267
Fax:                +354-552-8801




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]