encrypted LDAP password

0

Hi All,

so i need to encrypt my LDAP password. i follow this 

https://community.jaspersoft.com/documentation/tibco-jasperreports-server-security-guide/v720/encrypting-passwords-configuration

step i did :

1. install jasperreport

2. add modified ldap-mt.xml

3. edit default_master.properties, add LDAP url, dn and password

4. add encrypted=true to the file

5. run 'js-install minimal' (i dnt want sample files)

6. stop service and start again

 

then i got error in log

2019-08-13 13:17:18,873 ERROR ContextLoader,localhost-startStop-2:331 - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'ldapContextSource' defined in ServletContext resource [/WEB-INF/applicationContext-externalAuth-LDAP-mt.xml]: Could not resolve placeholder 'external.ldapDn' in string value "${external.ldapDn}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'external.ldapDn' in string value "${external.ldapDn}"
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
    at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:223)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:696)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:671)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1071)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1721)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'external.ldapDn' in string value "${external.ldapDn}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:173)
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:161)
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125)
    at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:204)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:206)
    ... 21 more

 

tried to move password and other ldap setting to 'js.externalAuth.properties' from 'default_master.properties' then this error show up

2019-08-13 17:22:15,425 ERROR ContextLoader,localhost-startStop-2:331 - Context initialization failed
java.lang.RuntimeException: KeystoreManager.init was never called or there are errors instantiating an instance.
    at com.jaspersoft.jasperserver.crypto.KeystoreManager.getInstance(KeystoreManager.java:186)
    at com.jaspersoft.jasperserver.api.common.properties.DecryptingPropertyPlaceholderConfigurer.convertPropertyValue(DecryptingPropertyPlaceholderConfigurer.java:65)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperty(PropertyResourceConfigurer.java:121)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperties(PropertyResourceConfigurer.java:104)
    at com.jaspersoft.jasperserver.api.common.properties.DecryptingPropertyPlaceholderConfigurer.convertProperties(DecryptingPropertyPlaceholderConfigurer.java:38)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:81)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:696)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:671)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1071)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1721)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

tried to edit the start service to add 

-Duser.home=c:\Users\<TomcatUser>

but cant add it in the service properties

 

not smooth as the documentation says, pls anyone have any idea to fix this?

info :

-using windows 10

-jasperserver-pro 6.2.1

-installer bundled with tomcat etc

 

regards,

TV

trvpseudo's picture
Joined: Jan 30 2019 - 11:02pm
Last seen: 13 hours 12 min ago

1 Answer:

0

If you somehow experience the same problem, here are steps i did from the start :

1. isntall jasperreport server (mine is 6.2.1 windows)

2. setup your LDAP path and uid in the xml, then put it in \web-inf :: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-authentication-cookbook/v601/setting-ldap-connection

3. input your plain text LDAP password in buildomatic\default_master.properties, add "encrypt=true" and "propsToEncrypt=external.ldap.password" :: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-security-guide/v62/encrypting-passwords-configuration-files

4. save file and open cmd, cd to buildomatic (or type cmd in buildomatic)

5. execute "js-ant refresh-config"

6. copy encrypted password in "default_master.properties" and paste it in "web-inf\js.externalAuth.properties"

7. restart the application

 

maybe following the steps cause :

1. "default_master.properties" cant be opened : use your pc admin user to open it or make a copy of it and delete the old one, then rename it to be the same as the one you delete.

2. "js-ant refresh-config" build failed : delete \build_conf\default manually, then execute again

3. "js.externalAuth.properties" cant be opened : make a copy of it and delete the old one, then rename it to be the same as the one you delete.

 

if you get error keystore init :

1. open  "apache-tomcat\bin"

2. run as admin "jasperreportTomcatw.exe" (or similar to it with, notice the "w")

3. open java tab and add your users :: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-security-guide/v62/encrypting-passwords-configuration-files

4. restart jasper again

 

it works for me after weeks of exploring and experiment and reinstall the app

hopefully this will be complete guide for you and save you maany many hours :D

 

regards,

TV

trvpseudo's picture
Joined: Jan 30 2019 - 11:02pm
Last seen: 13 hours 12 min ago
Feedback