Line 1... |
Line 1... |
1 |
#/bin/sh
|
1 |
#/bin/sh
|
2 |
# $Id: alcasar-conf.sh 634 2011-06-13 17:23:46Z richard $
|
2 |
# $Id: alcasar-conf.sh 636 2011-06-15 22:29:07Z richard $
|
3 |
# $Author: richard $
|
3 |
# $Author: richard $
|
4 |
# by rexy
|
4 |
# by rexy
|
5 |
# Ce script permet de créer ou de charger l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
5 |
# Ce script permet de créer ou de charger l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
6 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
6 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
7 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
7 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
Line 74... |
Line 74... |
74 |
cp -rf /etc/dansguardian/lists/blacklists/ossi $DIR_UPDATE
|
74 |
cp -rf /etc/dansguardian/lists/blacklists/ossi $DIR_UPDATE
|
75 |
# sauvegarde des fichiers : de conf, de filtrage, d'exception, digest, etc.
|
75 |
# sauvegarde des fichiers : de conf, de filtrage, d'exception, digest, etc.
|
76 |
mkdir $DIR_UPDATE/etc/
|
76 |
mkdir $DIR_UPDATE/etc/
|
77 |
cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
|
77 |
cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
|
78 |
# particularité des versions
|
78 |
# particularité des versions
|
79 |
# si version < 2.1
|
79 |
# si version <= 2.0
|
80 |
if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 1 ]))
|
80 |
if [ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -eq 0 ])
|
81 |
then
|
81 |
then
|
82 |
rm -f $DIR_UPDATE/etc/alcasar-dns-name # changement de format
|
82 |
rm -f $DIR_UPDATE/etc/alcasar-dns-name # changement de format
|
83 |
rm -f $DIR_UPDATE/etc/alcasar-macallowed # ajout d'un commentaire par @MAC
|
83 |
rm -f $DIR_UPDATE/etc/alcasar-macallowed # ajout d'un commentaire par @MAC
|
84 |
rm -rf $DIR_UPDATE/etc/digest # hostname=alcasar
|
84 |
rm -rf $DIR_UPDATE/etc/digest # hostname=alcasar
|
85 |
uamallowed = `cat $DIR_UPDATE/etc/alcasar-uamallowed`
|
85 |
uamallowed = `cat $DIR_UPDATE/etc/alcasar-uamallowed`
|
Line 98... |
Line 98... |
98 |
cp -f /etc/pki/tls/private/alcasar.key $DIR_UPDATE
|
98 |
cp -f /etc/pki/tls/private/alcasar.key $DIR_UPDATE
|
99 |
cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
|
99 |
cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
|
100 |
cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
|
100 |
cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
|
101 |
fi
|
101 |
fi
|
102 |
# si version < 2.2
|
102 |
# si version < 2.2
|
103 |
if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 2 ]))
|
103 |
if [ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 2 ])
|
104 |
then
|
104 |
then
|
105 |
ORGANISM=`cat /root/ALCASAR-parameters.txt|grep Organism|cut -d":" -f2|tr -d " "` # Sauvegarde du nom d'organisme
|
105 |
ORGANISM=`cat $DIR_WEB/intercept.php|grep '$organisme =' | cut -d"=" -f2|tr -d ";\" "` # Sauvegarde du nom d'organisme
|
106 |
rm -f $DIR_UPDATE/etc/alcasar-ethers # This file doesn't contain comments
|
106 |
rm -f $DIR_UPDATE/etc/alcasar-ethers # This file doesn't contain comments
|
107 |
# Create the initial conf file (doesn't exist in earlier versions)
|
107 |
# Create the initial conf file (doesn't exist in earlier versions)
|
108 |
cat <<EOF > $CONF_FILE
|
108 |
cat <<EOF > $CONF_FILE
|
109 |
##########################################
|
109 |
##########################################
|
110 |
## ##
|
110 |
## ##
|
Line 114... |
Line 114... |
114 |
|
114 |
|
115 |
INSTALL_DATE=$DATE
|
115 |
INSTALL_DATE=$DATE
|
116 |
VERSION=$RUNNING_VERSION
|
116 |
VERSION=$RUNNING_VERSION
|
117 |
ORGANISM=$ORGANISM
|
117 |
ORGANISM=$ORGANISM
|
118 |
EOF
|
118 |
EOF
|
119 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` # @ip du portail (côté Internet)
|
119 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` # @ip du portail (côté Internet)
|
120 |
PUBLIC_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
120 |
PUBLIC_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
121 |
PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
121 |
PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
122 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
122 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
123 |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS
|
123 |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS
|
124 |
DNS2=`grep DNS2 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 2ème DNS
|
124 |
DNS2=`grep DNS2 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 2ème DNS
|
125 |
DNS1=${DNS1:=208.67.220.220}
|
125 |
DNS1=${DNS1:=208.67.220.220}
|
126 |
DNS2=${DNS2:=208.67.222.222}
|
126 |
DNS2=${DNS2:=208.67.222.222}
|
127 |
PRIVATE_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2` # @ip du portail (côté LAN)
|
127 |
PRIVATE_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2` # @ip du portail (côté LAN)
|
128 |
PRIVATE_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2`
|
128 |
PRIVATE_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2`
|
129 |
private_network_calc
|
129 |
private_network_calc
|
130 |
echo "PUBLIC_IP=$PUBLIC_IP/$PUBLIC_PREFIX" >> $CONF_FILE
|
130 |
echo "PUBLIC_IP=$PUBLIC_IP/$PUBLIC_PREFIX" >> $CONF_FILE
|
131 |
echo "GW=$PUBLIC_GATEWAY" >> $CONF_FILE
|
131 |
echo "GW=$PUBLIC_GATEWAY" >> $CONF_FILE
|
132 |
echo "DNS1=$DNS1" >> $CONF_FILE
|
132 |
echo "DNS1=$DNS1" >> $CONF_FILE
|
133 |
echo "DNS2=$DNS2" >> $CONF_FILE
|
133 |
echo "DNS2=$DNS2" >> $CONF_FILE
|
134 |
echo "PRIVATE_IP=$PRIVATE_IP/$PRIVATE_PREFIX" >> $CONF_FILE
|
134 |
echo "PRIVATE_IP=$PRIVATE_IP/$PRIVATE_PREFIX" >> $CONF_FILE
|
135 |
echo "DHCP=on" >> $CONF_FILE
|
135 |
echo "DHCP=on" >> $CONF_FILE
|
136 |
if [ -r /var/run/sshd.pid ]; then
|
136 |
if [ -r /var/run/sshd.pid ]; then
|
137 |
echo "SSH=on" >> $CONF_FILE
|
137 |
echo "SSH=on" >> $CONF_FILE
|
138 |
else
|
138 |
else
|
139 |
echo "SSH=off" >> $CONF_FILE
|
139 |
echo "SSH=off" >> $CONF_FILE
|
140 |
fi
|
140 |
fi
|
141 |
echo "QOS=off" >> $CONF_FILE
|
141 |
echo "QOS=off" >> $CONF_FILE
|
142 |
if [ `grep ^ldap /etc/raddb/sites-available/alcasar | wc -l` -eq "0" ]; then
|
142 |
if [ `grep ^ldap /etc/raddb/sites-available/alcasar | wc -l` -eq "0" ]; then
|
143 |
echo "LDAP=off" >> $CONF_FILE
|
143 |
echo "LDAP=off" >> $CONF_FILE
|
144 |
else
|
144 |
else
|
145 |
echo "LDAP=on" >> $CONF_FILE
|
145 |
echo "LDAP=on" >> $CONF_FILE
|
146 |
fi
|
146 |
fi
|
147 |
echo "PROTOCOLS_FILTERING=off" >> $CONF_FILE
|
147 |
echo "PROTOCOLS_FILTERING=off" >> $CONF_FILE
|
148 |
echo "DNS_FILTERING=off" >> $CONF_FILE
|
148 |
echo "DNS_FILTERING=off" >> $CONF_FILE
|
149 |
echo "WEB_ANTIVIRUS=on" >> $CONF_FILE
|
149 |
echo "WEB_ANTIVIRUS=on" >> $CONF_FILE
|
- |
|
150 |
cp $CONF_FILE $DIR_UPDATE/etc/
|
150 |
fi
|
151 |
fi
|
151 |
cp $CONF_FILE $DIR_UPDATE/etc/
|
- |
|
152 |
# création de l'archive
|
152 |
# création de l'archive
|
153 |
cd /tmp
|
153 |
cd /tmp
|
154 |
tar -cf alcasar-conf.tar conf/
|
154 |
tar -cf alcasar-conf.tar conf/
|
155 |
gzip -f alcasar-conf.tar
|
155 |
gzip -f alcasar-conf.tar
|
156 |
rm -rf $DIR_UPDATE
|
156 |
rm -rf $DIR_UPDATE
|