diff --git a/gestion/chgpass.py b/gestion/chgpass.py index 17634735..97caed91 100755 --- a/gestion/chgpass.py +++ b/gestion/chgpass.py @@ -22,12 +22,9 @@ import getpass, commands, os, sys, base64, syslog from user_tests import getuser, isadm from affich_tools import cprint -try : - sys.path.append('/usr/scripts/gestion/secrets') - from secrets import ldap_password, ldap_auth_dn -except : - ldap_password = '' - ldap_auth_dn = '' +import secrets_new as secrets +ldap_password = secrets.get("ldap_password") +ldap_auth_dn = secrets.get("ldap_auth_dn") uri = 'ldap://ldap.adm.crans.org' syslog.openlog('chgpass',syslog.LOG_PID,syslog.LOG_AUTH) diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 77e3a1cd..48a90652 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -25,6 +25,7 @@ from email_tools import send_email from syslog import openlog, closelog, syslog from numeros_disponibles import lister_ip_dispo from unicodedata import normalize +import secrets_new as secrets import ridtools date_format = '%d/%m/%Y %H:%M' @@ -63,8 +64,8 @@ elif hostname in test_hosts: # avec le secret try: - sys.path.append('/usr/scripts/gestion/secrets') - from secrets import ldap_password, ldap_auth_dn + ldap_auth_dn = secrets.get('ldap_auth_dn') + ldap_password = secrets.get('ldap_password') except: sys.stdout.write(coul('Warning : impossible de lire le fichier de secret !\n', 'jaune')) sys.exit(1) @@ -80,8 +81,8 @@ else: # avec le secret try: - sys.path.append('/usr/scripts/gestion/secrets') - from secrets import ldap_password, ldap_auth_dn + ldap_auth_dn = secrets.get('ldap_auth_dn') + ldap_password = secrets.get('ldap_password') except: sys.stdout.write(coul('Warning : impossible de lire le fichier de secret !\n', 'jaune')) sys.exit(1)