bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

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
Christoph Galuschka d64c9b
# Make Backup of /etc/raddb/users and add testuser steve
Christoph Galuschka d64c9b
/bin/cp /etc/raddb/users /etc/raddb/users.orig
Christoph Galuschka d64c9b
echo 'steve  Cleartext-Password := "centos"' >> /etc/raddb/users
Christoph Galuschka d64c9b
echo '       Service-Type = Framed-User,' >> /etc/raddb/users
Christoph Galuschka d240c8
Christoph Galuschka d64c9b
# Restart Service
Christoph Galuschka d64c9b
service radiusd restart
Christoph Galuschka d240c8
Christoph Galuschka d64c9b
#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
Christoph Galuschka d64c9b
Christoph Galuschka d64c9b
# Restore settings
Christoph Galuschka d64c9b
/bin/cp /etc/raddb/users.orig /etc/raddb/users
Christoph Galuschka d64c9b
rm -rf /etc/raddb/users.orig
Christoph Galuschka d64c9b
service radiusd restart
Christoph Galuschka d64c9b
Christoph Galuschka d64c9b
#if (t_GetPkgRel basesystem | grep -q el5)
Christoph Galuschka d64c9b
#  then
Christoph Galuschka d64c9b
#
Christoph Galuschka d64c9b
#  sed -i 's/#\ INCLUDE\ eap\.conf/\ \ INCLUDE eap.conf/g' /etc/raddb/radiusd.conf
Christoph Galuschka d64c9b
#  ln -s /etc/raddb/sites-available/control-socket /etc/raddb/sites-enabled/
Christoph Galuschka d64c9b
#  ln -s /etc/raddb/sites-available/inner-tunnel /etc/raddb/sites-enabled/
Christoph Galuschka d64c9b
#  /bin/cp -a /etc/raddb/sites-available/default.orig /etc/raddb/sites-available/default
Christoph Galuschka d64c9b
#  rm -rf /etc/raddb/sites-available/default.orig
Christoph Galuschka d64c9b
#  service radiusd stop
Christoph Galuschka d64c9b
#fi
Christoph Galuschka 104052
Christoph Galuschka 104052
t_CheckExitStatus $ret_val