Пример #1
0
 def __init__(self):
     try:
         cfg = ConfigParser()
         cfg.read('/etc/ldap/netcontrol')
         self.server = cfg.get('base', 'server')
         self.bindDN = cfg.get('base', 'bindDN')
         self.adminPW = cfg.get('base', 'adminPW')
         del cfg
         self.LDAP = netcontrolldap.LDAPConnection(self.server,
                                                   ssl=True,
                                                   admPasswd=self.adminPW,
                                                   baseDN=self.bindDN)
         if not self.LDAP.getGroup("helpdesk"):
             self.LDAP.addGroup("helpdesk")
         self.conn = True
     except:
         self.conn = False
Пример #2
0
from netcontrolldap import netcontrolldap
from pprint import pprint
from ConfigParser import ConfigParser

cfg = ConfigParser()
cfg.read('/etc/ldap/netcontrol')
server = cfg.get('base', 'server')
bindDN = cfg.get('base', 'bindDN')
adminPW = cfg.get('base', 'adminPW')
del cfg

o = netcontrolldap.LDAPConnection(server,
                                  ssl=True,
                                  admPasswd=adminPW,
                                  baseDN=bindDN)

print o.addUser('jeiks', 'Jacson', '123456', createHome=True)
print o.findUser('jeiks')

o.closeConnection()
Пример #3
0
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

from sys import argv, exit

if len(argv) <> 2:
    print 'Informe a maquina'
    exit(1)

from netcontrolldap import netcontrolldap
from pprint import pprint
from ConfigParser import ConfigParser

cfg = ConfigParser()
cfg.read('/etc/ldap/netcontrol')
server = cfg.get('base', 'server')
bindDN = cfg.get('base', 'bindDN')
adminPW = cfg.get('base', 'adminPW')
del cfg

o = netcontrolldap.LDAPConnection('localhost',
                                  ssl=False,
                                  admPasswd=adminPW,
                                  baseDN=bindDN)

print o.addMachine(argv[1])

o.closeConnection()

exit(0)