Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 2730 2019-05-21 22:03:25Z rexy $
|
2 |
# $Id: alcasar.sh 2736 2019-05-28 22:06:08Z 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 74... |
Line 74... |
74 |
DB_USER="radius" # user name allows to request the users database
|
74 |
DB_USER="radius" # user name allows to request the users database
|
75 |
DB_GAMMU="gammu" # database name used by Gammu-smsd
|
75 |
DB_GAMMU="gammu" # database name used by Gammu-smsd
|
76 |
# ******* Network parameters - paramètres réseau *******
|
76 |
# ******* Network parameters - paramètres réseau *******
|
77 |
HOSTNAME="alcasar" # default hostname
|
77 |
HOSTNAME="alcasar" # default hostname
|
78 |
DOMAIN="localdomain" # default local domain
|
78 |
DOMAIN="localdomain" # default local domain
|
79 |
EXTIF='' # EXTIF is connected to the ISP broadband modem/router (In France : Box-FAI)
|
79 |
EXTIF='' # EXTIF is connected to the ISP broadband modem/router (In France : Box-FAI)
|
80 |
INTIF='' # INTIF is connected to the consultation network
|
80 |
INTIF='' # INTIF is connected to the consultation network
|
81 |
MTU="1500"
|
81 |
MTU="1500"
|
82 |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # Default ALCASAR IP address
|
82 |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # Default ALCASAR IP address
|
83 |
# ****** Paths - chemin des commandes *******
|
83 |
# ****** Paths - chemin des commandes *******
|
84 |
SED="/bin/sed -i"
|
84 |
SED="/bin/sed -i"
|
85 |
# ****************** End of global parameters *********************
|
85 |
# ****************** End of global parameters *********************
|
Line 537... |
Line 537... |
537 |
else
|
537 |
else
|
538 |
PRIVATE_IP_MASK=$DEFAULT_PRIVATE_IP_MASK
|
538 |
PRIVATE_IP_MASK=$DEFAULT_PRIVATE_IP_MASK
|
539 |
fi
|
539 |
fi
|
540 |
else
|
540 |
else
|
541 |
PRIVATE_IP_MASK=`grep ^PRIVATE_IP= conf/etc/alcasar.conf|cut -d"=" -f2`
|
541 |
PRIVATE_IP_MASK=`grep ^PRIVATE_IP= conf/etc/alcasar.conf|cut -d"=" -f2`
|
542 |
rm -rf conf/etc/alcasar.conf
|
542 |
rm -f conf/etc/alcasar.conf
|
- |
|
543 |
fi
|
- |
|
544 |
header_install
|
- |
|
545 |
if [ "$mode" != "update" ]
|
- |
|
546 |
then
|
- |
|
547 |
if [ $Lang == "fr" ]
|
- |
|
548 |
then echo "Par défaut, le nom d'hôte d'ALCASAR est : $HOSTNAME.$DOMAIN"
|
- |
|
549 |
else echo "The default ALCASAR hostname is : $HOSTNAME.$DOMAIN"
|
- |
|
550 |
fi
|
- |
|
551 |
response=0
|
- |
|
552 |
PTN='^[oOyYnN]$'
|
- |
|
553 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
- |
|
554 |
do
|
- |
|
555 |
if [ $Lang == "fr" ]
|
- |
|
556 |
then echo -n "Voulez-vous utiliser ce nom d'hôte (recommandé) (O/n)? : "
|
- |
|
557 |
else echo -n "Do you want to use this hostname (recommanded) (Y/n)? : "
|
- |
|
558 |
fi
|
- |
|
559 |
read response
|
- |
|
560 |
done
|
- |
|
561 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
- |
|
562 |
then
|
- |
|
563 |
if [ $Lang == "fr" ]
|
- |
|
564 |
then echo -n "Entrez le nouveau nom d'hôte pleinement qualifié (hôte.domain) : "
|
- |
|
565 |
else echo -n "Enter the new full qualified hostname (host.domain) : "
|
- |
|
566 |
fi
|
- |
|
567 |
read FQDN
|
- |
|
568 |
HOSTNAME=`echo $FQDN|cut -d"." -f1`
|
- |
|
569 |
DOMAIN=`echo $FQDN|cut -d"." -f2`
|
- |
|
570 |
fi
|
543 |
fi
|
571 |
fi
|
544 |
# Define LAN side global parameters
|
572 |
# Define LAN side global parameters
|
545 |
hostnamectl set-hostname $HOSTNAME.$DOMAIN
|
573 |
hostnamectl set-hostname $HOSTNAME.$DOMAIN
|
546 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP_MASK | cut -d"=" -f2` # private network address (ie.: 192.168.182.0)
|
574 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP_MASK | cut -d"=" -f2` # private network address (ie.: 192.168.182.0)
|
547 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f4` # last octet of LAN address
|
575 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f4` # last octet of LAN address
|