allow opends to setup ssl/startTLS
| | |
| | | } |
| | | </call> |
| | | |
| | | <!--== Setup product ==--> |
| | | <call function="'SetUpDsWithScript'"> |
| | | { |
| | | 'location' : instance.getHost(), |
| | | 'dsPath' : instance.getInstallDir(), |
| | | 'dsPort' : instance.getLDAPPort(), |
| | | 'dsJmxPort' : instance.getJMXPort(), |
| | | 'dsBindDN' : DIRECTORY_INSTANCE_DN, |
| | | 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD, |
| | | 'dsBaseDN' : suffixDn, |
| | | 'dsDoNotStart' : 'TRUE', |
| | | 'fileFd' : fileFd |
| | | } |
| | | </call> |
| | | |
| | | <!--== Setup product ==--> |
| | | <if expr="instance.isSecurityEnabled() == 'false'"> |
| | | <call function="'SetUpDsWithScript'"> |
| | | { |
| | | 'location' : instance.getHost(), |
| | | 'dsPath' : instance.getInstallDir(), |
| | | 'dsPort' : instance.getLDAPPort(), |
| | | 'dsJmxPort' : instance.getJMXPort(), |
| | | 'dsBindDN' : DIRECTORY_INSTANCE_DN, |
| | | 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD, |
| | | 'dsBaseDN' : suffixDn, |
| | | 'dsDoNotStart' : 'true', |
| | | 'fileFd' : fileFd |
| | | } |
| | | </call> |
| | | <else> |
| | | <call function="'SetUpDsWithScript'"> |
| | | { |
| | | 'location' : instance.getHost(), |
| | | 'dsPath' : instance.getInstallDir(), |
| | | 'dsPort' : instance.getLDAPPort(), |
| | | 'dsSslPort' : instance.getLDAPSPort(), |
| | | 'dsJmxPort' : instance.getJMXPort(), |
| | | 'dsBindDN' : DIRECTORY_INSTANCE_DN, |
| | | 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD, |
| | | 'dsBaseDN' : suffixDn, |
| | | 'dsDoNotStart' : 'true', |
| | | 'dsEnableStartTLS' : instance.isStartTlsEnabled(), |
| | | 'dsCertificate' : instance.getCertificate(), |
| | | 'fileFd' : fileFd |
| | | } |
| | | </call> |
| | | </else> |
| | | </if> |
| | | |
| | | <call function="'writeEndTagStep'">{ 'fileFd' : fileFd}</call> |
| | | |
| | |
| | | class OpendsInstance(Instance): |
| | | "Describes an opends Instance" |
| | | def __init__(self, iid, name, product, role, host, installDir, tarball, \ |
| | | portLDAP, portLDAPS, portJMX, portREPL): |
| | | portLDAP, portLDAPS, portJMX, portREPL, \ |
| | | securityEnabled, certificate, startTlsEnabled): |
| | | # from instance object |
| | | self.iid = iid |
| | | self.name = name |
| | | self.product = product |
| | | self.role = role |
| | | self.host = host |
| | | self.installDir = installDir |
| | | self.tarball = tarball |
| | | self.portLDAP = portLDAP |
| | | self.iid = iid |
| | | self.name = name |
| | | self.product = product |
| | | self.role = role |
| | | self.host = host |
| | | self.installDir = installDir |
| | | self.tarball = tarball |
| | | self.portLDAP = portLDAP |
| | | # specific to opends instance |
| | | self.portLDAPS = portLDAPS |
| | | self.portJMX = portJMX |
| | | self.portREPL = portREPL |
| | | self.javaVersion = NOT_DEFINED |
| | | self.portLDAPS = portLDAPS |
| | | self.portJMX = portJMX |
| | | self.portREPL = portREPL |
| | | self.javaVersion = NOT_DEFINED |
| | | self.securityEnabled = securityEnabled |
| | | self.certificate = certificate |
| | | self.startTlsEnabled = startTlsEnabled |
| | | |
| | | def getLDAPSPort(self): |
| | | return self.portLDAPS |
| | |
| | | |
| | | def setJavaVersion(self,javaVersion): |
| | | self.javaVersion = javaVersion |
| | | |
| | | |
| | | def isSecurityEnabled(self): |
| | | return self.securityEnabled |
| | | |
| | | def getCertificate(self): |
| | | return self.certificate |
| | | |
| | | def isStartTlsEnabled(self): |
| | | return self.startTlsEnabled |
| | | |
| | | |
| | | # |
| | |
| | | # Parse children and get information for opends instance |
| | | # |
| | | def parseOpenDs(cId,cName,cProduct,cRole,opendsName,opendsZip,thisChild): |
| | | msg = '' |
| | | cHost = 'localhost' |
| | | cInstallDir = NOT_DEFINED |
| | | cPortLDAP = '1389' |
| | | cPortLDAPS = '1636' |
| | | cPortJMX = '1390' |
| | | cPortREPL = '1391' |
| | | msg = '' |
| | | cHost = 'localhost' |
| | | cInstallDir = NOT_DEFINED |
| | | cPortLDAP = '1389' |
| | | cPortLDAPS = '1636' |
| | | cPortJMX = '1390' |
| | | cPortREPL = '1391' |
| | | cSecurityEnabled = 'false' |
| | | cCertificate = NOT_DEFINED |
| | | cStartTlsEnabled = 'false' |
| | | |
| | | # |
| | | # Parsing second level : host,ports,... |
| | |
| | | else: |
| | | msg = '%s\n ERROR: instance %s : unknown port node name %s' % \ |
| | | (msg, cName, thisPort.getNodeName()) |
| | | |
| | | |
| | | elif (thisSubChild.getNodeType() == Node.ELEMENT_NODE and |
| | | thisSubChild.getNodeName() == 'security'): |
| | | |
| | | cSecurityEnabled = _getAttributeNode(thisSubChild,'enabled') |
| | | cCertificate = _getAttributeNode(thisSubChild,'certificate') |
| | | cStartTlsEnabled = _getAttributeNode(thisSubChild,'startTlsEnabled') |
| | | |
| | | |
| | | # must be at the end of the if case |
| | | elif (thisSubChild.getNodeType() == Node.TEXT_NODE or |
| | |
| | | cInstallDir = '%s/%s/%s' % (cInstallDir,cName,opendsName) |
| | | return [msg,OpendsInstance(cId,cName,cProduct,cRole,cHost,cInstallDir,\ |
| | | opendsZip,\ |
| | | cPortLDAP,cPortLDAPS,cPortJMX,cPortREPL)] |
| | | cPortLDAP,cPortLDAPS,cPortJMX,cPortREPL,\ |
| | | cSecurityEnabled,cCertificate,cStartTlsEnabled)] |
| | | |
| | | |
| | | #============================================================================ |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Port number"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsSslPort" type="optional"> |
| | | <function-arg-description> |
| | | Directory server secure port number |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Port number"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsJmxPort" type="optional"> |
| | | <function-arg-description> |
| | | Directory server JMX port number |
| | |
| | | Help option |
| | | </function-arg-description> |
| | | <function-arg-property name="help" value="option"/> |
| | | </function-arg-def> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsEnableStartTLS" type="optional" |
| | | default="'false'"> |
| | | <function-arg-description> |
| | | Enable startTLS, must use dsCertifiacte parameter |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="boolean"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsCertificate" type="optional"> |
| | | <function-arg-description> |
| | | certificate mode: selfsigned,Pkcs11keyStore,Pkcs12keyStore, |
| | | JavakeyStore, |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | |
| | | <function-arg-def name="fileFd" type="required"> |
| | | <function-arg-description> |
| | | output file descriptor |
| | |
| | | if dsPort: |
| | | STAFCmdParamsList.append('-p %s' % dsPort) |
| | | |
| | | if dsSslPort: |
| | | STAFCmdParamsList.append('-Z %s' % dsSslPort) |
| | | |
| | | if dsJmxPort: |
| | | STAFCmdParamsList.append('-x %s' % dsJmxPort) |
| | | |
| | |
| | | |
| | | if dsHelp: |
| | | STAFCmdParamsList.append('-H') |
| | | |
| | | |
| | | if dsEnableStartTLS: |
| | | dsEnableStartTLS = dsEnableStartTLS.lower() |
| | | if dsEnableStartTLS == 'true': |
| | | STAFCmdParamsList.append('--enableStartTLS') |
| | | |
| | | if dsCertificate: |
| | | dsCertificate = dsCertificate.lower() |
| | | if dsCertificate == 'selfsigned': |
| | | STAFCmdParamsList.append('--generateSelfSignedCertificate') |
| | | elif dsCertificate == 'pkcs11keystore': |
| | | STAFCmdParamsList.append('--usePkcs11Keystore') |
| | | elif dsCertificate == 'pkcs12keystore': |
| | | STAFCmdParamsList.append('--usePkcs12keyStore') |
| | | elif dsCertificate == 'javakeystore': |
| | | STAFCmdParamsList.append('--useJavaKeystore') |
| | | |
| | | STAFCmdParams=' '.join(STAFCmdParamsList) |
| | | </script> |
| | | |
| | |
| | | <if expr="STAFCmdExist == TRUE"> |
| | | <sequence> |
| | | <call function="'writeMessage'"> |
| | | { 'content' : 'Running cmd: %s %s ' % (command,arguments), |
| | | { 'content' : 'Running cmd: %s %s' % (command,arguments), |
| | | 'fileFd' : fileFd } |
| | | </call> |
| | | |
| | |
| | | <!ELEMENT domain (#PCDATA)> |
| | | |
| | | <!-- ========== INSTANCE NODE ========================= --> |
| | | <!ELEMENT instance (host,installDir,ports?)> |
| | | <!ELEMENT instance (host,installDir,ports?,security?)> |
| | | <!ATTLIST instance |
| | | name NMTOKEN #REQUIRED |
| | | product NMTOKEN #REQUIRED |
| | |
| | | <!ELEMENT ldaps (#PCDATA)> |
| | | <!ELEMENT jmx (#PCDATA)> |
| | | <!ELEMENT replicationServer (#PCDATA)> |
| | | <!ELEMENT security EMPTY> |
| | | <!ATTLIST security |
| | | enabled ( true | false ) "true" |
| | | certificate ( selfSigned | Pkcs11keyStore | Pkcs12keyStore |
| | | | JavakeyStore ) "selfSigned" |
| | | startTlsEnabled ( true | false) "false"> |
| | | |
| | | |
| | | <!-- ========== SUFFIX NODE ========================= --> |