Anthony Wang
f66983313f
This ensures the LDAP password doesn't show up in process table. I was an idiot when I wrote the original code.
21 lines
456 B
Python
Executable file
21 lines
456 B
Python
Executable file
#!/usr/bin/python
|
|
|
|
# A wrapper script over ldapdelete
|
|
|
|
from subprocess import run
|
|
from sys import argv
|
|
|
|
|
|
def deluser(username):
|
|
"""Delete a user"""
|
|
|
|
# Delete from LDAP server
|
|
run(['ldapdelete', '-y', '/etc/ldappass', '-D', 'cn=Manager,dc=exozy,dc=me',
|
|
'uid=' + username + ',ou=People,dc=exozy,dc=me', 'cn=' + username + ',ou=Group,dc=exozy,dc=me'])
|
|
|
|
# Cleanup
|
|
run(['sudo', 'rm', '-rf', '/home/' + username])
|
|
|
|
|
|
deluser(argv[1])
|