A Legacy Notes Developer's journey into madness.

Importing an SSL Certificate Authority into the JVM

Devin Olson  May 7 2018 12:45:16 PM

This issue is documented in IBM Technote Importing an SSL Certificate Authority into the JVM



Issue


Java code running on a Domino server (or from within a Notes client) can reach out and pull in information (such as with a REST API, or an HTTP GET) from an outside source.  
Due to the Notes/Domino security model, all of these communications must occur over an encrypted (HTTPS / SSL) channel. Normally this is not a problem, however there are occasions when the Domino JVM does not recognize the Certificate Authority in use at the outside source.  When this happens, the connection handshake fails, and returns an exception similar to:

HTTP JVM: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: No trusted certificate found.

The way to correct this is to import the appropriate Certificate Authority into the cacerts database.

This is NOT to be confused with the "Certificates" view in the Domino Directory -they are entirely different things.  

There are a few things that need to be pointed out about this Technote (reproduced below).  The Notes Client and the Domino Server have different instances of the cacerts database.  Certificate Authority files need to be imported into the appropriate instance, based on from where the code will run (Notes Client vs. Domino Server).  

When importing the certificates, simply importing the top-level certificate may not be enough.  I recommend that you import the intermediate certificates as well, simply to alleviate any headaches.

ALWAYS make a backup of the cacerts database before you start this process.  If you somehow corrupt the file and you have no backup, ALL JVM connections from your Domino server to external sources will fail.  This is a catastrophic event in a production environment.

The filepaths specified in the Technote (and below) are not necessarily correct, and will vary by installation.  Normal (default) installation locations are listed below.  Be advised that the Technote explains to use the Windows version of IKEYMAN.  I have found this in testing to be correct.

Windows
NOTES: C:\Program Files (x86)\IBM\Notes\jvm\bin\IKEYMAN.exe
NOTES: C:\Program Files (x86)\IBM\Notes\jvm\lib\security\cacerts
DOMINO: C:\Program Files (x86)\IBM\Notes\jvm\bin\IKEYMAN.exe
DOMINO: C:\Program Files (x86)\IBM\Notes\jvm\lib\security\cacerts

Linux
NOTES /opt/ibm/notes/90010/linux/jvm/bin/ikeyman  
NOTES /opt/ibm/notes/90010/linux/jvm/lib/security/cacerts  
DOMINO /opt/ibm/domino/notes/90010/linux/jvm/bin/ikeyman  
DOMINO /opt/ibm/domino/notes/90010/linux/jvm/lib/security/cacerts


Technote



Problem


A Java application running on a Domino server connecting over SSL to another server may require having the SSL certificate authority of the other server imported into its JVM.  

Symptom


When a Java application running on a Domino server connects over SSL to another server, but does not have that server's trusted root certificates, an error may occur. One example of such an error is:

HTTP JVM: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: No trusted certificate found

Cause


The trusted root certificates that signed the remote server's SSL certificate must be also be trusted by the Domino server's JVM if a Java application is making an SSL connection.  

Resolving the problem


To add the trusted root certificates to a Domino server JVM follow these steps:
 
A. Obtain the Certificate to be Imported
Each browser displays certificates in different ways, but they are usually quite similar. On the browser's URL bar, there is usually a zone that you can click on to display SSL certificate information. For example, you may see a padlock in the status bar, and clicking on the padlock opens the certificate information. Once the certificate information is open, click on the "Certification Path" information. There normally will be a way to export each of the signing certificates (trusted roots). Export the certifiers in the "Base-64 encoded X.509 (.CER)" format. The exported file in this format will be an ASCII text file that has "BEGIN CERTIFICATE" and "END CERTIFICATE" lines at the top and bottom. Once you have exported the certificates that signed the remote server's SSL certificate you can then import them into the JVM.
       
B. Import the SSL certifier into the JVM.
If Domino is on a UNIX server, perform these steps on a Windows workstation, and then move the cacerts to the server after the import is completed.

Import the SSL Certificate into the JVM using these steps:
 1. Open a command prompt as Administrator and change directory to C:\Lotus\Domino\jvm\bin.  
 2. Run the batch file "IKEYMAN.exe" (a Java application will load).
 3. Click "Key Database File" then "Open".
 4. Browse to C:\Lotus\Domino\jvm\lib\security\cacerts. Note, you will have to view "All Files" to locate cacerts.  
 5. Supply the default password of "changeit". Note, consult your administrator if you receive an error pertaining to the password.  
 6. Select "Signer Certificates" in the drop-down menu.  
 7. Click "Add"  
 8. Select "Browse" and locate the .CER file you copied.  
 9. Click "OK" and enter a descriptive label.  
10. On the Domino console issue the command "restart task http".

Engage 2018: I will be presenting in Rotterdam in May.

Devin Olson  April 9 2018 09:40:46 AM


I am very humbled and excited to be presenting in two different sessions at engage 2018 this year.  I am especially humbled to be sharing the stage with Mr. Red, Mr Pink, and Mr. Yellow.   I am so looking forward to attending engage with my fellow team members at Red Pill Now


Take 5: Modernization Workshop



The Count Down to Domino 2025


Taming Domino Designer

Devin Olson  March 22 2018 08:11:26 AM



Once again I found myself searching the interwebs for a document I knew existed.

I found it after a bit, and decided I would post it here so that I didn't have to search for it next time.  

Taming Domino Designer by Nathan T. Freeman.  Yes, it is a bit long in tooth, but is VERY relevant if you are doing XPages work.


Holy Shit Moment: Domino on iOS

Devin Olson  March 22 2018 06:55:04 AM
Alan Lepofsky gives us a very quick demo of HCL's work on surfacing Domino data in iOS.  

While this is not a true Notes Client, it is nevertheless a holy shit moment for me.  

Video on Youtube:
https://www.youtube.com/watch?v=5veoCliQcNQ&feature=share

Updated incinerate()

Devin Olson  February 27 2018 02:35:42 PM
Back in August of 2013 I originally posted Nate and Tim's Excellent Recycle.    

Granted, if you are coding in XPages the OpenNTF Domino API has pretty much made the need for this method irrelevant (as the ODA's first goal is to eliminate the "ham-fisted Exception handling in the lotus.domino API").

HOWEVER, if you are doing non-XPages Domino Java code then this recycle method is still relevant.

I had a need to enhance this method to handle Map and Collection values.  I present to you this enhanced code, in the hopes that it helps ease your pain when developing Java code in Notes and Domino.

Hope this helps!

/**
* Recycles Domino Objects without throwing an exception
*
* @author Nathan T. Freeman, Tim Tripcony, Devin S. Olson
*
* @param dominoObjects
*            Domino Objects to be recycled.
*            
* @see http://learningxpages.com/blog.nsf/dx/02272018023541PMDOLQYV.htm
*/
@SuppressWarnings("unchecked")
public
static void incinerate(final Object... objects) {
     if (null == objects) { return; }

     try {
             for (final Object object : objects) {
                     if (object != null) {
                             if (object instanceof Base) {
                                     // normal recycle
                                     ((Base) object).recycle();

                             } else if (object instanceof Map) {
                                     // incinerate all keys and values
                                     final Set entries = ((Map) object).entrySet();
                                     for (final Map.Entry entry : entries) {
                                             incinerate(entry.getKey(), entry.getValue());
                                     }

                             } else if (object instanceof Collection) {
                                     // incinerate every element in the collection
                                     final Iterator i = ((Collection) object).iterator();
                                     while (i.hasNext()) {
                                             final Object element = i.next();
                                             incinerate(element);
                                     }

                             } else if (object.getClass().isArray()) {
                                     // incinerate every element in the array
                                     final Object[] objectsArray = (Object[]) object;
                                     for (final Object element : objectsArray) {
                                             incinerate(element);
                                     }
                             }
                     }
             }

     } catch (final NotesException recycleSucks) {
             // optionally log exception (why bother?)
     }
}

IBM Champion 2018

Devin Olson  January 12 2018 09:01:24 AM

I have been officially notified that I have been named an IBM Champion for 2018.  

I am honored and humbled to be a part of this group of amazing and brilliant people.

Thank you all.

OpenNTF Release: Enhanced Log version 2017.12.26

Devin Olson  December 26 2017 01:43:26 PM
I have released the latest version of Enhanced Log on OpenNTF.

Latest release includes additional collections support libraries, better cache and memory management, smaller library footprint, better commented code, and some additional logging features such as including links with extended content and profiled logging capability.

How to enable the hidden Windows 10 Administrator Account

Devin Olson  December 20 2017 04:56:39 PM
ENABLE: net user administrator /active:yes from an elevated command prompt.
DISABLE: net user administrator /active:no from an elevated command prompt.

I posted this because I got tired of having to web search (google, bing, whatever) for it and every single result was filled with clickbait ads and a ton of tracking happy horseshit.  

My website has none of that crap, and never will.  

Still Relevant after all these years

Devin Olson  November 28 2017 09:40:55 AM
#thanksIBM
#ibmchampion

Happy Birthday Notes

    MWLUG 2017: Session Slides for AD117 - "M" is for Modernization

    Devin Olson  August 10 2017 10:58:30 AM


    This session was an absolute blast.  So very happy I was able present this along with the rest our our amazing team.

    As a developer do you find yourself struggling to keep up with the endless stream of technology options available? If so, please join us as we take you through the A to Z of application modernization technologies that you need to be aware of in order to extend the life of your Notes databases. We will step our way through the Modernization Alphabet starting at APIs before working our way through to Web Components, XPages, YAML, and Zapier. Our goal in this session will be to give you a better understanding of at least one technology you might not have previously considered that you should be using when you return from this conference.

    Session Slides now available at Slideshare: https://www.slideshare.net/redpillnow/m-is-for-modernization