bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_freeradius/00-install_freeradius.sh

Christoph Galuschka d240c8
#!/bin/bash
Christoph Galuschka fd36d5
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# Install freeradius
f36f34
# C6 comes with freeradius2
Christoph Galuschka fd36d5
# C7 comes with freeradius3
Christoph Galuschka d64c9b
Karanbir Singh 106bcf
t_Log "Running $0 - installation and startup of freeradius."
Karanbir Singh 106bcf
f36f34
#if [ $centos_ver -gt 5 ]
f36f34
#then
f36f34
#Install Freeradius (V2/V3)
f36f34
t_InstallPackage freeradius freeradius-utils
f36f34
#else
f36f34
#  #Install Freeradius2
f36f34
#  t_InstallPackage freeradius2 freeradius2-utils
f36f34
#fi
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# start daemon with default settings
Christoph Galuschka fd36d5
if [ $centos_ver -gt 5 ]
Christoph Galuschka 104052
then
Christoph Galuschka 104052
  t_ServiceControl radiusd start
Christoph Galuschka 104052
else
Christoph Galuschka 33951f
  # C5 has an eap-setting in radiusd.conf and 3 "sites-enabled" which prevent successfull start (probably missing some dep)
Christoph Galuschka 33951f
  # as the basic test works without these, the eap settings and 2 sites-enabled will be removed for the test and later restored
Christoph Galuschka d64c9b
  # Check if we allready did this
Christoph Galuschka d64c9b
  if [ ! -e /etc/raddb/radiusd.conf.orig ]
Christoph Galuschka d64c9b
    then
Christoph Galuschka d64c9b
    # File not yet copied
Christoph Galuschka d64c9b
    /bin/cp -a /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.orig
Christoph Galuschka d64c9b
    grep -iv eap /etc/raddb/radiusd.conf.orig > /etc/raddb/radiusd.conf
Christoph Galuschka d64c9b
  fi
Christoph Galuschka 104052
  rm -rf /etc/raddb/sites-enabled/control-socket
Christoph Galuschka 104052
  rm -rf /etc/raddb/sites-enabled/inner-tunnel
Christoph Galuschka d64c9b
  # /etc/raddb/sites-configured will be changed to include only basic files-authentication
Christoph Galuschka d64c9b
  # Check if we allready did this
Christoph Galuschka d64c9b
  if [ ! -e /etc/raddb/sites-available/default.orig ]
Christoph Galuschka d64c9b
    then
Christoph Galuschka d64c9b
    # File not yet copied
Christoph Galuschka d64c9b
    /bin/cp -a /etc/raddb/sites-available/default /etc/raddb/sites-available/default.orig
Christoph Galuschka d64c9b
  fi
Christoph Galuschka d64c9b
cat > /etc/raddb/sites-available/default <
Christoph Galuschka d64c9b
authorize {
Christoph Galuschka d64c9b
        files
Christoph Galuschka d64c9b
}
Christoph Galuschka d64c9b
authenticate {
Christoph Galuschka d64c9b
}
Christoph Galuschka d64c9b
EOF
Christoph Galuschka 104052
fi
Christoph Galuschka d240c8