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 967eb8
#Run test
Christoph Galuschka 104052
Christoph Galuschka 8f5133
t_Log "Running Test"
Christoph Galuschka 8f5133
echo "User-Name=steve,Password=centos " | radclient -x localhost:1812 auth testing123 |grep -qc 'Access-Accept'
Christoph Galuschka 8f5133
ret_val=$?
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 104052
t_CheckExitStatus $ret_val