Subversion Repositories ALCASAR

Rev

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

Rev 2802 Rev 2809
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2802 2020-04-07 21:39:50Z rexy $
2
#  $Id: alcasar.sh 2809 2020-04-12 17:35:46Z 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 553... Line 553...
553
	PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX						# ie.: 192.168.182.0/24
553
	PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX						# ie.: 192.168.182.0/24
554
	classe=$((PRIVATE_PREFIX/8))									# ie.: 2=classe B, 3=classe C
554
	classe=$((PRIVATE_PREFIX/8))									# ie.: 2=classe B, 3=classe C
555
	PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`.				# compatibility with hosts.allow et hosts.deny (ie.: 192.168.182.)
555
	PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`.				# compatibility with hosts.allow et hosts.deny (ie.: 192.168.182.)
556
	PRIVATE_MAC=`/usr/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'` 	# MAC address of INTIF
556
	PRIVATE_MAC=`/usr/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'` 	# MAC address of INTIF
557
# Define Internet parameters
557
# Define Internet parameters
558
	if [ "$mode" != "update" ]
-
 
559
	then
-
 
560
		DNS1=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS1='| cut -d"=" -f2`	# 1st DNS server
558
	DNS1=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS1='| cut -d"=" -f2`	# 1st DNS server
561
		DNS2=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS2=' | cut -d"=" -f2`	# 2nd DNS server
559
	DNS2=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS2=' | cut -d"=" -f2`	# 2nd DNS server
562
	else
-
 
563
		DNS1=`cat /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF | grep '^DNS1=' | cut -d"=" -f2`	# 1st DNS server
-
 
564
		DNS2=`cat /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF | grep '^DNS2=' | cut -d"=" -f2`	# 2nd DNS server
-
 
565
	fi
-
 
566
    DNS1=${DNS1:=208.67.220.220}
560
    DNS1=${DNS1:=208.67.220.220}
567
	DNS2=${DNS2:=208.67.222.222}
561
	DNS2=${DNS2:=208.67.222.222}
568
#	if [ "$DNS1" == "" ]
562
#	if [ "$DNS1" == "" ]
569
#	then
563
#	then
570
#		if [ $Lang == "fr" ]
564
#		if [ $Lang == "fr" ]
Line 1526... Line 1520...
1526
    chown -R nfcapd:nfcapd /var/log/nfsen /run/nfcapd
1520
    chown -R nfcapd:nfcapd /var/log/nfsen /run/nfcapd
1527
} # End of nfsen()
1521
} # End of nfsen()
1528
 
1522
 
1529
###########################################################
1523
###########################################################
1530
##                     Function "vnstat"                 ##
1524
##                     Function "vnstat"                 ##
1531
## - Initialization of Vnstat and vnstat phpFrontEnd     ##
1525
## - Initialization of vnstat and vnstat-dashboard       ##
1532
###########################################################
1526
###########################################################
1533
vnstat()
1527
vnstat()
1534
{
1528
{
-
 
1529
    # vnstat
1535
	[ -e /etc/vnstat.conf.default ] || cp /etc/vnstat.conf /etc/vnstat.conf.default
1530
    [ -e /etc/vnstat.conf.default ] || cp /etc/vnstat.conf /etc/vnstat.conf.default
1536
	$SED "s?^Interface.*?Interface \"$EXTIF\"?g" /etc/vnstat.conf
1531
	$SED "s?^Interface.*?Interface \"$EXTIF\"?g" /etc/vnstat.conf
1537
	$SED "s?^DatabaseDir.*?DatabaseDir /var/log/vnstat?g" /etc/vnstat.conf
1532
	$SED "s?^DatabaseDir.*?DatabaseDir /var/log/vnstat?g" /etc/vnstat.conf
1538
	[ -e $DIR_ACC/manager/stats/config.php.default ] || cp $DIR_ACC/manager/stats/config.php $DIR_ACC/manager/stats/config.php.default
-
 
1539
	$SED "s?\$iface_list =.*?\$iface_list = array('$EXTIF');?" $DIR_ACC/manager/stats/config.php
1533
    # vnstat-dashboard
1540
	$SED "s?\$iface_title\['.*?\$iface_title\['$EXTIF'\] = \$title;?" $DIR_ACC/manager/stats/config.php
1534
    $SED "s?^\$thisInterface.*?\$thisInterface = \"$EXTIF\";?" $DIR_ACC/manager/vnstat/index.php
1541
} # End of vnstat()
1535
} # End of vnstat()
1542
 
1536
 
1543
###################################################################
1537
###################################################################
1544
##                     Function "dnsmasq"                        ##
1538
##                     Function "dnsmasq"                        ##
1545
## - creation of the conf files of dnsmasq (whitelist for ipset )##
1539
## - creation of the conf files of dnsmasq (whitelist for ipset )##