add docs for slapd and dmzrsaccount
This commit is contained in:
13
docs/dmzrsaccount/README.md
Normal file
13
docs/dmzrsaccount/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
install luser.deb
|
||||
change /var/luser/luser/config.ini
|
||||
|
||||
add ldap.krov.dmz.rs to /etc/hosts with the IP address op slapd vm by adding a line like "192.168.1.205 ldap.krov.dmz.rs"
|
||||
|
||||
config.ini should contain following:
|
||||
|
||||
LDAPHOST = ldap.krov.dmz.rs
|
||||
LDAPADMINNAME = cn=admin,dc=dmz,dc=rs
|
||||
LDAPPASS = <admin password set during installation of slapd program and dpkg-reconfigure on slapd vm>
|
||||
USERBASE = ou=Users,dc=dmz,dc=rs
|
||||
|
||||
run prepare.py
|
12
docs/dmzrsaccount/listuserskralizec.py
Executable file
12
docs/dmzrsaccount/listuserskralizec.py
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import ldap3
|
||||
|
||||
LDAPADMINNAME='uid=krovslapd,ou=xmpp,dc=dmz,dc=rs'
|
||||
LDAPPASS='<krovslapd password>'
|
||||
USERATTRIBUTES=['cn' , 'sn', 'givenName', 'uid', 'uidNumber' , 'gidNumber', 'homeDirectory', 'loginShell', 'gecos' , 'shadowLastChange', 'shadowMax', 'userPassword', 'mail']
|
||||
|
||||
|
||||
ldapserver=ldap3.Server('2001:470:1f1a:1a4:0:1:0:1d',use_ssl=True)
|
||||
ldapconnection = ldap3.Connection(ldapserver, LDAPADMINNAME,LDAPPASS, auto_bind=True)
|
||||
ldapconnection.search(search_base=f'ou=xmpp,dc=dmz,dc=rs',search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
||||
print(str(ldapconnection.response))
|
17
docs/dmzrsaccount/listuserskrov.py
Executable file
17
docs/dmzrsaccount/listuserskrov.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
import ldap3
|
||||
import configparser
|
||||
|
||||
CONFIG_PATH = '/var/luser/luser/config.ini'
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
LDAPHOST = config.get('credentials', 'LDAPHOST')
|
||||
LDAPADMINNAME = config.get('credentials', 'LDAPADMINNAME')
|
||||
LDAPPASS = config.get('credentials', 'LDAPPASS')
|
||||
USERBASE = config.get('credentials', 'USERBASE')
|
||||
USERATTRIBUTES=['cn' , 'sn', 'givenName', 'uid', 'uidNumber' , 'gidNumber', 'homeDirectory', 'loginShell', 'gecos' , 'shadowLastChange', 'shadowMax', 'userPassword', 'mail']
|
||||
|
||||
ldapserver=ldap3.Server(LDAPHOST,use_ssl=True)
|
||||
ldapconnection = ldap3.Connection(ldapserver, LDAPADMINNAME,LDAPPASS, auto_bind=True)
|
||||
ldapconnection.search(search_base=f'{USERBASE}',search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
||||
print(str(ldapconnection.response))
|
18
docs/dmzrsaccount/prepare.py
Executable file
18
docs/dmzrsaccount/prepare.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
import ldap3
|
||||
import configparser
|
||||
|
||||
CONFIG_PATH = "/var/luser/luser/config.ini"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
LDAPHOST = config.get('credentials', 'LDAPHOST')
|
||||
LDAPADMINNAME = config.get('credentials', 'LDAPADMINNAME')
|
||||
LDAPPASS = config.get('credentials', 'LDAPPASS')
|
||||
USERBASE = config.get('credentials', 'USERBASE')
|
||||
|
||||
ldapserver=ldap3.Server(LDAPHOST,use_ssl=True)
|
||||
ldapconnection = ldap3.Connection(ldapserver, LDAPADMINNAME, LDAPPASS, auto_bind=True)
|
||||
rcode1=ldapconnection.add(f'{USERBASE}', ['dcObject', 'organization'], {'o' : "dmz", 'dc' : "dmz"})
|
||||
rcode2=ldapconnection.add(USERBASE, ['top', 'organizationalUnit'], {'ou' : "Users"})
|
||||
print(str(rcode1))
|
||||
print(str(rcode2))
|
18
docs/dmzrsaccount/testanon.py
Executable file
18
docs/dmzrsaccount/testanon.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
import ldap3
|
||||
import configparser
|
||||
|
||||
CONFIG_PATH = '/var/luser/luser/config.ini'
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
LDAPHOST = config.get('credentials', 'LDAPHOST')
|
||||
USERBASE = config.get('credentials', 'USERBASE')
|
||||
USERATTRIBUTES=['cn' , 'sn', 'givenName', 'uid', 'uidNumber' , 'gidNumber', 'homeDirectory', 'loginShell', 'gecos' , 'shadowLastChange', 'shadowMax', 'userPassword', 'mail']
|
||||
|
||||
LDAPADMINNAME=''
|
||||
LDAPPASS=""
|
||||
|
||||
ldapserver=ldap3.Server(LDAPHOST,use_ssl=True)
|
||||
ldapconnection = ldap3.Connection(ldapserver, LDAPADMINNAME,LDAPPASS, auto_bind=True)
|
||||
ldapconnection.search(search_base=f'{USERBASE}',search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
||||
print(str(ldapconnection.response))
|
18
docs/dmzrsaccount/testuser.py
Executable file
18
docs/dmzrsaccount/testuser.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
import ldap3
|
||||
import configparser
|
||||
|
||||
CONFIG_PATH = '/var/luser/luser/config.ini'
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
LDAPHOST = config.get('credentials', 'LDAPHOST')
|
||||
USERBASE = config.get('credentials', 'USERBASE')
|
||||
USERATTRIBUTES=['cn' , 'sn', 'givenName', 'uid', 'uidNumber' , 'gidNumber', 'homeDirectory', 'loginShell', 'gecos' , 'shadowLastChange', 'shadowMax', 'userPassword', 'mail']
|
||||
|
||||
LDAPADMINNAME="uid=korisnik,ou=Users,dc=dmz,dc=rs"
|
||||
LDAPPASS="<password of korisnik>"
|
||||
|
||||
ldapserver=ldap3.Server(LDAPHOST,use_ssl=True)
|
||||
ldapconnection = ldap3.Connection(ldapserver, LDAPADMINNAME,LDAPPASS, auto_bind=True)
|
||||
ldapconnection.search(search_base=f'{USERBASE}',search_filter='(objectClass=person)', attributes=USERATTRIBUTES)
|
||||
print(str(ldapconnection.response))
|
Reference in New Issue
Block a user