Browse Source

Base64 password

Simon Fonteneau 2 months ago
parent
commit
6cfc74e194
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      README.md
  2. 2
    2
      libsyncpassword.py

+ 1
- 1
README.md View File

@@ -30,7 +30,7 @@ Installation
30 30
 
31 31
 	Note :
32 32
 
33
-	- The script gets the different arguments in this way:    script.sh samaccountname password  mail
33
+	- The script gets the different arguments in this way:    script.sh samaccountname password  mail  (password encode in base64)
34 34
 	- replace_domain : This makes it possible to replace the domain of the email field with another domain (that of the domain field of the configuration file)
35 35
 
36 36
 

+ 2
- 2
libsyncpassword.py View File

@@ -5,7 +5,7 @@ import json
5 5
 import syslog
6 6
 import time
7 7
 import binascii
8
-import subprocess
8
+import base64
9 9
 from samba.auth import system_session
10 10
 from samba.credentials import Credentials
11 11
 from samba.param import LoadParm
@@ -45,7 +45,7 @@ userAccountControl: %s
45 45
 def update_password(mail,pwd,uac,dn,sama,samdb_loc):
46 46
     script = config.get('common', 'external_script_password')
47 47
     try:
48
-        subprocess.check_output('%s %s %s %s' % (script,sama,pwd,mail),shell=True)
48
+        subprocess.check_output('echo "%s" | %s %s %s' % (script,pwd.encode('base64'),sama,mail),shell=True)
49 49
         syslog.syslog(syslog.LOG_WARNING, '[NOTICE] Updated password for %s' % mail)
50 50
         disable_clear_password(pwd,uac,dn,sama,samdb_loc)
51 51
     except Exception as e:

Loading…
Cancel
Save