Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 612 → Rev 613

/alcasar.sh
203,7 → 203,7
else echo -n "Enter the name of your organism : "
fi
read ORGANISME
if [ "$ORGANISME" = "" ]
if [ "$ORGANISME" == "" ]
then
ORGANISME=!
fi
499,29 → 499,30
header_install
if [ "$mode" = "install" ]
then
header_install
if [ $Lang == "fr" ]
then
echo "Pour administrer Alcasar via le centre de gestion WEB, trois profils de comptes ont été définis :"
echo " - le profil 'admin' capable de réaliser toutes les opérations"
echo " - le profil 'backup' lié uniquement aux fonctions d'archivage"
echo " - le profil 'manager' lié uniquement aux fonctions de gestion des usagers"
echo ""
echo "Définissez le premier compte du profil 'admin' :"
echo
echo -n "Nom : "
else
echo "To manage Alcasar thru the WEB control center, three accounts profiles were defined :"
echo " - the 'admin profile who can do all operations"
echo " - the 'backup' profile link to backup functions"
echo " - the 'manager' profile link to users management"
echo ""
echo "Define the first account of the 'admin' profile :"
echo
echo -n "Account : "
fi
read admin_portail
echo "- Name of the first account of the admin profile : $admin_portail" >> $FIC_PARAM
admin_portal=!
PTN='^[a-zA-Z0-9-]*$'
until [[ $(expr $admin_portal : $PTN) -gt 0 ]]
do
header_install
if [ $Lang == "fr" ]
then
echo ""
echo "Définissez un premier compte d'administration du portail :"
echo
echo -n "Nom : "
else
echo ""
echo "Define the first account allow to administrate the portal :"
echo
echo -n "Account : "
fi
read admin_portal
if [ "$admin_portal" == "" ]
then
admin_portal=!
fi
done
echo "- Name of the first account of the admin profile : $admin_portal" >> $FIC_PARAM
# Création du fichier de clés de ce compte dans le profil "admin"
[ -d $DIR_DEST_ETC/digest ] && rm -rf $DIR_DEST_ETC/digest
mkdir -p $DIR_DEST_ETC/digest
528,23 → 529,30
chmod 755 $DIR_DEST_ETC/digest
until [ -s $DIR_DEST_ETC/digest/key_admin ]
do
/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portail
/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portal
done
$DIR_DEST_SBIN/alcasar-profil.sh --list
else # mise à jour des versions < 2.1
if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 1 ]))
then
echo "Cette mise à jour nécessite de redéfinir le premier compte d'administration du portail"
echo
echo -n "Nom : "
read admin_portail
echo "- Name of the first user of admin profile : $admin_portail" >> $FIC_PARAM
if [ $Lang == "fr" ]
then
echo "Cette mise à jour nécessite de redéfinir le premier compte d'administration du portail"
echo
echo -n "Nom : "
else
echo "This update need to redefine the first admin account"
echo
echo -n "Account : "
fi
read admin_portal
echo "- Name of the first account of the admin profile : $admin_portal" >> $FIC_PARAM
[ -d $DIR_DEST_ETC/digest ] && rm -rf $DIR_DEST_ETC/digest
mkdir -p $DIR_DEST_ETC/digest
chmod 755 $DIR_DEST_ETC/digest
until [ -s $DIR_DEST_ETC/digest/key_admin ]
do
/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portail
/usr/sbin/htdigest -c $DIR_DEST_ETC/digest/key_admin $HOSTNAME $admin_portal
done
$DIR_DEST_SBIN/alcasar-profil.sh --list
fi
842,9 → 850,7
# création du fichier d'allocation d'adresses IP statiques
touch $DIR_DEST_ETC/alcasar-ethers
# création des fichiers de sites, d'urls et d'adresses MAC de confiance
echo -e "uamallowed=\"\"" > $DIR_DEST_ETC/alcasar-uamallowed
echo -e "uamdomain=\"\"" > $DIR_DEST_ETC/alcasar-uamdomain
touch $DIR_DEST_ETC/alcasar-macallowed
touch $DIR_DEST_ETC/alcasar-macallowed $DIR_DEST_ETC/alcasar-uamallowed $DIR_DEST_ETC/alcasar-uamdomain
chown root:apache $DIR_DEST_ETC/alcasar-*
chmod 660 $DIR_DEST_ETC/alcasar-*
echo "- User disconnect URL : http://alcasar:3990/logoff" >> $FIC_PARAM
/scripts/sbin/alcasar-mysql.sh
2,16 → 2,21
# $Id$
 
## Script de sauvegarde de la base MySQL 'radius' (by rexy)
LANG="fr_FR@euro" # choix de la langue
rep_tr="/var/Save/base" # répertoire d'accueil des sauvegardes
ext="sql" # extension des fichiers de sauvegarde
DB_RADIUS="db_radius" # nom de la base
DB_USER="db_user" # nom d'utilisateur mysql (base des usagers)
radiuspwd="radius_pwd" # mot de passe d'accès
DB_RADIUS="db_radius"
DB_USER="db_user"
radiuspwd="radius_pwd"
new="$(date +%F-%Hh%M)" # date et heure des fichiers
fichier="$DB_RADIUS-$new.$ext" # nom du fichier de sauvegarde
 
usage="Usage: alcasar-mysql.sh { -dump or --dump } | { -import or --import } | { -raz or --raz }"
stop_acct ()
{
date_now=`date "+%F %X"`
echo "UPDATE radacct SET acctstoptime = '$date_now', acctterminatecause = 'Admin-Reset' WHERE acctstoptime IS NULL" | mysql -u$DB_USER -p$radiuspwd $DB_RADIUS
 
}
usage="Usage: alcasar-mysql.sh { -dump or --dump } | { -import or --import } | { -raz or --raz } | { -acct_stop }"
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
39,8 → 44,8
echo "Entrez le nom d'un fichier SQL (.sql)"
exit 0
else
mysql -u $DB_USER -p$radiuspwd < $2
mysql -u $DB_USER -p$radiuspwd < $2
stop_acct
fi
;;
-raz | --raz)
47,6 → 52,9
mysqldump -u $DB_USER -p$radiuspwd --opt -BcQC $DB_RADIUS > $rep_tr/$fichier && \
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < /etc/raddb/radiusd-db-vierge.sql
;;
-acct_stop)
stop_acct
;;
*)
echo "Argument inconnu :$1";
echo "$usage"
/web/acc/manager/htdocs/clear_opensessions.php
70,11 → 70,13
# close active sessions
exec ("sudo /usr/local/sbin/alcasar-logout.sh $login");
# delete open accounting sessions
$now = time();
$today_now = date("Y-m-d H:i:s",$now);
$link = @da_sql_pconnect($config);
if ($link)
{
$res = @da_sql_query($link,$config,
"DELETE FROM $config[sql_accounting_table]
"UPDATE $config[sql_accounting_table] SET acctstoptime = '$today_now', acctterminatecause='Admin-Reset'
WHERE username='$login' AND acctstoptime IS NULL;");
if (! $res)
echo "<b>Error deleting open sessions for user" . da_sql_error($link,$config) . "</b><br>\n";