Subversion Repositories ALCASAR

Rev

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

Rev 344 Rev 346
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#  $Id: alcasar.sh 344 2010-11-26 14:32:35Z richard $ 
2
#  $Id: alcasar.sh 346 2010-11-28 18:09:05Z 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 766... Line 766...
766
</Directory>
766
</Directory>
767
EOF
767
EOF
768
	echo "- URL pour le changement du mot de passe usager : https://$PRIVATE_IP/pass/" >> $FIC_PARAM
768
	echo "- URL pour le changement du mot de passe usager : https://$PRIVATE_IP/pass/" >> $FIC_PARAM
769
} # End of param_web_radius ()
769
} # End of param_web_radius ()
770
 
770
 
771
##########################################################################
771
##########################################################################################
772
##			Fonction param_chilli				##
772
##			Fonction param_chilli						##
773
## - Paramètrage du fichier de configuration de coova-chilli		##
773
## - Paramètrage du fichier d'initialisation et de configuration de coova-chilli	##
774
## - Paramètrage de la page d'authentification (intercept.php)		##
774
## - Paramètrage de la page d'authentification (intercept.php)				##
775
##########################################################################
775
##########################################################################################
776
param_chilli ()
776
param_chilli ()
777
{
777
{
778
# modification du générateur du fichier de conf 
-
 
779
	[ -e /etc/chilli/functions.default ] || cp /etc/chilli/functions /etc/chilli/functions.default
-
 
780
	# suppression du domaine "coova.org" dans la primitive uamallowed
-
 
781
	$SED "s?www.coova.org,??g" /etc/chilli/functions
-
 
782
	# suppression de la primitive "uamanydns"
-
 
783
	$SED "s?uamanydns??g" /etc/chilli/functions
-
 
784
	# on fixe la socket de commande local (/var/run/chilli.sock)
-
 
785
	$SED "s?^CMDSOCK=.*?CMDSOCK=\$RUN_D/chilli.sock?g" /etc/chilli/functions
-
 
786
# modification du fichier d'initialisation
778
# modification du fichier d'initialisation
787
	[ -e /etc/init.d/chilli.default ] || cp /etc/init.d/chilli /etc/init.d/chilli.default
779
	[ -e /etc/init.d/chilli.default ] || cp /etc/init.d/chilli /etc/init.d/chilli.default
788
	# configuration d'eth1 (utile pour dnsmasq))
780
	# configuration d'eth1 (utile pour dnsmasq))
789
	$SED "s?ifconfig.*?ifconfig \$HS_LANIF $PRIVATE_IP?g" /etc/init.d/chilli
781
	$SED "s?ifconfig.*?ifconfig \$HS_LANIF $PRIVATE_IP?g" /etc/init.d/chilli
790
	# ajout de la fonction 'status' (utile pour la gestion du process)
782
	# ajout de la fonction 'status' (utile pour la gestion du process)
791
	$SED "/^.*functions/i. /etc/init.d/functions" /etc/init.d/chilli
783
	$SED "/^.*functions/i. /etc/init.d/functions" /etc/init.d/chilli
792
	$SED "/^[\t ]*stop)/i\    status)\n        status chilli\n        RETVAL=$?\n        ;;\n" /etc/init.d/chilli
784
	$SED "/^[\t ]*stop)/i\    status)\n        status chilli\n        RETVAL=$?\n        ;;\n" /etc/init.d/chilli
793
	# insertion d'une tempo sur le 'restart' pour permettre à tun0 d'être libérée
785
	# insertion d'une tempo sur le 'restart' pour permettre à tun0 d'être libérée
794
	$SED "/^[\t ]*\$0 start/i\        sleep 2" /etc/init.d/chilli
786
	$SED "/^[\t ]*\$0 start/i\        sleep 2" /etc/init.d/chilli
-
 
787
	# suppression des fonctions 'writeconfig' et 'radiusconfig'. Suppression de warning disgracieux 
-
 
788
	$SED "/writeconfig/d" /etc/init.d/chilli
795
	# suppression de warning disgracieux
789
	$SED "/radiusconfig/d" /etc/init.d/chilli
796
	$SED "s?which start-stop-daemon?which start-stop-daemon 2>/dev/null?g" /etc/init.d/chilli
790
	$SED "s?which start-stop-daemon?which start-stop-daemon 2>/dev/null?g" /etc/init.d/chilli
797
# création du fichier de conf
791
# création du fichier de conf
798
	cp /etc/chilli/defaults /etc/chilli/config
792
	[ -e /etc/chilli.conf.default ] || cp /etc/chilli.conf /etc/chilli.conf.default
799
	$SED "s?^# HS_WANIF=.*?HF_WANIF=$EXTIF?g" /etc/chilli/config
793
	cat <<EOF > /etc/chilli.conf
800
	$SED "s?^HS_LANIF=.*?HS_LANIF=$INTIF?g" /etc/chilli/config
794
# coova config for ALCASAR
801
	$SED "s?^HS_NETWORK=.*?HS_NETWORK=$PRIVATE_NETWORK?g" /etc/chilli/config
795
cmdsocket	/var/run/chilli.sock
802
	$SED "s?^HS_NETMASK=.*?HS_NETMASK=$PRIVATE_MASK?g" /etc/chilli/config
796
unixipc		chilli.eth1.ipc
803
	$SED "s?^HS_UAMLISTEN=.*?HS_UAMLISTEN=$PRIVATE_IP?g" /etc/chilli/config
797
pidfile		/var/run/chilli.eth1.pid
804
	$SED "s?^HS_UAMPORT=.*?HS_UAMPORT=$UAMPORT?g" /etc/chilli/config
798
net		$PRIVATE_NETWORK_MASK
805
	$SED "s?^# HS_DYNIP=.*?HS_DYNIP=$PRIVATE_DYN_IP?g" /etc/chilli/config
799
dynip		$PRIVATE_DYN_IP
806
	$SED "s?^# HS_DYNIP_MASK=.*?HS_DYNIP_MASK=$PRIVATE_DYN_MASK?g" /etc/chilli/config
-
 
807
	$SED "s?^# HS_STATIP=.*?HS_STATIP=$PRIVATE_STAT_IP?g" /etc/chilli/config
800
statip		$PRIVATE_STAT_IP
808
	$SED "s?^# HS_STATIP_MASK.*?HS_STATIP_MASK=$PRIVATE_STAT_MASK?g" /etc/chilli/config
-
 
809
	$SED "s?^# HS_DNS_DOMAIN=.*?HS_DNS_DOMAIN=$DOMAIN?g" /etc/chilli/config
801
domain		localdomain
-
 
802
dns1		$DNS1
-
 
803
dns2		$DNS2
810
	$SED "s?^HS_DNS1=.*?HS_DNS1=$PRIVATE_IP?g" /etc/chilli/config
804
uamlisten	$PRIVATE_IP
811
	$SED "s?^HS_DNS2=.*?HS_DNS2=$PRIVATE_IP?g" /etc/chilli/config
805
uamport		$UAMPORT
-
 
806
dhcpif		$INTIF
-
 
807
uamanyip
-
 
808
macallowlocal
812
	$SED "s?^HS_UAMSECRET=.*?HS_UAMSECRET=$secretuam?g" /etc/chilli/config
809
locationname	$HOSTNAME
813
	$SED "s?^HS_RADIUS=.*?HS_RADIUS=127.0.0.1?g" /etc/chilli/config
810
radiusserver1	127.0.0.1
814
	$SED "s?^HS_RADIUS2=.*?HS_RADIUS2=127.0.0.1?g" /etc/chilli/config
811
radiusserver2	127.0.0.1
815
	$SED "s?^HS_RADSECRET=.*?HS_RADSECRET=$secretradius?g" /etc/chilli/config
812
radiussecret	$secretradius
816
	$SED "s?^HS_UAMALLOW=.*?# HS_UAMALLOW?g" /etc/chilli/config
813
radiusauthport	1812
817
	$SED "s?^HS_UAMSERVER=.*?HS_UAMSERVER=$PRIVATE_IP?g" /etc/chilli/config
814
radiusacctport	1813
818
	$SED "s?^HS_UAMFORMAT=.*?HS_UAMFORMAT=https://\$HS_UAMSERVER/intercept.php?g" /etc/chilli/config
815
uamserver	https://$PRIVATE_IP/intercept.php
819
	$SED "s?^HS_UAMHOMEPAGE=.*?HS_UAMHOMEPAGE=?g" /etc/chilli/config
816
radiusnasid	$HOSTNAME
820
	$SED "s?^HS_UAMSERVICE=.*?# HS_UAMSERVICE?g" /etc/chilli/config
817
papalwaysok
821
	$SED "s?^# HS_ANYIP=.*?HS_ANYIP=on?g" /etc/chilli/config
818
dnsparanoia
822
	$SED "s?^# HS_DNSPARANOIA=.*?HS_DNSPARANOIA=on?g" /etc/chilli/config
-
 
823
	$SED "s?^HS_LOC_NAME=.*?HS_LOC_NAME=\"$HOSTNAME\"?g" /etc/chilli/config
819
uamaliasname	$HOSTNAME
824
	$SED "s?^HS_WWWDIR.*?# HS_WWWDIR?g" /etc/chilli/config
820
uamsecret	$secretuam
-
 
821
coaport		3799
825
	$SED "s?^HS_WWWBIN.*?# HS_WWWBIN?g" /etc/chilli/config
822
include		/usr/local/etc/alcasar-uamallowed
826
	$SED "s?^HS_PROVIDER_LINK.*?HS_PROVIDER_LINK=https://\$HS_UAMSERVER/?g" /etc/chilli/config
-
 
827
	echo "HS_COAPORT=3799" >> /etc/chilli/config
823
include		/usr/local/etc/alcasar-uamdomain
828
	echo "HS_ADMINTERVAL=0" >> /etc/chilli/config
824
include		/usr/local/etc/alcasar-macallowed
-
 
825
EOF
829
# création des fichiers de sites, d'urls et d'adresses MAC de confiance
826
# création des fichiers de sites, d'urls et d'adresses MAC de confiance
830
	echo -e "HS_UAMALLOW=\"\"" > /etc/chilli/alcasar-uamallowed
827
	echo -e "uamallowed=\"\"" > /usr/local/etc/alcasar-uamallowed
831
	echo -e "HS_UAMDOMAINS=\"\"" > /etc/chilli/alcasar-uamdomain
828
	echo -e "uamdomain=\"\"" > /usr/local/etc/alcasar-uamdomain
832
	$SED "s?^# HS_MACAUTHMODE=.*?HS_MACAUTHMODE=local?g" /etc/chilli/config
-
 
833
	echo -e "HS_MACALLOW=\"\"" > /etc/chilli/alcasar-macallowed
829
	echo -e "macallowed=\"\"" > /usr/local/etc/alcasar-macallowed
834
	chown root:apache /etc/chilli/alcasar-*
830
	chown root:apache /usr/local/etc/alcasar-*
835
	chmod 660 /etc/chilli/alcasar-*
831
	chmod 660 /usr/local/etc/alcasar-*
836
	echo ". /etc/chilli/alcasar-uamallowed" >> /etc/chilli/config
-
 
837
	echo ". /etc/chilli/alcasar-uamdomain" >> /etc/chilli/config
-
 
838
	echo ". /etc/chilli/alcasar-macallowed" >> /etc/chilli/config
-
 
839
	echo "- URL de deconnexion du portail : http://$PRIVATE_IP:$UAMPORT/logoff" >> $FIC_PARAM
832
	echo "- URL de deconnexion du portail : http://$PRIVATE_IP:$UAMPORT/logoff" >> $FIC_PARAM
840
# Définition du secret partagé entre coova-chilli et la page d'authentification (intercept.php)
833
# Définition du secret partagé entre coova-chilli et la page d'authentification (intercept.php)
841
	$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
834
	$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
842
	$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
835
	$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
843
	$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php
836
	$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php
844
# Suppression des modifications "iptables" effectuées lors du lancement du daemon coova
-
 
845
	$SED "s?^    iptables \$opt \$\*?#   iptables \$opt \$\*?g" /etc/chilli/up.sh
-
 
846
}  # End of param_chilli ()
837
}  # End of param_chilli ()
847
 
838
 
848
##########################################################
839
##########################################################
849
##			Fonction param_squid		##
840
##			Fonction param_squid		##
850
## - Paramètrage du proxy 'squid' en mode 'cache'	##
841
## - Paramètrage du proxy 'squid' en mode 'cache'	##