bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_freeradius/0-install_freeradius.sh

Christoph Galuschka d240c8
#!/bin/bash
Christoph Galuschka dae1aa
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# Install freeradius
Christoph Galuschka 104052
# On C5 both freeradius and freeradius2 are provided, however only freeradius2-utils are provided as well
Christoph Galuschka 104052
# so we will install freeradius2 on C5 and freeradius (being freeradius2) on C6
Christoph Galuschka d64c9b
Karanbir Singh 106bcf
t_Log "Running $0 - installation and startup of freeradius."
Karanbir Singh 106bcf
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el6)
Christoph Galuschka 104052
then
Christoph Galuschka 104052
  #Install Freeradius (V2)
Christoph Galuschka 3dd734
  t_InstallPackage freeradius freeradius-utils
Christoph Galuschka 104052
else
Christoph Galuschka 104052
  #Install Freeradius2
Christoph Galuschka 3dd734
  t_InstallPackage freeradius2 freeradius2-utils
Christoph Galuschka 104052
fi
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# start daemon with default settings
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el6)
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