Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-conf.sh 2887 2020-11-26 22:08:42Z rexy $
|
2 |
# $Id: alcasar-conf.sh 2899 2020-12-14 23:21:01Z rexy $
|
3 |
|
3 |
|
4 |
# alcasar-conf.sh
|
4 |
# alcasar-conf.sh
|
5 |
# by REXY
|
5 |
# by 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 |
|
7 |
|
Line 29... |
Line 29... |
29 |
MTU=`grep ^PUBLIC_MTU= $CONF_FILE|cut -d"=" -f2`
|
29 |
MTU=`grep ^PUBLIC_MTU= $CONF_FILE|cut -d"=" -f2`
|
30 |
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
|
30 |
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
|
31 |
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
|
31 |
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
|
32 |
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
|
32 |
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
|
33 |
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
|
33 |
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
|
34 |
SED="/bin/sed -i"
|
- |
|
35 |
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2` # server DNS1 (for WL domain names)
|
- |
|
36 |
DOMAIN=${DOMAIN:=localdomain}
|
34 |
DOMAIN=${DOMAIN:=localdomain}
|
- |
|
35 |
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2` # To configure WL domain names
|
- |
|
36 |
HTTPS_LOGIN=`grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2`
|
- |
|
37 |
SED="/bin/sed -i"
|
37 |
|
38 |
|
38 |
private_network_calc ()
|
39 |
private_network_calc ()
|
39 |
{
|
40 |
{
|
40 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
41 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
41 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
42 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
Line 476... |
Line 477... |
476 |
# sudoers
|
477 |
# sudoers
|
477 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
478 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
478 |
# gammu-smsd
|
479 |
# gammu-smsd
|
479 |
$SED "s?^user =.*?user = $DB_USER?g" /etc/gammu_smsd_conf
|
480 |
$SED "s?^user =.*?user = $DB_USER?g" /etc/gammu_smsd_conf
|
480 |
$SED "s?^password =.*?password = $DB_PASS?g" /etc/gammu_smsd_conf
|
481 |
$SED "s?^password =.*?password = $DB_PASS?g" /etc/gammu_smsd_conf
|
- |
|
482 |
# HTTPS login (Y/n)
|
- |
|
483 |
if [ "$HTTPS_LOGIN" = "on" ] || [ "$HTTPS_LOGIN" = "On" ] || [ "$HTTPS_LOGIN" = "ON" ]
|
- |
|
484 |
then
|
- |
|
485 |
$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=on?" $CONF_FILE
|
- |
|
486 |
$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=on?" $CONF_FILE
|
- |
|
487 |
$SED "s?^uamserver.*?uamserver\thttps://$HOSTNAME.$DOMAIN/intercept.php?" /etc/chilli.conf
|
- |
|
488 |
$SED "s?^#redirssl.*?redirssl?" /etc/chilli.conf
|
- |
|
489 |
$SED "s?^#uamuissl.*?uamuissl?" /etc/chilli.conf
|
- |
|
490 |
rm -f /etc/lighttpd/vhosts.d/alcasar.conf
|
- |
|
491 |
ln -s /etc/lighttpd/vhosts.d/alcasar-with-ssl.conf /etc/lighttpd/vhosts.d/alcasar.conf
|
- |
|
492 |
else
|
- |
|
493 |
$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=off?" $CONF_FILE
|
- |
|
494 |
$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=off?" $CONF_FILE
|
- |
|
495 |
$SED "s?^uamserver.*?uamserver\thttp://$HOSTNAME.$DOMAIN/intercept.php?" /etc/chilli.conf
|
- |
|
496 |
$SED "s?^redirssl.*?#&?" /etc/chilli.conf
|
- |
|
497 |
$SED "s?^uamuissl.*?#&?" /etc/chilli.conf
|
- |
|
498 |
rm -f /etc/lighttpd/vhosts.d/alcasar.conf
|
- |
|
499 |
ln -s /etc/lighttpd/vhosts.d/alcasar-without-ssl.conf /etc/lighttpd/vhosts.d/alcasar.conf
|
- |
|
500 |
fi
|
481 |
# Services start
|
501 |
# Services start
|
482 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
502 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
483 |
then
|
503 |
then
|
484 |
/usr/bin/systemctl start network && echo -n "Start service : network" && sleep 1
|
504 |
/usr/bin/systemctl start network && echo -n "Start service : network" && sleep 1
|
485 |
$DIR_BIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", chilli" # apply DHCP mode and start CoovaChilli
|
505 |
$DIR_BIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", chilli" # apply DHCP mode and start CoovaChilli
|