Add a specific ssh user for Windows DSI computer.

See bugzilla 1956.
This commit is contained in:
Jeremy Gardais 2017-11-21 18:03:43 +01:00
parent 2d4901769e
commit bea48dcbd0
1 changed files with 14 additions and 6 deletions

View File

@ -56,6 +56,7 @@ hostname=$(echo ${fqdn} | cut -d'.' -f1)
mail=$(grep "# mail:" ${config_pl_path} | cut -d':' -f 2) mail=$(grep "# mail:" ${config_pl_path} | cut -d':' -f 2)
mail_ur1=$(echo ${mail} | cut -d'@' -f2) mail_ur1=$(echo ${mail} | cut -d'@' -f2)
username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"')' -b "dc=univ-rennes1,dc=fr" -x uid | grep "^uid" | cut -d" " -f2) username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"')' -b "dc=univ-rennes1,dc=fr" -x uid | grep "^uid" | cut -d" " -f2)
backup_username=$(grep "# username:" ${config_pl_path} | cut -d':' -f 2)
#printf "IP: ${ip}\n" #printf "IP: ${ip}\n"
#printf "temp_fqdn ${temp_fqdn}\n" #printf "temp_fqdn ${temp_fqdn}\n"
@ -63,6 +64,7 @@ username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"'
#printf "hostname ${hostname}\n" #printf "hostname ${hostname}\n"
#printf "mail: ${mail}\n" #printf "mail: ${mail}\n"
#printf "username: ${username}\n" #printf "username: ${username}\n"
#printf "backup_username: ${backup_username}\n"
#### TESTS #### #### TESTS ####
# Check IP # Check IP
@ -107,17 +109,23 @@ fi
# Host jfade.pr079076 # Host jfade.pr079076
# hostname pr079076.spm.univ-rennes1.fr # hostname pr079076.spm.univ-rennes1.fr
if [[ ! $(grep "${username}.${hostname}" "${backuppc_ssh_config_file}") ]]; then if [[ ! $(grep "${username}.${hostname}" "${backuppc_ssh_config_file}") ]]; then
cat << EOF >> "${backuppc_ssh_config_file}" cat << EOF >> "${backuppc_ssh_config_file}"
Host ${username}.${hostname} Host ${username}.${hostname}
hostname ${fqdn} hostname ${fqdn}
EOF
# Pour une machine Windows DSI, backup_user particulier
if [[ ${backup_username} ]]; then
cat << EOF >> "${backuppc_ssh_config_file}"
user "${backup_username}"
EOF EOF
#cat << EOF else
#WRITE TO "${backuppc_ssh_config_file}": cat << EOF >> "${backuppc_ssh_config_file}"
#Host ${username}.${hostname}
#hostname ${fqdn} EOF
fi
#EOF
fi fi
#### DÉFINIR LE NOM D'HOTE POUR LE SYSTEME #### #### DÉFINIR LE NOM D'HOTE POUR LE SYSTEME ####