Blame tests/p_freeradius/10_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
40b4c8
if [ "$CONTAINERTEST" -eq "1" ]; then
40b4c8
    t_Log "Running in container -> SKIP"
40b4c8
    exit 0
40b4c8
fi
40b4c8
f49232
if (t_GetPkgRel basesystem | grep -q el9)
f49232
then
f49232
  t_Log "This is a C9 system. Freeradius doesn't work. FIX LATER. Skipping."
f49232
  t_CheckExitStatus 0
f49232
  exit $PASS
f49232
fi
f49232
f49232
Christoph Galuschka d240c8
t_Log "Running $0 - freeradius-access test"
Christoph Galuschka d240c8
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
de85ad
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 ee772e
echo "User-Name=steve,User-Password=centos " | radclient -x localhost:1812 auth testing123 |grep -q '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 fd36d5
service radiusd stop
Christoph Galuschka d64c9b
Christoph Galuschka 104052
t_CheckExitStatus $ret_val