Radius Manager DMA Softlab Configuration File
Radius Manager DMA Softlab Configuration File
apt-get update
Apt-get update
rm /var/lib/apt/lists/* -vf
apt-get clean
apt-get autoremove
apt-get update
apt-get upgrade
wget http://ftp.gnu.org/gnu/wget/wget-1.16.tar.gz
cd wget-1.16/
./configure --with-ssl=openssl
wget -V
touch /rm-ubuntu-32bit.sh
chmod +x /rm-ubuntu-32bit.sh
nano /rm-ubuntu-32bit.sh
#!/bin/bash
# Version 1.2 / 19th November, 2014
# Talha Ali / [email protected]
# DMASOFTLAB Radius Manager 4.0.4 / 4.1.x Automated Installation Script for
Ubuntu 10/12 32bit Edition
# After UBUNTU / 32bit installation , First configure internet access.
# set -x
# Setting Variables . . . [TA]
clear
# MySQL ROOT Password , Change this variable according to your own setup if
required. . . [[ TA . . . ]]
sqlpass="talha1234"
# For RM & MYSQL . . . [[ TA . . . ]]
wwwpath="/var/www"
radhost="localhost"
raduser="radius"
myusr_rad="radius"
mypsw_radius="radius123"
myusr_cts="conntrack"
mypsw_cts="conn123"
httpuser="www-data"
rmver40="radiusmanager-4.0.4.tgz"
rmver41="radiusmanager-4.1.0.tgz"
osver=`cat /etc/issue |awk '{print $1}'`
# RM Installation Package Download URL , Change this variable according to
your own setup , if required. . . [[ TA . . . ]]
rmurl="https://sourceforge.net/projects/radiusmanager/files/"
# Colors Config . . . [[ TA . . . ]]
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
# OS checkup for UBUNTU
echo -e "$COL_GREEN Checking OS version, as it must be Ubuntu in order to
Continue . Talha Ali / [email protected]. .$COL_RESET"
if [[ $osver == Ubuntu ]]; then
echo
echo -e "$COL_GREEN Ubuntu is installed with following information fetched.
$COL_RESET"
lsb_release -a
sleep 3
else
echo -e "$COL_RED Sorry, it seems your Linux Distribution is not UBUNTU .
Exiting ...$COL_RESET"
exit 1
fi
# Make sure only root can run our script / Checking if user is root, otherwise
exit with error [[TA]]
echo
echo -e "$COL_GREEN Verifying if you are logged in with root priveleges . . .
$COL_RESET" 1>&2
FILE="/tmp/out.$$"
GREP="/bin/grep"
if [ "$(id -u)" != "0" ]; then
echo
echo -e "$COL_RED This script must be run as root, switch to root now . . .
$COL_RESET" 1>&2
exit 1
fi
echo -e "$COL_GREEN OK - You are logged in with root ID, Ok to proceed further
. . .!! $COL_RESET"
# Temporary Folder where all software will be downloaded . . . [[ TA . . . ]]
temp="temp"
# Checking if /temp folder is previously present or not . . .
{
if [ ! -d "/temp" ]; then
echo
echo -e "$COL_RED /temp folder not found, Creating it so all downloads will be
placed here . . . $COL_RESET"
mkdir /temp
else
echo
echo -e "$COL_GREEN /temp folder is already present , so no need to create it,
Proceeding further . . . $COL_RESET"
echo
fi
}
cd /$temp
# Clearing Old downloads in /temp to avoid DUPLICATIONS . . .
echo -e "$COL_RED Clearing Old downloads in /temp to avoid DUPLICATIONS . . .
$COL_RESET"
rm -fr /temp/radiusmanager*.*
rm -fr /temp/freeradius*.*
rm -fr /temp/libltd*.*
rm -fr /temp/ioncube*.*
sleep 5
# Checking IF $rmurl is accessible m if YES then continue further , otherwise
EXIT the script with ERROR ! [[ TA .. . .]]
echo
echo -e "$COL_GREEN Checking if $rmurl is accessible in order to proceed
further. . .!! $COL_RESET"
cd /temp
wget -q $rmurl/rm4.txt
{
if [ ! -f /temp/rm4.txt ]; then
echo
echo -e "$COL_RED ERROR: Unable to contact $rmurl, or possibly internet is not
working or your IP is in black list at destination server !! $COL_RESET"
echo -e "$COL_RED ERROR: Please check manual if $rmurl is accessible or not or
if it have required files, TA !! $COL_RESET"
exit 0
fi
}
rm -fr /temp/rm4.txt
sleep 6
######################
clear
# Selection choice menu of RM version 4.0 or 4.1
echo -e "$COL_GREEN ########################################### $COL_RESET"
echo -e "$COL_GREEN Select the type of your operating system: $COLRESET"
echo -e "$COL_GREEN Talha Ali / [email protected] $COLRESET"
echo -e "$COL_GREEN ########################################### $COL_RESET"
echo
echo "1. Radius Manager 4.0.4"
echo "2. Radius Manager 4.1.0"
echo
echo -n "Choose an option: [1] "
read rmver
if [ -z "$rmver" ]; then
rmver="1"
fi
case $rmver in
1 ) echo "Selected RM version is: 4.0.4 [Old]"
# Download radius manager 4.0.4 in $temp folder
echo .
echo -e "$COL_GREEN Downloading RADIUS MANAGER 4.0.4 package from INTERNET .
Sleeping for 5 Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
defver="radiusmanager-4.0.4.tgz"
defverdir="radiusmanager-4.0.4"
sleep 5
wget $rmurl/$defver
;;
2 ) echo "Selected RM version is: 4.1.0 [Latest]"
echo -e "$COL_GREEN Downloading RADIUS MANAGER 4.1.0 package from INTERNET .
Sleeping for 5 Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
defver="radiusmanager-4.1.0.tgz"
defverdir="radiusmanager-4.1.0"
echo .
sleep 5
# Download radius manager 4.1.0 in $temp folder
wget $rmurl/$defver
;;
* ) echo "Invalid selection. Installation aborted."
echo
exit
;;
esac
# Checking IF RM installation file have been downloaded. if YEs continue
further , otherwise EXIT the script with ERRO ! [[ TA .. . .]]
{
if [ ! -f /$temp/$defver ]; then
echo .
echo -e "$COL_RED ERROR: RM Installation File could not be download or found
in /$temp/$defver ! $COL_RESET"
exit 0
fi
}
# Function to check RM Installation Package SIZE , if its Ok or corrupted (TA)
I will update it later
#SIZE=$(du -sb file.txt | awk '{ print $1 }')
#if ((SIZE<900)); then
# echo "RM File Size not Ok, possibly corrupted";
#else
# echo "RM FILE SIZE OK !";
#exit 0
#fi
# Update UBUNTU FIRST . . . [[ TA . . . ]]
echo
echo
echo -e "$COL_GREEN Updating UBUNTU . Sleeping for 5 Seconds . . (Press
CTRL+C to stop any time) $COL_RESET"
sleep 5
apt-get update
# Installing required components for RM . . . [[ TA . . . ]]
echo .
echo -e "$COL_GREEN Installing components like MYSQL , PHP etc . Sleeping
for 5 Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
sleep 5
apt-get -y install mc wget rcconf make gcc mysql-server mysql-client
libmysqlclient15-dev libperl-dev curl php5 php5-mysql php5-cli php5-curl php5-
mcrypt php5-gd php5-snmp apache2
# While installing above components , it may ask for mysql password, use same
password as you have used before . . . [[ TA . . . ]]
echo .
echo -e "$COL_GREEN Installing LIB packages . Sleeping for 5 Seconds . .
(Press CTRL+C to stop any time) $COL_RESET"
sleep 5
cd /$temp
wget https://sourceforge.net/projects/radiusmanager/files/libltdl3_1.5.24-
1ubuntu1_i386.deb
wget https://sourceforge.net/projects/radiusmanager/files/libltdl3-dev_1.5.24-
1ubuntu1_i386.deb/
dpkg -i libltdl3_1.5.24-1ubuntu1_i386.deb
dpkg -i libltdl3-dev_1.5.24-1ubuntu1_i386.deb
# IONCUBE Installation:
# Now Download ioncube library and add it to php . . . [[ TA . . . ]]
echo .
echo -e "$COL_GREEN Installing IONCUBE . Sleeping for 5 Seconds . . (Press
CTRL+C to stop any time) $COL_RESET"
sleep 5
wget
https://sourceforge.net/projects/radiusmanager/files/ioncube_loaders_lin_x86.t
ar.gz
# Checking if IONCUBE installation file have been downloaded. if YEs continue
further , otherwise EXIT the script with ERROR ! [[ TA .. . .]]
{
if [ ! -f /$temp/ioncube_loaders_lin_x86.tar.gz ]; then
echo .
echo -e "$COL_RED ERROR: COULD NOT DOWNLOAD IONCUBE !!! EXITING . . .
$COL_RESET"
exit 0
fi
}
tar zxvf ioncube_loaders_lin_x86.tar.gz
mkdir /usr/local/ioncube
cd /$temp/ioncube
cp -fr * /usr/local/ioncube/
# Now Add the appropriate ionCube loader to your php.ini . . . [TA]
echo .
echo -e "$COL_GREEN Adding iONCUBE in PHP . Sleeping for 5 Seconds . .
(Press CTRL+C to stop any time) $COL_RESET"
sleep 5
echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.3.so" >>
/etc/php5/apache2/php.ini
echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.3.so" >>
/etc/php5/cli/php.ini
cd /$temp
echo .
echo -e "$COL_GREEN Downloading FREERADiUS 2.2.20-dma-patch-2 package .
Sleeping for 5 Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
sleep 5
wget https://sourceforge.net/projects/radiusmanager/files/freeradius-server-
2.2.0-dma-patch-2.tar.gz
# Checking if FREERADIUS is downloaded, just to make sure internet is
working ,IF NOT, EXIT the script with ERROR ! [[ TA .. . .]]
{
if [ ! -f /$temp/freeradius-server-2.2.0-dma-patch-2.tar.gz ]; then
echo .
echo -e "$COL_RED ERROR: COULD NOT DOWNLOAD FREERADIUS 2.2.20-dma-patch-2,
possible INTERNET is not Working !!! EXITING . . . $COL_RESET"
exit 0
fi
}
echo .
echo -e "$COL_GREEN Compiling FREERADIUS . Sleeping for 5 Seconds . . (Press
CTRL+C to stop any time) $COL_RESET"
sleep 5
tar zxvf freeradius-server-2.2.0-dma-patch-2.tar.gz
cd freeradius-server-2.2.0/
### Now proceed with the compilation of FREERAIDUS , applicable for all
./configure
make
make install
ldconfig
# Set the correct ownership on FreeRadius configuration files
chown $httpuser /usr/local/etc/raddb
chown $httpuser /usr/local/etc/raddb/clients.conf
# ================================================================
# Creating MySQL databases with MySQL command line tool . . . [TA]
# ================================================================
# ** FROM CLI ** . . . [TA]
echo .
echo -e "$COL_GREEN adding RADIUS user & DB in MYSQL . Sleeping for 5
Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
sleep 1
mysql -u root -p$sqlpass -e "create database radius";
mysql -u root -p$sqlpass -e "create database conntrack";
mysql -u root -p$sqlpass -e "CREATE USER '$myusr_rad'@'$radhost' IDENTIFIED BY
'$mypsw_radius';"
mysql -u root -p$sqlpass -e "CREATE USER '$myusr_cts'@'$radhost' IDENTIFIED BY
'$mypsw_cts';"
mysql -u root -p$sqlpass -e "GRANT ALL ON radius.* TO radius@$radhost;"
mysql -u root -p$sqlpass -e "GRANT ALL ON conntrack.* TO conntrack@$radhost;"
# Time to Install RADIUS MANAGER 4.x.x . . . [TA]
# ===============================================
cd /$temp
tar zxvf $defver
cd /$temp/$defverdir
echo .
echo -e "$COL_GREEN Starting RADIUS MANAGER install script install.sh .
Sleeping for 5 Seconds . . (Press CTRL+C to stop any time) $COL_RESET"
sleep 5
echo "Radius Manager installer $defver for Ubuntu ONLY ****" [ TA ]
echo "Copyright 2004-2012, DMA Softlab LLC"
echo "All right reserved."
echo
echo .
echo -e "$COL_GREEN (Use CTRL+C to abort any time) . Sleeping for 5 Seconds .
. (Press CTRL+C to stop any time) $COL_RESET"
sleep 5
# copy web content
echo Copying Radius Manager WEB content to $wwwpath/radiusmanager
cp -fr www/radiusmanager $wwwpath
# rename .dist files
# Talha / copy paypal cfg file so that user.php may not be missed
mv $wwwpath/radiusmanager/config/payfast_cfg.php.dist
$wwwpath/radiusmanager/config/payfast_cfg.php
mv $wwwpath/radiusmanager/config/paypal_cfg.php.dist
$wwwpath/radiusmanager/config/paypal_cfg.php
mv $wwwpath/radiusmanager/config/netcash_cfg.php.dist
$wwwpath/radiusmanager/config/netcash_cfg.php
mv $wwwpath/radiusmanager/config/authorizenet_cfg.php.dist
$wwwpath/radiusmanager/config/authorizenet_cfg.php
mv $wwwpath/radiusmanager/config/dps_cfg.php.dist
$wwwpath/radiusmanager/config/dps_cfg.php
mv $wwwpath/radiusmanager/config/2co_cfg.php.dist
$wwwpath/radiusmanager/config/2co_cfg.php
# set ownership and permissions
chown $httpuser $wwwpath/radiusmanager/config
chown $httpuser $wwwpath/radiusmanager/config/system_cfg.php
chown $httpuser $wwwpath/radiusmanager/config/paypal_cfg.php
chown $httpuser $wwwpath/radiusmanager/config/netcash_cfg.php
chown $httpuser $wwwpath/radiusmanager/config/authorizenet_cfg.php
chown $httpuser $wwwpath/radiusmanager/config/dps_cfg.php
chown $httpuser $wwwpath/radiusmanager/config/2co_cfg.php
#chown $httpuser $wwwpath/radiusmanager/tmpimages
chown $httpuser $wwwpath/radiusmanager/tftpboot
chmod 600 $wwwpath/radiusmanager/config/system_cfg.php
chmod 600 $wwwpath/radiusmanager/config/paypal_cfg.php
chmod 600 $wwwpath/radiusmanager/config/netcash_cfg.php
chmod 600 $wwwpath/radiusmanager/config/authorizenet_cfg.php
chmod 600 $wwwpath/radiusmanager/config/dps_cfg.php
chmod 600 $wwwpath/radiusmanager/config/2co_cfg.php
chmod 644 $wwwpath/radiusmanager/config/docsis_keyfile
chmod 644 $wwwpath/radiusmanager/config/docsis_template
# Adding tmpimage folder for CAPTCHA images (Talha)
mkdir /var/www/radiusmanager/tmpimages
chown $httpuser $wwwpath/radiusmanager/tmpimages
# chmod and copy binaries
echo "Copying binaries to /usr/local/bin"
chmod 755 bin/rm*
cp -fr bin/rm* /usr/local/bin
echo "Copying rootexec to /usr/local/sbin"
cp -fr bin/rootexec /usr/local/sbin
chmod 4755 /usr/local/sbin/rootexec
# chmod and copy radiusmanager.cfg
echo "Copying radiusmanager.cfg to /etc"
cp -fr etc/radiusmanager.cfg /etc
chown root /etc/radiusmanager.cfg
chmod 600 /etc/radiusmanager.cfg
# create or upgrade tables
echo "Creating MySQL tables"
mysql -h $radhost -u $myusr_rad -p$mypsw_radius radius < sql/radius.sql
mysql -h $radhost -u $myusr_cts -p$mypsw_cts conntrack < sql/conntrack.sql
# create rmpoller service
echo "Enabling rmpoller service at boot time"
cp -fr rc.d/rmpoller /etc/init.d
chown root.root /etc/init.d/rmpoller
chmod 755 /etc/init.d/rmpoller
update-rc.d rmpoller defaults 99
# create rmconntrack service
echo "Enabling rmconntrack service at boot time"
cp -fr rc.d/rmconntrack /etc/init.d
chown root.root /etc/init.d/rmconntrack
chmod 755 /etc/init.d/rmconntrack
update-rc.d rmconntrack defaults 99
# copy radiusd init script
echo "Enabling radiusd service at boot time"
chmod 755 rc.d/debian/radiusd
cp -fr rc.d/debian/radiusd /etc/init.d
update-rc.d radiusd defaults 99
# copy logrotate script
echo "Copying logrotate script"
cp -fr etc/logrotate.d/radiusd /etc/logrotate.d/radiusd
# copy cron job script
echo "Copying cronjob script"
cp -fr etc/cron/radiusmanager /etc/cron.d/radiusmanager
chmod 644 /etc/cron.d/radiusmanager
# comment out the old style cron job
sed -i 's/02\ 0\ \*\ \*\ \*\ root\ \/usr\/bin\/php/#2\ 0\ \*\ \*\ \*\
root\ \/usr\/bin\/php/g' /etc/crontab
# replace strings in cfg files for Debian
echo .
echo -e "$COL_GREEN Setting Debina base WWW dir in configuration files . . .!
$COL_RESET"
sed -i 's/var\/lib\/mysql\/mysql.sock/var\/run\/mysqld\/mysqld.sock/g'
/etc/radiusmanager.cfg
sed -i 's/var\/www\/html/var\/www/g' /etc/radiusmanager.cfg
sed -i 's/var\/www\/html/var\/www/g' /etc/cron.d/radiusmanager
sed -i 's/var\/www\/html/var\/www/g'
/var/www/radiusmanager/config/system_cfg.php
# set permission on raddb files
echo "Setting permission on raddb files"
chown $httpuser /usr/local/etc/raddb
chown $httpuser /usr/local/etc/raddb/clients.conf
echo
echo .
echo -e "$COL_GREEN Radius manager Installation complete!$COL_RESET"
echo
# Now copy the two license files (that you receive from DMASOFTLAB) in
/var/www/radiusmanager . . . [TA]
# cp -fr lic.txt /var/www/radiusmanager/
# cp -fr mod.txt /var/www/radiusmanager/
echo .
echo .
echo -e "$COL_GREEN Re-Starting Apache2, Radius and mySQL Service$COL_RESET"
echo .
service radiusd start
service apache2 restart
service mysql restart
echo .
echo .
echo .
echo .
echo .
echo -e "$COL_GREEN All Done. Please access ADMIN panel via
http://yourip/radiusmanager/admin.php $COL_RESET"
echo -e "$COL_GREEN RM Installation script by Talha Ali /
[email protected] /Special Thanks to Syed Jahanzaib $COL_RESET"
/rm-ubuntu-32bit.sh
Now upload license (two file license.txt and mod.txt) by winscp or filezilla