Subversion Repositories ALCASAR

Rev

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

Rev 2835 Rev 2838
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2835 2020-06-15 21:30:20Z rexy $
2
# $Id: alcasar-conf.sh 2838 2020-06-21 22:15:26Z 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 331... Line 331...
331
sshd: ALL
331
sshd: ALL
332
ntpd: $PRIVATE_NETWORK_SHORT
332
ntpd: $PRIVATE_NETWORK_SHORT
333
EOF
333
EOF
334
# Set hostname
334
# Set hostname
335
                hostnamectl set-hostname $HOSTNAME.$DOMAIN
335
                hostnamectl set-hostname $HOSTNAME.$DOMAIN
-
 
336
# /etc/hosts (retriving local hostnames)
336
# /etc/hosts
337
                cp /etc/hosts /tmp/hosts
-
 
338
                echo "127.0.0.1 localhost" > /etc/hosts
337
                domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
339
                echo "$PRIVATE_IP       $HOSTNAME $HOSTNAME.$DOMAIN" >> /etc/hosts
-
 
340
                while read -r line
-
 
341
                do
338
                [ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
342
                                if ! echo $line | grep -E -q "^([0-9\.\t ]+alcasar( |$)|127\.0\.0)"
-
 
343
                                then
339
                $SED "/^$PRIVATE_IP\t/d"  /etc/hosts
344
                                        echo $line >> /etc/hosts
-
 
345
                                fi
340
                $SED "/\s$HOSTNAME\s\$/d" /etc/hosts
346
                done < /tmp/hosts
341
                [ "$HOSTNAME" != 'alcasar' ] && $SED "/\salcasar\s\$/d" /etc/hosts
-
 
342
                echo "$PRIVATE_IP       $domainNames" >> /etc/hosts
347
                rm -f /tmp/hosts               
343
# MOTD
348
# MOTD
344
                $SED "s@'https://\(.\+\)/acc'@'https://$HOSTNAME.$DOMAIN/acc'@" /etc/mageia-release
349
                $SED "s@'https://\(.\+\)/acc'@'https://$HOSTNAME.$DOMAIN/acc'@" /etc/mageia-release
345
# Lighttpd
350
# Lighttpd
346
                $SED "s?^server\.bind.*?server\.bind = \"$PRIVATE_IP\"?g" /etc/lighttpd/lighttpd.conf
351
                $SED "s?^server\.bind.*?server\.bind = \"$PRIVATE_IP\"?g" /etc/lighttpd/lighttpd.conf
347
                $SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$PRIVATE_IP"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
352
                $SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$PRIVATE_IP"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
Line 425... Line 430...
425
        range dynamic-bootp $PRIVATE_SECOND_IP $PRIVATE_LAST_IP;
430
        range dynamic-bootp $PRIVATE_SECOND_IP $PRIVATE_LAST_IP;
426
        default-lease-time 21600;
431
        default-lease-time 21600;
427
        max-lease-time 43200;
432
        max-lease-time 43200;
428
}
433
}
429
EOF
434
EOF
430
$DIR_BIN/alcasar-dns-local.sh -hosts_to_unbound # add local name resoution to unbound (forward & blackhole)
435
$DIR_BIN/alcasar-dns-local.sh -hosts_to_unbound # add local name resolution to unbound (forward & blackhole)
431
# tinyproxy
436
# tinyproxy
432
                $SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
437
                $SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
433
# DG + BL
438
# DG + BL
434
                $SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
439
                $SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
435
# Watchdog
440
# Watchdog