From fd36d5d261b2211f0da5ec6e10b70e59ae02db07 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Dec 29 2013 13:11:54 +0000 Subject: changed freeradius test to also run on EL7 --- diff --git a/tests/p_freeradius/0-install_freeradius.sh b/tests/p_freeradius/0-install_freeradius.sh deleted file mode 100755 index b8ff190..0000000 --- a/tests/p_freeradius/0-install_freeradius.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Author: Christoph Galuschka - -# Install freeradius -# On C5 both freeradius and freeradius2 are provided, however only freeradius2-utils are provided as well -# so we will install freeradius2 on C5 and freeradius (being freeradius2) on C6 - -t_Log "Running $0 - installation and startup of freeradius." - -if (t_GetPkgRel basesystem | grep -q el6) -then - #Install Freeradius (V2) - t_InstallPackage freeradius freeradius-utils -else - #Install Freeradius2 - t_InstallPackage freeradius2 freeradius2-utils -fi - -# start daemon with default settings -if (t_GetPkgRel basesystem | grep -q el6) -then - t_ServiceControl radiusd start -else - # C5 has an eap-setting in radiusd.conf and 3 "sites-enabled" which prevent successfull start (probably missing some dep) - # as the basic test works without these, the eap settings and 2 sites-enabled will be removed for the test and later restored - # Check if we allready did this - if [ ! -e /etc/raddb/radiusd.conf.orig ] - then - # File not yet copied - /bin/cp -a /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.orig - grep -iv eap /etc/raddb/radiusd.conf.orig > /etc/raddb/radiusd.conf - fi - rm -rf /etc/raddb/sites-enabled/control-socket - rm -rf /etc/raddb/sites-enabled/inner-tunnel - # /etc/raddb/sites-configured will be changed to include only basic files-authentication - # Check if we allready did this - if [ ! -e /etc/raddb/sites-available/default.orig ] - then - # File not yet copied - /bin/cp -a /etc/raddb/sites-available/default /etc/raddb/sites-available/default.orig - fi -cat > /etc/raddb/sites-available/default < + +# Install freeradius +# On C5 both freeradius and freeradius2 are provided, however only freeradius2-utils are provided as well +# so we will install freeradius2 on C5 and freeradius on C6/7 +# C7 comes with freeradius3 + +t_Log "Running $0 - installation and startup of freeradius." + +if [ $centos_ver -gt 5 ] +then + #Install Freeradius (V2/V3) + t_InstallPackage freeradius freeradius-utils +else + #Install Freeradius2 + t_InstallPackage freeradius2 freeradius2-utils +fi + +# start daemon with default settings +if [ $centos_ver -gt 5 ] +then + t_ServiceControl radiusd start +else + # C5 has an eap-setting in radiusd.conf and 3 "sites-enabled" which prevent successfull start (probably missing some dep) + # as the basic test works without these, the eap settings and 2 sites-enabled will be removed for the test and later restored + # Check if we allready did this + if [ ! -e /etc/raddb/radiusd.conf.orig ] + then + # File not yet copied + /bin/cp -a /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.orig + grep -iv eap /etc/raddb/radiusd.conf.orig > /etc/raddb/radiusd.conf + fi + rm -rf /etc/raddb/sites-enabled/control-socket + rm -rf /etc/raddb/sites-enabled/inner-tunnel + # /etc/raddb/sites-configured will be changed to include only basic files-authentication + # Check if we allready did this + if [ ! -e /etc/raddb/sites-available/default.orig ] + then + # File not yet copied + /bin/cp -a /etc/raddb/sites-available/default /etc/raddb/sites-available/default.orig + fi +cat > /etc/raddb/sites-available/default < +# Athmane Madjodj + +t_Log "Running $0 - freeradius-access test" + +# Make Backup of /etc/raddb/users and add testuser steve +/bin/cp /etc/raddb/users /etc/raddb/users.orig +echo 'steve Cleartext-Password := "centos"' >> /etc/raddb/users +echo ' Service-Type = Framed-User,' >> /etc/raddb/users + +# Restart Service +service radiusd restart + +#Run test + +t_Log "Running Test" +echo "User-Name=steve,Password=centos " | radclient -x localhost:1812 auth testing123 |grep -q 'Access-Accept' +ret_val=$? + +# Restore settings +/bin/cp /etc/raddb/users.orig /etc/raddb/users +rm -rf /etc/raddb/users.orig +service radiusd stop + +t_CheckExitStatus $ret_val diff --git a/tests/p_freeradius/radiusd_test.sh b/tests/p_freeradius/radiusd_test.sh deleted file mode 100755 index f049616..0000000 --- a/tests/p_freeradius/radiusd_test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# Author: Christoph Galuschka -# Athmane Madjodj - -t_Log "Running $0 - freeradius-access test" - -# Make Backup of /etc/raddb/users and add testuser steve -/bin/cp /etc/raddb/users /etc/raddb/users.orig -echo 'steve Cleartext-Password := "centos"' >> /etc/raddb/users -echo ' Service-Type = Framed-User,' >> /etc/raddb/users - -# Restart Service -service radiusd restart - -#Run test - -t_Log "Running Test" -echo "User-Name=steve,Password=centos " | radclient -x localhost:1812 auth testing123 |grep -q 'Access-Accept' -ret_val=$? - -# Restore settings -/bin/cp /etc/raddb/users.orig /etc/raddb/users -rm -rf /etc/raddb/users.orig -service radiusd restart - -t_CheckExitStatus $ret_val