Blame tests/p_freeradius/radiusd_test.sh

Christoph Galuschka d240c8
#!/bin/sh
Christoph Galuschka dae1aa
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Athmane Madjoudj 6284d9
#         Athmane Madjodj <athmanem@gmail.com>
Christoph Galuschka d240c8
Christoph Galuschka d240c8
t_Log "Running $0 - freeradius-access test"
Christoph Galuschka d240c8
Athmane Madjoudj 6284d9
if (t_GetPkgRel basesystem | grep -q el6)
Christoph Galuschka 104052
  then
Christoph Galuschka 104052
  t_InstallPackage freeradius-utils
Christoph Galuschka 104052
else 
Christoph Galuschka 104052
  t_InstallPackage freeradius2-utils
Christoph Galuschka 104052
fi
Christoph Galuschka 104052
Athmane Madjoudj 6284d9
  # Make Backup of /etc/raddb/users and add testuser steve
Athmane Madjoudj 6284d9
  /bin/cp /etc/raddb/users /etc/raddb/users.orig
Athmane Madjoudj 6284d9
  echo 'steve  Cleartext-Password := "centos"' >> /etc/raddb/users
Athmane Madjoudj 6284d9
  echo '       Service-Type = Framed-User,' >> /etc/raddb/users
Christoph Galuschka d240c8
Athmane Madjoudj 6284d9
  # Restart Service
Athmane Madjoudj 6284d9
  service radiusd restart
Christoph Galuschka d240c8
Christoph Galuschka 104052
  #Run test, treat C6 and C5 differently
Christoph Galuschka 104052
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el6)
Christoph Galuschka 104052
  then
Christoph Galuschka 104052
  t_Log "Running C6-Test"
Athmane Madjoudj 6284d9
  WORKING=$(radtest -d /etc/raddb -x steve centos 127.0.0.1:1812 1 testing123 |grep -c 'Access-Accept')
Athmane Madjoudj 6284d9
  if [ $WORKING == 1 ]; then ret_val=0 ; fi
Christoph Galuschka 104052
else
Christoph Galuschka 104052
  t_Log "Running C5-Test"
Christoph Galuschka 104052
  WORKING=$(radtest steve centos 127.0.0.1:1812 1 testing123 |grep -c 'Access-Accept')
Christoph Galuschka 104052
  if [ $WORKING == 1 ]; then ret_val=0 ; fi
Christoph Galuschka 104052
fi
Athmane Madjoudj 6284d9
  # Restore settings
Athmane Madjoudj 6284d9
  /bin/cp /etc/raddb/users.orig /etc/raddb/users
Christoph Galuschka 104052
  rm -rf /etc/raddb/users.orig
Christoph Galuschka 104052
  service radiusd restart
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el5)
Christoph Galuschka 104052
  then
Christoph Galuschka 104052
  sed -i 's/#\ INCLUDE\ eap\.conf/\ \ INCLUDE eap.conf/g' /etc/raddb/radiusd.conf
Christoph Galuschka 104052
  ln -s /etc/raddb/sites-available/control-socket /etc/raddb/sites-enabled/
Christoph Galuschka 104052
  ln -s /etc/raddb/sites-available/inner-tunnel /etc/raddb/sites-enabled/
Christoph Galuschka 104052
  /bin/cp -a /etc/raddb/sites-available/default.orig /etc/raddb/sites-available/default
Christoph Galuschka 104052
  rm -rf /etc/raddb/sites-available/default.orig
Christoph Galuschka 104052
  service radiusd stop
Athmane Madjoudj 6284d9
fi
Christoph Galuschka 104052
Christoph Galuschka 104052
t_CheckExitStatus $ret_val