Subversion Repositories ALCASAR

Rev

Rev 3123 | Rev 3169 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3123 Rev 3135
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 3123 2023-04-04 22:25:41Z rexy $
2
#  $Id: alcasar.sh 3135 2023-05-13 15:21:46Z rexy $
3
 
3
 
4
# ALCASAR is a Free and open source NAC (Network Access Controler) created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
4
# ALCASAR is a Free and open source NAC (Network Access Controler) created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
5
# ALCASAR is based on a stripped Mageia (LSB) with the following open source softwares Coovachilli, freeradius, mariaDB, lighttpd, php, netfilter, e2guardian, ntpd, openssl, unbound, gammu, clamav, Ulog, fail2ban, vnstat, wkhtml2pdf, ipt_NETFLOW, NFsen and NFdump
5
# ALCASAR is based on a stripped Mageia (LSB) with the following open source softwares Coovachilli, freeradius, mariaDB, lighttpd, php, netfilter, e2guardian, ntpd, openssl, unbound, gammu, clamav, Ulog, fail2ban, vnstat, wkhtml2pdf, ipt_NETFLOW, NFsen and NFdump
6
# contact : info@alcasar.net
6
# contact : info@alcasar.net
7
 
7
 
Line 458... Line 458...
458
	echo "# Shared secret between the script 'intercept.php' and coova-chilli:" >> $PASSWD_FILE
458
	echo "# Shared secret between the script 'intercept.php' and coova-chilli:" >> $PASSWD_FILE
459
	echo "secret_uam=$secretuam" >> $PASSWD_FILE
459
	echo "secret_uam=$secretuam" >> $PASSWD_FILE
460
	secretradius=`cat /dev/urandom | tr -dc '[:alnum:]' | head -c16`
460
	secretradius=`cat /dev/urandom | tr -dc '[:alnum:]' | head -c16`
461
	echo "# Shared secret between coova-chilli and FreeRadius:" >> $PASSWD_FILE
461
	echo "# Shared secret between coova-chilli and FreeRadius:" >> $PASSWD_FILE
462
	echo "secret_radius=$secretradius" >> $PASSWD_FILE
462
	echo "secret_radius=$secretradius" >> $PASSWD_FILE
-
 
463
	csrfkey=`cat /dev/urandom | tr -dc '[:alnum:]' | head -c16`
-
 
464
	echo "# Key used to create CSRF-tokens in several ACC forms" >> $PASSWD_FILE
-
 
465
	echo "csrf_key=$csrfkey" >> $PASSWD_FILE
463
	chmod 640 $PASSWD_FILE
466
	chmod 640 $PASSWD_FILE
464
#  copy scripts in in /usr/local/bin
467
#  copy scripts in in /usr/local/bin
465
	cp -fr $DIR_SCRIPTS/alcasar* $DIR_DEST_BIN/. ; chown -R root:root $DIR_DEST_BIN/alcasar* ; chmod -R 740 $DIR_DEST_BIN/alcasar*
468
	cp -fr $DIR_SCRIPTS/alcasar* $DIR_DEST_BIN/. ; chown -R root:root $DIR_DEST_BIN/alcasar* ; chmod -R 740 $DIR_DEST_BIN/alcasar*
466
#  copy conf files in /usr/local/etc
469
#  copy conf files in /usr/local/etc
467
	cp -f $DIR_CONF/etc/alcasar* $DIR_DEST_ETC/. ; chown -R root:apache $DIR_DEST_ETC ; chmod 770 $DIR_DEST_ETC ; chmod 660 $DIR_DEST_ETC/alcasar*
470
	cp -f $DIR_CONF/etc/alcasar* $DIR_DEST_ETC/. ; chown -R root:apache $DIR_DEST_ETC ; chmod 770 $DIR_DEST_ETC ; chmod 660 $DIR_DEST_ETC/alcasar*
Line 794... Line 797...
794
	cp -rf $DIR_INSTALL/web/* $DIR_WEB/
797
	cp -rf $DIR_INSTALL/web/* $DIR_WEB/
795
	$SED "s?99/99/9999?$DATE_SHORT?g" $DIR_ACC/menu.php
798
	$SED "s?99/99/9999?$DATE_SHORT?g" $DIR_ACC/menu.php
796
	$SED "s?\$DB_RADIUS = .*?\$DB_RADIUS = \"$DB_RADIUS\"\;?g" $DIR_ACC/welcome.php
799
	$SED "s?\$DB_RADIUS = .*?\$DB_RADIUS = \"$DB_RADIUS\"\;?g" $DIR_ACC/welcome.php
797
	$SED "s?\$DB_USER = .*?\$DB_USER = \"$DB_USER\"\;?g" $DIR_ACC/welcome.php
800
	$SED "s?\$DB_USER = .*?\$DB_USER = \"$DB_USER\"\;?g" $DIR_ACC/welcome.php
798
	$SED "s?\$radiuspwd = .*?\$radiuspwd = \"$radiuspwd\"\;?g" $DIR_ACC/welcome.php
801
	$SED "s?\$radiuspwd = .*?\$radiuspwd = \"$radiuspwd\"\;?g" $DIR_ACC/welcome.php
-
 
802
	$SED "s?^\$csrf_key = .*?\$csrf_key = \"$csrfkey\"\;?g" $DIR_ACC/manager/htdocs/activity.php
799
	chown -R apache:apache $DIR_WEB/*
803
	chown -R apache:apache $DIR_WEB/*
800
# copy & adapt "freeradius-web" files
804
# copy & adapt "freeradius-web" files
801
	cp -rf $DIR_CONF/freeradius-web/ /etc/
805
	cp -rf $DIR_CONF/freeradius-web/ /etc/
802
	[ -e /etc/freeradius-web/admin.conf.default ] || cp /etc/freeradius-web/admin.conf /etc/freeradius-web/admin.conf.default
806
	[ -e /etc/freeradius-web/admin.conf.default ] || cp /etc/freeradius-web/admin.conf /etc/freeradius-web/admin.conf.default
803
	$SED "s?^general_domain:.*?general_domain: $DOMAIN?g" /etc/freeradius-web/admin.conf
807
	$SED "s?^general_domain:.*?general_domain: $DOMAIN?g" /etc/freeradius-web/admin.conf