Subversion Repositories ALCASAR

Rev

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

Rev 249 Rev 254
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#  $Id: alcasar.sh 249 2010-09-13 22:26:54Z franck $ 
2
#  $Id: alcasar.sh 254 2010-09-15 11:58:02Z franck $ 
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 1034... Line 1034...
1034
EOF
1034
EOF
1035
} # End of param_awstats ()
1035
} # End of param_awstats ()
1036
 
1036
 
1037
##########################################################
1037
##########################################################
1038
##		Fonction param_dnsmasq			##
1038
##		Fonction param_dnsmasq			##
1039
## - Mise en place des différents fichiers de bind	##
-
 
1040
##########################################################
1039
##########################################################
1041
param_dnsmasq ()
1040
param_dnsmasq ()
1042
{
1041
{
1043
	[ -d /etc/dnsmasq.d ] || mkdir /etc/dnsmasq.d
1042
	[ -d /etc/dnsmasq.d ] || mkdir /etc/dnsmasq.d
1044
	[ -d /var/log/dnsmasq ] || mkdir /var/log/dnsmasq
1043
	[ -d /var/log/dnsmasq ] || mkdir /var/log/dnsmasq
Line 1055... Line 1054...
1055
	mkdir /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1054
	mkdir /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1056
	chown -R 770 /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1055
	chown -R 770 /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1057
	chown -R root:apache /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1056
	chown -R root:apache /usr/local/etc/{alcasar-dnsfilter-available,alcasar-dnsfilter-enabled}
1058
	/usr/local/bin/alcasar-dnsfilter-import.sh
1057
	/usr/local/bin/alcasar-dnsfilter-import.sh
1059
	/usr/local/bin/alcasar-dnsfilter-activate.sh
1058
	/usr/local/bin/alcasar-dnsfilter-activate.sh
1060
}
-
 
1061
 
-
 
1062
# début de zone à supprimer depuis intégration de dnsmasq ; reste à intégrer les zones directes des hôtes du réseau local et le reverse ...
-
 
1063
param_bind ()
-
 
1064
{
-
 
1065
	ln -sf /var/lib/named/etc/trusted_networks_acl.conf /etc/
-
 
1066
	ln -sf /var/lib/named/etc/named.conf /etc/
-
 
1067
	ln -sf /var/lib/named/var/named /var/
-
 
1068
	ln -sf /var/lib/named/var/log/ /var/log/named
-
 
1069
	[ -e /var/lib/named/etc/trusted_networks_acl.conf.default  ] || cp /var/lib/named/etc/trusted_networks_acl.conf /var/lib/named/etc/trusted_networks_acl.conf.default
-
 
1070
	[ -e /var/lib/named/etc/named.conf.default  ] || cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf.default
-
 
1071
	[ -e /var/lib/named/var/named/master/localdomain.zone.default  ] || cp /var/lib/named/var/named/master/localdomain.zone /var/lib/named/var/named/master/localdomain.zone.default
-
 
1072
	$SED "s?127.0.0.1;.*?127.0.0.1; $CUSTOM_PRIVATE_NETWORK_MASK;?g" /var/lib/named/etc/trusted_networks_acl.conf
-
 
1073
	$SED "s?listen-on.*?listen-on port 53 \{ 127.0.0.1; $PRIVATE_IP; \};?g" /var/lib/named/etc/named.conf
-
 
1074
	$SED "s?^\/\/[ ]*forwarders.*?    forward only; forwarders { $DNS1; $DNS2; };?g" /var/lib/named/etc/named.conf
-
 
1075
#	$SED "s?^\/\/ include \"\/etc\/bogon_acl.conf\";.*?include \"\/etc\/bogon_acl.conf\";?g" /var/lib/named/etc/named.conf
-
 
1076
# On crée l'entrée pour le reverse
-
 
1077
	for i in $(seq $classe -1 1)
-
 
1078
	do
-
 
1079
		echo -n `echo $PRIVATE_NETWORK|cut -d"." -f$i`. >> /tmp/rev.txt
-
 
1080
	done
-
 
1081
	echo "in-addr.arpa" >> /tmp/rev.txt
-
 
1082
	reverse_addr=`cat /tmp/rev.txt`
-
 
1083
	rm -f /tmp/rev.txt
-
 
1084
cat << EOF >> /var/lib/named/etc/named.conf
-
 
1085
zone "$reverse_addr" IN {
-
 
1086
	type master;
1059
} # End dnsmasq
1087
	file "reverse/localdomain.rev";
-
 
1088
	allow-update { none; };
-
 
1089
};
-
 
1090
EOF
-
 
1091
	cp -f $DIR_CONF/localdomain.zone /var/lib/named/var/named/master/localdomain.zone
-
 
1092
	echo "$HOSTNAME	IN A $PRIVATE_IP" >> /var/lib/named/var/named/master/localdomain.zone
-
 
1093
	echo "alcasar	IN CNAME $HOSTNAME" >> /var/lib/named/var/named/master/localdomain.zone
-
 
1094
	cp -f $DIR_CONF/localdomain.rev /var/lib/named/var/named/reverse/localdomain.rev
-
 
1095
	echo "1 	IN PTR alcasar." >> /var/lib/named/var/named/reverse/localdomain.rev
-
 
1096
# fichier de blacklistage de named dans  ... à venir
-
 
1097
}
-
 
1098
##### zone à supprimer du script
-
 
1099
 
1060
 
1100
##########################################################
1061
##########################################################
1101
##		Fonction cron				##
1062
##		Fonction cron				##
1102
## - Mise en place des différents fichiers de cron	##
1063
## - Mise en place des différents fichiers de cron	##
1103
##########################################################
1064
##########################################################
Line 1356... Line 1317...
1356
			hostname `cat $DIR_CONF/hostname`
1317
			hostname `cat $DIR_CONF/hostname`
1357
			mode="update"
1318
			mode="update"
1358
		else
1319
		else
1359
			mode="install"
1320
			mode="install"
1360
		fi
1321
		fi
1361
#		for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_awstats param_bind cron post_install
-
 
1362
		for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_awstats param_dnsmasq cron post_install
1322
		for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_awstats param_dnsmasq cron post_install
1363
 
1323
 
1364
		do
1324
		do
1365
			$func
1325
			$func
1366
# echo "*** 'debug' : end of function $func ***"; read a
1326
# echo "*** 'debug' : end of function $func ***"; read a