Line 1... |
Line 1... |
1 |
#/bin/bash
|
1 |
#/bin/bash
|
2 |
# $Id: alcasar-conf.sh 1520 2014-12-17 18:10:26Z richard $
|
2 |
# $Id: alcasar-conf.sh 1521 2014-12-17 22:57:44Z richard $
|
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 260... |
Line 260... |
260 |
$DIR_SBIN/alcasar-dhcp.sh --off
|
260 |
$DIR_SBIN/alcasar-dhcp.sh --off
|
261 |
fi
|
261 |
fi
|
262 |
# Logout everybody
|
262 |
# Logout everybody
|
263 |
$DIR_SBIN/alcasar-logout.sh all
|
263 |
$DIR_SBIN/alcasar-logout.sh all
|
264 |
# Services stop
|
264 |
# Services stop
|
- |
|
265 |
echo -n "Stop services : "
|
265 |
for i in ntpd httpd tinyproxy dnsmasq dnsmasq-whitelist dnsmasq-blacklist chilli network
|
266 |
for i in ntpd httpd tinyproxy dnsmasq dnsmasq-whitelist dnsmasq-blacklist chilli network
|
266 |
do
|
267 |
do
|
267 |
systemctl stop $i && echo "$i stopped"
|
268 |
systemctl stop $i && echo -n "$i, "
|
268 |
done
|
269 |
done
|
- |
|
270 |
echo
|
269 |
fi
|
271 |
fi
|
270 |
|
272 |
|
271 |
# /etc/hosts
|
273 |
# /etc/hosts
|
272 |
cat <<EOF > /etc/hosts
|
274 |
cat <<EOF > /etc/hosts
|
273 |
127.0.0.1 localhost
|
275 |
127.0.0.1 localhost
|
Line 277... |
Line 279... |
277 |
# EXTIF config
|
279 |
# EXTIF config
|
278 |
$SED "s?^IPADDR=.*?IPADDR=$PUBLIC_IP?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
280 |
$SED "s?^IPADDR=.*?IPADDR=$PUBLIC_IP?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
279 |
$SED "s?^NETMASK=.*?NETMASK=$PUBLIC_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
281 |
$SED "s?^NETMASK=.*?NETMASK=$PUBLIC_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
280 |
$SED "s?^GATEWAY=.*?GATEWAY=$PUBLIC_GATEWAY?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
282 |
$SED "s?^GATEWAY=.*?GATEWAY=$PUBLIC_GATEWAY?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
281 |
# INTIF config (for bypass mode only)
|
283 |
# INTIF config (for bypass mode only)
|
282 |
$SED "s?^IPADDR=.?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/default-ifcfg-$INTIF
|
284 |
$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/default-ifcfg-$INTIF
|
283 |
$SED "s?^NETMASK=.?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/default-ifcfg-$INTIF
|
285 |
$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/default-ifcfg-$INTIF
|
284 |
# NTP server
|
286 |
# NTP server
|
285 |
$SED "/127.0.0.1/!s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap?g" /etc/ntp.conf
|
287 |
$SED "/127.0.0.1/!s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap?g" /etc/ntp.conf
|
286 |
# host.allow
|
288 |
# host.allow
|
287 |
cat <<EOF > /etc/hosts.allow
|
289 |
cat <<EOF > /etc/hosts.allow
|
288 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
290 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
Line 327... |
Line 329... |
327 |
# sudoers
|
329 |
# sudoers
|
328 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
330 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
329 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
331 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
330 |
then
|
332 |
then
|
331 |
# Services start
|
333 |
# Services start
|
332 |
systemctl start network
|
334 |
systemctl start network && echo -n "Start service : network" && sleep 1
|
333 |
$DIR_SBIN/alcasar-dhcp.sh -$DHCP_mode # apply DHCP mode and start coova
|
335 |
$DIR_SBIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", coova" # apply DHCP mode and start coova
|
334 |
for i in dnsmasq httpd tinyproxy ntpd
|
336 |
for i in dnsmasq httpd tinyproxy ntpd
|
335 |
do
|
337 |
do
|
- |
|
338 |
sleep 1
|
336 |
systemctl start $i && echo "$i started"
|
339 |
systemctl start $i && echo -n ", $i"
|
337 |
done
|
340 |
done
|
338 |
$DIR_SBIN/alcasar-bl.sh -reload # restart DG, dnsmasq-blacklist dnsmasq-whitelist & iptables
|
341 |
$DIR_SBIN/alcasar-bl.sh -reload && echo ", dnsmasq-blacklist, dnsmasq-whitelist, iptables"
|
339 |
fi
|
342 |
fi
|
340 |
# Start / Stop SSH Daemon
|
343 |
# Start / Stop SSH Daemon
|
341 |
ssh_active=`grep SSH= $CONF_FILE|cut -d"=" -f2`
|
344 |
ssh_active=`grep SSH= $CONF_FILE|cut -d"=" -f2`
|
342 |
if [ $ssh_active = "on" ]
|
345 |
if [ $ssh_active = "on" ]
|
343 |
then
|
346 |
then
|