Subversion Repositories ALCASAR

Rev

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

Rev 2844 Rev 2847
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2844 2020-07-04 15:21:55Z rexy $
2
#  $Id: alcasar.sh 2847 2020-07-05 21:47:51Z rexy $
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
#  team@alcasar.net
7
#  team@alcasar.net
Line 21... Line 21...
21
# Coovachilli, freeradius, mariaDB, lighttpd, netfilter, e2guardian, ntpd, openssl, dnsmasq, unbound, gammu, clamav, Ulog, fail2ban, NFsen and NFdump
21
# Coovachilli, freeradius, mariaDB, lighttpd, netfilter, e2guardian, ntpd, openssl, dnsmasq, unbound, gammu, clamav, Ulog, fail2ban, NFsen and NFdump
22
 
22
 
23
# Options :
23
# Options :
24
#       -i or --install
24
#       -i or --install
25
#       -u or --uninstall
25
#       -u or --uninstall
26
 
-
 
27
# Functions :
26
# Functions :
28
#	testing			: connectivity tests, free space test and mageia version test
27
#	testing			: connectivity tests, free space test and mageia version test
29
#	init			: Installation of RPM and scripts
28
#	init			: Installation of RPM and scripts
30
#	network			: Network parameters
29
#	network			: Network parameters
31
#	ACC				: ALCASAR Control Center installation
30
#	ACC				: ALCASAR Control Center installation
Line 220... Line 219...
220
# Create the current conf file
219
# Create the current conf file
221
			$DIR_SCRIPTS/alcasar-conf.sh --create
220
			$DIR_SCRIPTS/alcasar-conf.sh --create
222
			mode="update"
221
			mode="update"
223
		fi
222
		fi
224
	fi
223
	fi
225
# Test free space on /var
224
# Free /var (when updating) and test free space
-
 
225
	[ -d /var/log/netflow ] && rm -rf /var/log/netflow  # remove old porttracker RRD database
-
 
226
	[ -d /var/lib/clamav ] && rm -rf /var/lib/clamav # remove old clamav database
-
 
227
	journalctl -q --vacuum-files 1  # remove previous journal logs
226
	free_space=`df -BG --output=avail /var|tail -1|tr -d '[:space:]G'`
228
	free_space=`df -BG --output=avail /var|tail -1|tr -d '[:space:]G'`
227
	if [ $free_space -lt 10 ]
229
	if [ $free_space -lt 10 ]
228
		then
230
		then
229
		if [ $Lang == "fr" ]
231
		if [ $Lang == "fr" ]
230
			then echo "place disponible sur /var insufisante ($free_space Go au lieu de 10 Go au minimum)"
232
			then echo "Espace disponible insuffisant sur /var ($free_space Go au lieu de 10 Go au minimum)"
231
			else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)"
233
			else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)"
232
		fi
234
		fi
233
	exit 0
235
	exit 0
234
	fi
236
	fi
235
 
237
 
Line 1976... Line 1978...
1976
/etc/pki/CA/*                           root.apache     640
1978
/etc/pki/CA/*                           root.apache     640
1977
/etc/pki/CA/private/                    root.root       700
1979
/etc/pki/CA/private/                    root.root       700
1978
/etc/pki/CA/private/*                   root.root       600
1980
/etc/pki/CA/private/*                   root.root       600
1979
/etc/pki/tls/private/                   root.apache     750
1981
/etc/pki/tls/private/                   root.apache     750
1980
/etc/pki/tls/private/*                  root.apache     640
1982
/etc/pki/tls/private/*                  root.apache     640
1981
/var/log/netflow/porttracker            root.apache     770
-
 
1982
/var/log/netflow/porttracker/*          root.apache     660
-
 
1983
EOF
1983
EOF
1984
# apply now hourly & daily checks
1984
# apply now hourly & daily checks
1985
/usr/sbin/msec
1985
/usr/sbin/msec
1986
/etc/cron.weekly/msec
1986
/etc/cron.weekly/msec
1987
 
1987
 
Line 2313... Line 2313...
2313
				$DIR_DEST_BIN/alcasar-uninstall.sh -update
2313
				$DIR_DEST_BIN/alcasar-uninstall.sh -update
2314
			else
2314
			else
2315
				$DIR_DEST_BIN/alcasar-uninstall.sh -full
2315
				$DIR_DEST_BIN/alcasar-uninstall.sh -full
2316
			fi
2316
			fi
2317
		fi
2317
		fi
2318
	if [ $DEBUG_ALCASAR == "on" ]
2318
		if [ $DEBUG_ALCASAR == "on" ]
2319
	then
2319
		then
2320
		echo "*** 'debug' : end of cleaning ***"
2320
			echo "*** 'debug' : end of cleaning ***"
2321
		read
2321
			read
2322
	fi
2322
		fi
2323
# Test if conf file
2323
# Test if conf file
2324
		if [ -e /var/tmp/alcasar-conf.tar.gz ]
2324
		if [ -e /var/tmp/alcasar-conf.tar.gz ]
2325
		then
2325
		then
2326
# Extract some info from the previous configuration file
2326
# Extract some info from the previous configuration file
2327
			cd /var/tmp
2327
			cd /var/tmp
2328
			tar -xf /var/tmp/alcasar-conf.tar.gz conf/etc/alcasar.conf
2328
			tar -xf /var/tmp/alcasar-conf.tar.gz conf/etc/alcasar.conf
2329
			cd $DIR_INSTALL
-
 
2330
			if [ "mode" == "install" ] # don't display this if updating a running version
2329
			if [ "$mode" == "install" ] # don't display this if updating a running version
2331
			then
2330
			then
2332
				header_install
2331
				header_install
2333
				ORGANISME=`grep ^ORGANISM= conf/etc/alcasar.conf|cut -d"=" -f2`
2332
				ORGANISME=`grep ^ORGANISM= conf/etc/alcasar.conf|cut -d"=" -f2`
2334
				PREVIOUS_VERSION=`grep ^VERSION= conf/etc/alcasar.conf|cut -d"=" -f2`
2333
				PREVIOUS_VERSION=`grep ^VERSION= conf/etc/alcasar.conf|cut -d"=" -f2`
2335
				MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
2334
				MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
Line 2353... Line 2352...
2353
						rm -f /var/tmp/alcasar-conf*
2352
						rm -f /var/tmp/alcasar-conf*
2354
						rm -rf /var/tmp/conf
2353
						rm -rf /var/tmp/conf
2355
					fi
2354
					fi
2356
				done
2355
				done
2357
			fi
2356
			fi
-
 
2357
			cd $DIR_INSTALL
2358
		fi
2358
		fi
2359
# Test if update
2359
# Test if update
2360
		if [ -e /var/tmp/alcasar-conf.tar.gz ]
2360
		if [ -e /var/tmp/alcasar-conf.tar.gz ]
2361
		then
2361
		then
2362
			if [ $Lang == "fr" ]
2362
			if [ $Lang == "fr" ]