Subversion Repositories ALCASAR

Rev

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

Rev 1007 Rev 1008
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 1007 2013-01-05 15:14:32Z richard $ 
2
#  $Id: alcasar.sh 1008 2013-01-05 23:13:33Z richard $ 
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
 
5
 
6
# ALCASAR - Portail captif d'accès à l'Internet -  Copyright (C) [2005] [ALcasar team - Rexy - 3abtux - ...] 
6
# ALCASAR - Portail captif d'accès à l'Internet -  Copyright (C) [2005] [ALcasar team - Rexy - 3abtux - ...] 
7
# Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier au titre des clauses de la Licence Publique Générale GNU, 
7
# Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier au titre des clauses de la Licence Publique Générale GNU, 
Line 592... Line 592...
592
			do
592
			do
593
				/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portal
593
				/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portal
594
			done
594
			done
595
		$DIR_DEST_SBIN/alcasar-profil.sh --list
595
		$DIR_DEST_SBIN/alcasar-profil.sh --list
596
	else   # mise à jour des versions < 2.1
596
	else   # mise à jour des versions < 2.1
597
		if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 1 ]))
597
		if [ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 1 ])
598
			then
598
			then
599
			if [ $Lang == "fr" ]
599
			if [ $Lang == "fr" ]
600
			then 
600
			then 
601
				echo "Cette mise à jour nécessite de redéfinir le premier compte d'administration du portail"
601
				echo "Cette mise à jour nécessite de redéfinir le premier compte d'administration du portail"
602
				echo
602
				echo
Line 728... Line 728...
728
##       ces table proviennent de 'dialupadmin' (paquetage freeradius-web)		##
728
##       ces table proviennent de 'dialupadmin' (paquetage freeradius-web)		##
729
##########################################################################################
729
##########################################################################################
730
init_db ()
730
init_db ()
731
{
731
{
732
	mkdir -p /var/lib/mysql/.tmp
732
	mkdir -p /var/lib/mysql/.tmp
733
	chown mysql:mysql /var/lib/mysql/.tmp
733
	chown -R mysql:mysql /var/lib/mysql/
734
	[ -e /etc/my.cnf.rpmnew ] && mv /etc/my.cnf.rpmnew /etc/my.cnf		# prend en compte les migrations de MySQL
734
	[ -e /etc/my.cnf.rpmnew ] && mv /etc/my.cnf.rpmnew /etc/my.cnf		# prend en compte les migrations de MySQL
735
	[ -e /etc/my.cnf.default ] || cp /etc/my.cnf /etc/my.cnf.default
735
	[ -e /etc/my.cnf.default ] || cp /etc/my.cnf /etc/my.cnf.default
736
	$SED "s?^#bind-address.*?bind-address=127.0.0.1?g" /etc/my.cnf
736
	$SED "s?^#bind-address.*?bind-address=127.0.0.1?g" /etc/my.cnf
737
	/etc/init.d/mysqld start
737
	/etc/init.d/mysqld start
738
	sleep 4
738
	sleep 4
Line 1475... Line 1475...
1475
	$SED "s?^smtpd_banner =.*?smtpd_banner = $myhostname ESMTP?g" /etc/postfix/main.cf
1475
	$SED "s?^smtpd_banner =.*?smtpd_banner = $myhostname ESMTP?g" /etc/postfix/main.cf
1476
# sshd écoute côté LAN et WAN
1476
# sshd écoute côté LAN et WAN
1477
	$SED "s?^#ListenAddress 0\.0\.0\.0?ListenAddress $PRIVATE_IP?g" /etc/ssh/sshd_config
1477
	$SED "s?^#ListenAddress 0\.0\.0\.0?ListenAddress $PRIVATE_IP?g" /etc/ssh/sshd_config
1478
	$SED "/^ListenAddress $PRIVATE_IP/a\ListenAddress $PUBLIC_IP" /etc/ssh/sshd_config 
1478
	$SED "/^ListenAddress $PRIVATE_IP/a\ListenAddress $PUBLIC_IP" /etc/ssh/sshd_config 
1479
	# Put the default value in conf file (sshd, QOS and protocols/dns/ are off)(web antivirus is on)
1479
	# Put the default value in conf file (sshd, QOS and protocols/dns/ are off)(web antivirus is on)
1480
	/sbin/chkconfig --del sshd
-
 
1481
	echo "SSH=off" >> $CONF_FILE
1480
	echo "SSH=off" >> $CONF_FILE
1482
	echo 'Admin_from_IP="0.0.0.0/0.0.0.0"' >> $CONF_FILE
1481
	echo 'Admin_from_IP="0.0.0.0/0.0.0.0"' >> $CONF_FILE
1483
	echo "QOS=off" >> $CONF_FILE
1482
	echo "QOS=off" >> $CONF_FILE
1484
	echo "LDAP=off" >> $CONF_FILE
1483
	echo "LDAP=off" >> $CONF_FILE
1485
	echo "LDAP_IP=0.0.0.0/0.0.0.0" >> $CONF_FILE
1484
	echo "LDAP_IP=0.0.0.0/0.0.0.0" >> $CONF_FILE
Line 1612... Line 1611...
1612
# Remove unused services and users
1611
# Remove unused services and users
1613
for old_svc in alsa sound dm
1612
for old_svc in alsa sound dm
1614
do
1613
do
1615
	/sbin/chkconfig --del $old_svc
1614
	/sbin/chkconfig --del $old_svc
1616
done
1615
done
1617
for svc in snmpd
1616
for svc in snmpd.service sshd.service
1618
do
1617
do
1619
	/bin/systemctl -q disable $svc
1618
	/bin/systemctl disable $svc
1620
done
1619
done
1621
for rm_users in avahi-autoipd avahi icapd
1620
for rm_users in avahi-autoipd avahi icapd
1622
do
1621
do
1623
	user=`cat /etc/passwd|grep $rm_users|cut -d":" -f1`
1622
	user=`cat /etc/passwd|grep $rm_users|cut -d":" -f1`
1624
	if [ "$user" == "$rm_users" ]
1623
	if [ "$user" == "$rm_users" ]
Line 1732... Line 1731...
1732
			done
1731
			done
1733
			if [ "$response" = "n" ] || [ "$response" = "N" ] 
1732
			if [ "$response" = "n" ] || [ "$response" = "N" ] 
1734
			then
1733
			then
1735
				rm -f /tmp/alcasar-conf*
1734
				rm -f /tmp/alcasar-conf*
1736
			else
1735
			else
1737
				RUNNING_VERSION=`cat $DIR_WEB/VERSION|cut -d" " -f1`
-
 
1738
				MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
-
 
1739
				MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
-
 
1740
				UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
-
 
1741
# Create a backup of running version importants files
1736
# Create a backup of running version importants files
1742
				chmod u+x $DIR_SCRIPTS/alcasar-conf.sh
1737
				chmod u+x $DIR_SCRIPTS/alcasar-conf.sh
1743
				$DIR_SCRIPTS/alcasar-conf.sh --create
1738
				$DIR_SCRIPTS/alcasar-conf.sh --create
1744
				mode="update"
1739
				mode="update"
1745
			fi
1740
			fi
Line 1750... Line 1745...
1750
		then
1745
		then
1751
			exit 0
1746
			exit 0
1752
		fi
1747
		fi
1753
		if [ -e $DIR_WEB/VERSION ]
1748
		if [ -e $DIR_WEB/VERSION ]
1754
		then
1749
		then
-
 
1750
			RUNNING_VERSION=`cat $DIR_WEB/VERSION|cut -d" " -f1`
-
 
1751
			MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
-
 
1752
			MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
-
 
1753
			UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
1755
# Uninstall the running version
1754
# Uninstall the running version
1756
			$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
1755
			$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
1757
		fi
1756
		fi
1758
# Test if manual update	
1757
# Test if manual update	
1759
		if [ -e /tmp/alcasar-conf.tar.gz ] && [ "$mode" != "update" ]
1758
		if [ -e /tmp/alcasar-conf.tar.gz ] && [ "$mode" != "update" ]