Linux Ubuntu: importing the server certififcate, no keytool command?

This question is in reference to Atlassian Documentation: Configuring an SSL Connection to Active Directory

 

This question is in reference to Atlassian Documentation: Configuring an SSL Connection to Active Directory
Hello Community,
I have a problem to connect confluence to our Microsoft AD Server with write/read option via SSL (LDAPS). Every time I try to do a quick test, after enabling the option "Use SSL" in the "Configure LDAP User Directory" Dialog with "Read/Write"-Permission, i get the following message after pressing the "Quick Test"-Button:

##############
Connection test failed. Response from the server:
ad1.domain.com:636; nested exception is javax.naming.CommunicationException: ad1.domain.com:636 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
##############

Without the ssl-option the test passes. At the moment (without enabled ssl option) it is possible for us to login via Windows AD login credentials into confluence. But we want the ability to change the windows AD user password via confluence. So I think the ssl connection is required for this intentions.

So what is the problem? What do i have to change?

I've tried to import our ad1-Server-Cert (filename ad1.crt) on our confluence server (actual Ubuntu Linux 64-bit edition) and followed the manual Configuring an SSL Connection to Active Directory but for me it is not possible to import our ad1-Serer-Cert. After trying the command "sudo keytool -importcert -keystore ./cacerts -file ad1.crt" I'm getting the following error message "sudo: keytool: Command not found". I've copied the ad1.crt file to the following directory "/opt/atlassian/confluence/jre/lib/security".
I've installed confluence via the Linux Installer file (atlassian-confluence-5.9-10-x64.bin), I used the "Express Install"-Option.

Thank you very much!

Kind regards,
Matthias

 

 

4 answers

Thank you for your quick response. There is no variable $JAVA_HOME. Yesterday I read, that JRE will be installeg automatically via the Linux installer and Express Installation option.

I've tried the following two commands:

sudo $JAVA_HOME/keytool -importcert -keystore ./cacerts -file ad1.crt

sudo $JRE_HOME/keytool -importcert -keystore ./cacerts -file ad1.crt

result: /keytool: Command not found

Do I have to set up the variable $JAVA_HOME ? I thought the installer will do it for me?

Thanks. Matthias

do this:

ps axuww | grep java | grep jira
#here you should be able to see which java it uses to start jira

#update the mlocate database
sudo updatedb
#search for the keytool
locate keytool

#then use the direct path that it finds for keytool. Make sure it's in the same path as the java used to start jira.

 

Additionally, it makes sense to do an

export JAVA_HOME="/path/to/jdk"

in .bashrc, .profile, /etc/profile or any other files used to set up the JIRA users environment, as this path also refers to cacert files and other candy that your system will use if/when using SSL.

 

ps. "/path/to/jdk" should be replaced with the dir to your JDK.

If it finds your keytool in: /opt/java/jdk1.8.0_65/bin/keytool

your JAVA_HOME should be set to: /opt/java/jdk1.8.0_65/

Additionally, if the java that executed JIRA is in /opt/atlassian/jira/... it uses the bundled JRE instead of a JDK. In that case there is no use to set the JAVA_HOME as JIRA already is aware of it anyway.

And by JIRA, i mean confluence smile

Command not found speaks for itself.. Try replacing the 'keytool' with '$JAVA_HOME/keytool' and it should work.

0 votes

If you are using a relatively recent version of Confluence, then it has shipped with, and installed, Java for you.

You should be able to go to <confluence installation> and do it all within that.  A quick look at my install that's using certs is below.  You'll need to specify the right paths if you leave your Java home blank

 

nic@zen:/opt/confluence/jre$ echo $JAVA_HOME

nic@zen:/opt/confluence/jre$ find . | egrep "cacerts|keytool"
./lib/security/cacerts
./man/man1/keytool.1
./man/ja_JP.UTF-8/man1/keytool.1
./bin/keytool

Thank you for your help. I've found the right directories (keytool + cert-dir) and imported our ad1.crt file succesfully. From now on the SSL connection (read/write) works! User can now change their Windows AD password via confluence.

Kind regards,

Matthias

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,187 views 4 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you