From 607482b5ee7cb528968046f1d0825c1ffcc22931 Mon Sep 17 00:00:00 2001 From: GARDAIS Jeremy Date: Thu, 19 May 2016 09:53:09 +0200 Subject: [PATCH] Server script: check if user was on univ-rennes1 network --- server/add_backuppc_host.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/add_backuppc_host.sh b/server/add_backuppc_host.sh index fabd619..a5cf4c8 100755 --- a/server/add_backuppc_host.sh +++ b/server/add_backuppc_host.sh @@ -48,6 +48,7 @@ dos2unix ${config_pl_path} # Liste des informations 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) # Remove the last character from $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 "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 #### # jfade.pr079076.spm.univ-rennes1.fr 0 jfade if [[ ! $(grep "${username}.${hostname}" "${backuppc_host_file}") ]]; then