mirror of https://github.com/jumpserver/jumpserver
modify sudo conn timeout bug
parent
ce8e1e0ae3
commit
f7e70e56e3
|
@ -264,8 +264,10 @@ def unicode2str(unicode_list):
|
|||
|
||||
def sudo_ldap_add(user_group, user_runas, asset_groups_select,
|
||||
cmd_groups_select):
|
||||
if not LDAP_ENABLE:
|
||||
return True
|
||||
if LDAP_ENABLE:
|
||||
ldap_conn = LDAPMgmt(LDAP_HOST_URL, LDAP_BASE_DN, LDAP_ROOT_DN, LDAP_ROOT_PW)
|
||||
else:
|
||||
return
|
||||
|
||||
assets = []
|
||||
cmds = []
|
||||
|
|
|
@ -101,9 +101,6 @@ if LDAP_ENABLE:
|
|||
LDAP_BASE_DN = CONF.get('ldap', 'base_dn')
|
||||
LDAP_ROOT_DN = CONF.get('ldap', 'root_dn')
|
||||
LDAP_ROOT_PW = CONF.get('ldap', 'root_pw')
|
||||
ldap_conn = LDAPMgmt(LDAP_HOST_URL, LDAP_BASE_DN, LDAP_ROOT_DN, LDAP_ROOT_PW)
|
||||
else:
|
||||
ldap_conn = None
|
||||
|
||||
|
||||
def md5_crypt(string):
|
||||
|
|
|
@ -123,6 +123,10 @@ def server_del_user(username):
|
|||
|
||||
|
||||
def ldap_add_user(username, ldap_pwd):
|
||||
if LDAP_ENABLE:
|
||||
ldap_conn = LDAPMgmt(LDAP_HOST_URL, LDAP_BASE_DN, LDAP_ROOT_DN, LDAP_ROOT_PW)
|
||||
else:
|
||||
return
|
||||
user_dn = "uid=%s,ou=People,%s" % (username, LDAP_BASE_DN)
|
||||
password_sha512 = gen_sha512(gen_rand_pwd(6), ldap_pwd)
|
||||
user = User.objects.filter(username=username)
|
||||
|
@ -155,6 +159,10 @@ def ldap_add_user(username, ldap_pwd):
|
|||
|
||||
|
||||
def ldap_del_user(username):
|
||||
if LDAP_ENABLE:
|
||||
ldap_conn = LDAPMgmt(LDAP_HOST_URL, LDAP_BASE_DN, LDAP_ROOT_DN, LDAP_ROOT_PW)
|
||||
else:
|
||||
return
|
||||
user_dn = "uid=%s,ou=People,%s" % (username, LDAP_BASE_DN)
|
||||
group_dn = "cn=%s,ou=Group,%s" % (username, LDAP_BASE_DN)
|
||||
sudo_dn = 'cn=%s,ou=Sudoers,%s' % (username, LDAP_BASE_DN)
|
||||
|
|
Loading…
Reference in New Issue