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.
25 lines
558 B
Python
Executable file
25 lines
558 B
Python
Executable file
#!/usr/bin/python
|
|
|
|
# A wrapper script over ldapvi
|
|
# Requires http://www.lichteblau.com/ldapvi/
|
|
|
|
from os import environ
|
|
from subprocess import run
|
|
from sys import argv
|
|
|
|
|
|
def moduser(username):
|
|
"""Modify an existing user"""
|
|
|
|
if 'EDITOR' not in environ:
|
|
environ['EDITOR'] = 'micro'
|
|
|
|
if username == 'Manager':
|
|
run(['ldapvi', '-y', '/etc/ldappass', '--user', 'cn=Manager,dc=exozy,dc=me'])
|
|
else:
|
|
dn = 'uid=' + username + ',ou=People,dc=exozy,dc=me'
|
|
run(['ldapvi', '--user', dn, '--base', dn])
|
|
|
|
|
|
moduser(argv[1])
|