Ticket #133: ldapplugin_tls.patch
| File ldapplugin_tls.patch, 1.7 kB (added by tiziano.mueller@neuronics.ch, 2 years ago) |
|---|
-
ldapplugin-0.10/ldapplugin/model.py
old new 36 36 LDAP_DIRECTORY_PARAMS = [ 'host', 'port', 'basedn', 37 37 'bind_user', 'bind_passwd', 38 38 'groupname', 'groupmember', 39 'groupattr', 'uidattr', 'permattr'] 39 'groupattr', 'uidattr', 'permattr', 40 'start_tls', 'cacertdir', 'cacertfile', 41 'keyfile','certfile'] 40 42 41 43 GROUP_PREFIX = '@' 42 44 … … 511 513 self.bind_user = None 512 514 self.bind_passwd = None 513 515 self.basedn = None 516 self.start_tls = False 517 self.cacertdir = '/etc/ssl/certs' 518 self.cacertfile = '' 519 self.keyfile = '' 520 self.certfile = '' 514 521 for k, v in ldap.items(): 515 522 self.__setattr__(k, v.encode('ascii')) 516 523 if not isinstance(self.port, int): … … 594 601 try: 595 602 self._ds = ldap.initialize('ldap://%s:%d/' % (self.host, self.port)) 596 603 self._ds.protocol_version = ldap.VERSION3 604 self._ds.x_tls_cacertdir = self.cacertdir 605 self._ds.x_tls_cacertfile = self.cacertfile 606 self._ds.x_tls_keyfile = self.keyfile 607 self._ds.x_tls_certfile = self.certfile 608 609 if self.start_tls == 'true': 610 self.log.debug("Starting TLS encryption.") 611 self._ds.start_tls_s() 612 597 613 if self.bind: 598 614 if not self.bind_user: 599 615 raise TracError("Bind enabled but credentials not defined")
