| Line 1... |
Line 1... |
| 1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
| 2 |
# $Id: alcasar.sh 498 2011-02-24 20:56:27Z richard $
|
2 |
# $Id: alcasar.sh 499 2011-02-24 22:54:44Z richard $
|
| 3 |
|
3 |
|
| 4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
| 5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
| 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 1057... |
Line 1057... |
| 1057 |
cat << EOF > /etc/dnsmasq.d/alcasar-dnsmasq.conf
|
1057 |
cat << EOF > /etc/dnsmasq.d/alcasar-dnsmasq.conf
|
| 1058 |
# Configuration file for "dnsmasq + blackhole"
|
1058 |
# Configuration file for "dnsmasq + blackhole"
|
| 1059 |
# Inclusion de la blacklist <domains> de Toulouse dans la configuration
|
1059 |
# Inclusion de la blacklist <domains> de Toulouse dans la configuration
|
| 1060 |
conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled
|
1060 |
conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled
|
| 1061 |
conf-file=/usr/local/etc/alcasar-dns-name # zone de definition de noms DNS locaux
|
1061 |
conf-file=/usr/local/etc/alcasar-dns-name # zone de definition de noms DNS locaux
|
| 1062 |
|
- |
|
| 1063 |
listen-address=$PRIVATE_IP
|
1062 |
listen-address=$PRIVATE_IP
|
| 1064 |
listen-address=127.0.0.1
|
1063 |
listen-address=127.0.0.1
|
| 1065 |
no-dhcp-interface=$INTIF
|
1064 |
no-dhcp-interface=$INTIF
|
| 1066 |
bind-interfaces
|
1065 |
bind-interfaces
|
| 1067 |
|
- |
|
| 1068 |
cache-size=256
|
1066 |
cache-size=256
|
| 1069 |
domain=$DOMAIN
|
1067 |
domain=$DOMAIN
|
| 1070 |
domain-needed
|
1068 |
domain-needed
|
| 1071 |
expand-hosts
|
1069 |
expand-hosts
|
| 1072 |
bogus-priv
|
1070 |
bogus-priv
|
| 1073 |
filterwin2k
|
1071 |
filterwin2k
|
| 1074 |
server=$DNS1
|
1072 |
server=$DNS1
|
| 1075 |
server=$DNS2
|
1073 |
server=$DNS2
|
| 1076 |
|
- |
|
| 1077 |
# le servive DHCP est configuré mais n'est exploité que pour le "bypass"
|
1074 |
# le servive DHCP est configuré mais n'est exploité que pour le "bypass"
|
| 1078 |
dhcp-range=$ORGANISME,$PRIVATE_DYN_FIRST_IP,$PRIVATE_DYN_LAST_IP,$PRIVATE_MASK,12h
|
1075 |
dhcp-range=$ORGANISME,$PRIVATE_DYN_FIRST_IP,$PRIVATE_DYN_LAST_IP,$PRIVATE_MASK,12h
|
| 1079 |
#dhcp-option=3,1.2.3.4
|
1076 |
#dhcp-option=3,1.2.3.4
|
| 1080 |
#dhcp-option=option:router,1.2.3.4
|
1077 |
#dhcp-option=option:router,1.2.3.4
|
| 1081 |
#dhcp-option=42,0.0.0.0
|
1078 |
#dhcp-option=42,0.0.0.0
|
| Line 1086... |
Line 1083... |
| 1086 |
EOF
|
1083 |
EOF
|
| 1087 |
# 2nd dnsmasq configuration file for filter exception user (listen on udp 54)
|
1084 |
# 2nd dnsmasq configuration file for filter exception user (listen on udp 54)
|
| 1088 |
cat << EOF > /etc/dnsmasq-forward.conf
|
1085 |
cat << EOF > /etc/dnsmasq-forward.conf
|
| 1089 |
# Dnsmasq configuration for exception filter users (no blackhole)
|
1086 |
# Dnsmasq configuration for exception filter users (no blackhole)
|
| 1090 |
conf-file=/usr/local/etc/alcasar-dns-name # zone de definition de noms DNS locaux
|
1087 |
conf-file=/usr/local/etc/alcasar-dns-name # zone de definition de noms DNS locaux
|
| 1091 |
|
- |
|
| 1092 |
listen-address=$PRIVATE_IP
|
1088 |
listen-address=$PRIVATE_IP
|
| 1093 |
listen-address=127.0.0.1
|
- |
|
| 1094 |
port=54
|
1089 |
port=54
|
| 1095 |
no-dhcp-interface=$INTIF
|
1090 |
no-dhcp-interface=$INTIF
|
| 1096 |
bind-interfaces
|
1091 |
bind-interfaces
|
| 1097 |
|
- |
|
| 1098 |
cache-size=256
|
1092 |
cache-size=256
|
| 1099 |
domain=$DOMAIN
|
1093 |
domain=$DOMAIN
|
| 1100 |
domain-needed
|
1094 |
domain-needed
|
| 1101 |
expand-hosts
|
1095 |
expand-hosts
|
| 1102 |
bogus-priv
|
1096 |
bogus-priv
|
| Line 1107... |
Line 1101... |
| 1107 |
# On crée le fichier de résolution locale
|
1101 |
# On crée le fichier de résolution locale
|
| 1108 |
touch /usr/local/etc/alcasar-dns-name
|
1102 |
touch /usr/local/etc/alcasar-dns-name
|
| 1109 |
# On modifie le fichier d'initialisattion (lancement dune deuxième instance)
|
1103 |
# On modifie le fichier d'initialisattion (lancement dune deuxième instance)
|
| 1110 |
[ -e /etc/init.d/dnsmasq ] && cp /etc/init.d/dnsmasq /etc/init.d/dnsmasq.default
|
1104 |
[ -e /etc/init.d/dnsmasq ] && cp /etc/init.d/dnsmasq /etc/init.d/dnsmasq.default
|
| 1111 |
$SED "s?^DOMAIN_SUFFIX=.*?DOMAIN_SUFFIX=''?g" /etc/init.d/dnsmasq
|
1105 |
$SED "s?^DOMAIN_SUFFIX=.*?DOMAIN_SUFFIX=''?g" /etc/init.d/dnsmasq
|
| 1112 |
$SED "/daemon \$dnsmasq/a daemon \$dnsmasq -C /etc/dnsmasq-forward.conf" /etc/init.d/dnsmasq
|
1106 |
$SED "/\$dnsmasq/a daemon \$dnsmasq -C /etc/dnsmasq-forward.conf" /etc/init.d/dnsmasq
|
| 1113 |
$SED "/killproc \$iDAEMON_NAME/a killall \$DAEMON_NAME" /etc/init.d/dnsmasq
|
1107 |
$SED "/killproc \$DAEMON_NAME/a killall \$DAEMON_NAME" /etc/init.d/dnsmasq
|
| 1114 |
} # End dnsmasq
|
1108 |
} # End dnsmasq
|
| 1115 |
|
1109 |
|
| 1116 |
##########################################################
|
1110 |
##########################################################
|
| 1117 |
## Fonction BL (BlackList) ##
|
1111 |
## Fonction BL (BlackList) ##
|
| 1118 |
##########################################################
|
1112 |
##########################################################
|