Server script: check if user was on univ-rennes1 network

This commit is contained in:
Jeremy Gardais 2016-05-19 09:53:09 +02:00
parent 23b7b66cf0
commit 607482b5ee
1 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,7 @@ dos2unix ${config_pl_path}
# Liste des informations # Liste des informations
ip=$(grep "# ip:" ${config_pl_path} | cut -d':' -f 2) ip=$(grep "# ip:" ${config_pl_path} | cut -d':' -f 2)
ip_ur1=$(echo ${ip} | cut -d'.' -f1-2)
temp_fqdn=$(host ${ip} | cut -d' ' -f 5) temp_fqdn=$(host ${ip} | cut -d' ' -f 5)
# Remove the last character from $temp_fqdn: '.' # Remove the last character from $temp_fqdn: '.'
fqdn="${temp_fqdn%?}" fqdn="${temp_fqdn%?}"
@ -62,6 +63,11 @@ username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"'
#printf "mail: ${mail}\n" #printf "mail: ${mail}\n"
#printf "username: ${username}\n" #printf "username: ${username}\n"
if [[ ${ip_ur1} != "129.20" ]]; then
printf "La machine cliente n'était pas sur le réseau UR1\n"
exit 1
fi
#### AJOUTER L HÔTE DANS ${BACKUPPC_CONFIG_DIR}/HOSTS #### #### AJOUTER L HÔTE DANS ${BACKUPPC_CONFIG_DIR}/HOSTS ####
# jfade.pr079076.spm.univ-rennes1.fr 0 jfade # jfade.pr079076.spm.univ-rennes1.fr 0 jfade
if [[ ! $(grep "${username}.${hostname}" "${backuppc_host_file}") ]]; then if [[ ! $(grep "${username}.${hostname}" "${backuppc_host_file}") ]]; then