Jump to content
  • Enhance your security by enabling SSL on your searches with Solr and WebFOCUS


    Pablo Alvarez

    This article intends to cover what you need to secure your search in Solr and how it's connected to WebFOCUS.

    Sometimes, some of our sensitive data is stored in the WebFOCUS Repository or at the WebFOCUS Reporting Server Application folders (hold files that are not stored temporarily, for example) and Solr allows you to find almost everything under WebFOCUS, so when performing a search, the connection between Solr and WebFOCUS is not encrypted by default and uses HTTP protocol. With this article, we want to enhance your security by adding an extra SSL layer to the communications between Solr and WebFOCUS, enabling SSL in Solr and WebFOCUS, and making available the connection between them. You'll find a troubleshooting section and a tips section at the end. I do recommend to read the entire article, and, of course, if you have any doubts or comments about it, we're here to help!

    To enable SOLR to work under a secure connection, you’ll need to have a valid certificate with a fully qualified domain name to be used (FQDN), we’ll follow all the steps to create one on your own and use it to secure and encrypt your connection between our WebFOCUS Client and the SOLR service.


    Even if I used this under Windows, the same steps apply to Linux, also, I used the WSL (Windows Subsystem for Linux) on my box to perform some of the steps, but that’s not necessary if you have the required components or you’ve been already provided with a valid certificate, so you don’t need to generate a new one.


    The very first step was to create the certificate and the key for my machine. Here’s where I used the WSL (CentOS) to use the OpenSSL commands. But if you don’t want to install WSL, the easiest way to get OpenSSL on your Windows box is by installing Git for Windows and running the Git Bash utility that comes with it (it’ll open a command prompt window in which you can execute Linux commands) or PowerShell for Windows.

    zk41d2qZ-zv_mR-PEfFNPihwiYRjjCOnSKxv3_z63Fk5c1Z8pYlL6mGJ3Ind-_1Lx6dxzrngkkRijfmct9fZn40I_DrUaCPzWcewG2_gAO30-tlvGpxaWGMEcK16tfDNJnH9RNajcsCgCXDPy0eX3zk
     

    If you have WSL, you may need to install the OpenSSL package, so you’ll need to follow your distribution updater package to get it.

    sudo apt install openssl

    Or

    sudo yum install openssl

    Note: You may want to upgrade your repositories and packages before installing it (sudo apt update && sudo apt upgrade / sudo yum update && sudo yum upgrade). Once the package is installed, you can run the OpenSSL command that will generate the key file and the certificate file we will use later

    To get the FQDN:

    $myFQDN = (Get-WmiObject Win32_ComputerSystem).DNSHostName + "." + (Get-WmiObject Win32_ComputerSystem).Domain

    >> Write-Host $myFQDN

    NmCdSVTJrCsINAj-VZD6nH_kNJa6O7gvQ0R_ITpcyrz_dy3fgBDI0yG2GB21OSQdMU8J3dZ7fy4fjk1aQKGT3cMJO_UXczOqmPPQySTstpyxnn0zS-WtnlVTWsHm6ICwv5nOMuq_CfPJHuakHu2kE6Q

    And to generate the key and certificate files:

    openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout keyfile.key -out certificatefile.crt -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=yourfqdn" -addext "subjectAltName=DNS

    :yourfqdn,DNS:*.tibco.com,IP:10.0.0.1"

    The output will be similar to these screenshots:

     PxzKWt3qfZsIHcncb-LxVZBSXwOJg5o_jV7KrTh7LbfrPRuCN0EMBtlG1Ft8H_7Z1eHM-hdABlde60rF6hbyeL3ymDzQ-7fYjRTRFf0_shyQT2EWES_l0OM0v-uqQYJafXeAcxLP74oLS0_tZ5SW_dA

     FcCuuO63P-22e8xtHFIgG8mYCB8Sxz4LtHVxuR-c59g3x9KdlJXzfe-2COje778KEPMBMSALB5_QWSz8ns2N7aUanfuYGboNQfZ9i9RNOGNZC3Wl9FZOeWD8FHgqjDZJTZ0teXvHry1t1PA0q2H8Kio

     

    You’ll need to change the values (highlighted in red) to match your company name, organization unit, country, etc… (not really needed so that you can use the ones in the sample). Still, the most important part is the Common Name (CN), which’s the one that needs to match the URL you’ll be using on your browser to access WebFOCUS, and it has to contain the FQDN.

    The key thing here is that Solr expects to have a valid domain to create a real secure connection between environments.

    Note: I’ve also added as DNS the entire tibco.com domain, that way, this will work even if I add my region, like: https://machinename.emea.tibco.com

    Now that we have created the key and the certificate, we need to store it under a keystore, so the next step is creating it based on them:

    openssl pkcs12 -export -in tibco-pc1t3xv0.crt -inkey tibco-pc1t3xv0.key -out tibco-pc1t3xv0.p12

    pjcl-yltT0jrjDk-KYlfS4P4HHzzOAKr6bGKcxhs2lEuJevzNEbLa4kF4jnsgsJmWh1-7LllQQyPzYo8MJNk8SJW5qxh7jUEyQidDHRI8DHYcsGB2KsVhd_vHAqM2D-sPpQf5toPaRWLl1yC3YzHExE

    You’ll be prompted for a password, so don’t forget which one you’ve selected as it’ll be used later.

    Lastly, we need this recently created certificate to be “trusted” by our environment, in case you can’t certify it with a CA (Certificate Authority like VeriSign, IdenTrust, DigiCert, Let's Encrypt, GoDaddy, or similar) or already have a certified one by these authorities, which is the recommended for Production environments, and even more if they are publicly available.

    Your server has a JDK installed (requirement for WebFOCUS) so, in order to validate it ‘internally’ we’ll use the cacerts keystore that comes with the JDK installation. You can check it’s content by executing the following command from the command prompt:

    For Java11: keytool -v -list -cacerts

    For Java 8: keytool -v -list -keystore <path to cacerts>\cacertsfile.ext

    Note: Keytool is a tool also provided in the JDK, so it has to be in the PATH variable of the OS to be able to execute it anywhere, if you don’t have it there, you can use the entire path to it to make it work.

    You’ll be prompted for a password, and the default one is ‘changeit’ (without quotes). You’ll see a bunch of certificates scrolling on your screen (usually around ~99). So if you also want to review them, just send that output to a text file you can check later:

    Java11: keytool -v -list -cacerts > C:\Temp\cacerts_content.txt
    Java8: keytool -v -list -keystore <path to cacerts>\cacertsfile.ext > C:\Temp\cacerts_content.txt

    The cacerts file is usually stored under %JAVA_HOME%\lib\security (or $JAVA_HOME/lib/security in Unix/Linux environments), but depending on how you have your environment configured, you may be using the one that comes with WebFOCUS (C:\ibi\WebFOCUS93\jdk) or Tomcat (C:\ibi\tomcat\jdk), not adding the -keystore parameter we’re making sure that we are importing our certificate in the cacerts file that the OS is reading.

    The command to import our certificate into that cacert file is:

    keytool -import -alias {aliasname} -cacerts -file {certificatename.cer} 

    So you should be using something like:

    Java11: keytool -import -alias mylocalcert -cacerts -file tibco-pc1t3xv0.crt
    Java8:  keytool -import -alias WF8207SSL -keystore <path to cacerts>\cacerts -file <path to crt>\WF8207SSL.crt

    keytool -import -alias mylocalcert -cacerts -file tibco-pc1t3xv0.crt

    Again, you’ll be prompted for the cacerts password and it’ll also ask you if you trust the certificate you are importing (obviously, you trust it, as you are the one who has created it).

    hw6HjZC50r7e44b0nYPKXSlrm43y9LcTJydgN6zT7DpCKjwzXG_wvSC6IuvLO_Y-BmSMaO8CbSzSCN__cjtxgJi72I0aNeXDwVh2e1rIUwvWr9zn7mqT9xyNlMn-eYHR3nNtPsX8d0eMuCIY_0fccUs

    Now our certificate is also trusted, and these files will now be used in our WebFOCUS installation. I recommend applying them to Tomcat first, so we’ll be able to access WebFOCUS using SSL, then apply it to Solr, and finally connect both.

    So, even if it’s not needed, as long as you want to secure the connection between the WebFOCUS Client and Solr, you’ll probably want to secure the WebFOCUS Client as well, so now that we have the certificate, the key, and the keystore, we should be able to make that happen.

    For Tomcat, is as simple as adding the following block to the server.xml file located under Tomcat’s ‘conf’ folder:

    <!-- IBI SSL Port -->
        <Connector port="8443"
          protocol="org.apache.coyote.http11.Http11NioProtocol"
          maxThreads="150"
          maxPostSize="-1"
          URIEncoding="UTF-8"
          SSLEnabled="true"
          scheme="https"
          secure="true"
          keystoreFile = "C:\ibi\certs\tibco-pc1t3xv0.p12"
          keystoreType = "PKCS12"
          keystorePass = "keystorepasswd"
          ciphers="TLS_RSA_WITH_AES_128_CBC_SHA"
          clientAuth="false"
          sslProtocol="TLS"
          sslEnabledProtocols="TLSv1.2"/>
    <!-- IBI SSL Port END -->

    After that, you just need to restart Tomcat and you should be able to access via http (if you didn’t disable the 8080 port) and https.

    017T4F6VrXaobScw-Xw_tdkhHWsjLs9pMFvGpGqsaOUoiFTE8_92A5MClix-beb861p9fMNS8mJltBMRb6N4_O62NgilqDqs7hJJgD80KCYFGTDA__3uwBAU95zsLHOp1H6FS8JXM2bUkvaVrHAbIMw

     

    Note: If you still don’t get the ‘Certificate is valid’, just keep going, there’s an ‘Other Tips’ section at the end of the Article that may help you with this as well.

    If you don’t use the FQDN, you’ll see that the connection will appear as insecure (as the URL doesn’t match the certificate) even it’s using SSL:

    dud8QKjkruc_QuMDslaO8IayhRkAafUH28XeCGKZ6ddm5gwFGqjeDwAkB21T65183uNWQMR_XfneVS-l7oBDA8-bqyXV0TKwmnQEcbPXJTR8fd1zhMhfvD6uSxln9JeeSeeuFvN1J4OXmihFRfTveUo

     

    If you have any issues at any of the steps we’ve taken, don’t hesitate to write me at pablo.alvarez@cloud.com

    If you are using a different Application Server, you can also ping me or open a Support Ticket case.

    Do let me know if you want me to write another article about certificates by sending me an email requesting it 😉

    Now, we should focus on the Solr configuration. You have a ‘solr.in.*’ file (.sh for Unix/Linux, .cmd for Windows) under C:\ibi\WebFOCUS93\Solr\solr\bin (or ../ibi/WebFOCUS93/Solr/solr/bin if you are using a Linux/Unix environment), edit it and uncomment the following lines (and make sure the values matches the ones for your environment):

    set SOLR_SSL_ENABLED=true
    set SOLR_SSL_KEY_STORE=C:\ibi\certs\local\tibco-pc1t3xv0.p12
    set SOLR_SSL_KEY_STORE_PASSWORD=keystorepasswd
    set SOLR_SSL_TRUST_STORE=C:\ibi\certs\local\tibco-pc1t3xv0.p12
    set SOLR_SSL_TRUST_STORE_PASSWORD=keystorepasswd
    set SOLR_SSL_NEED_CLIENT_AUTH=false
    set SOLR_SSL_WANT_CLIENT_AUTH=false
    set SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false
    set SOLR_SSL_CHECK_PEER_NAME=true
    set SOLR_SSL_KEY_STORE_TYPE=PKCS12
    set SOLR_SSL_TRUST_STORE_TYPE=PKCS12

    I also recommend uncommenting and changing the following line to get a more detailed log the first time to debug the issues you could face, and once it’s working properly, set it back to the default value (INFO) or even comment it out:

    set SOLR_LOG_LEVEL=INFO

    If all the previous steps were correctly performed, you should be able to restart the Solr service now and be able to access the Solr Dashboard via https: https://servername.company.ext:8983/solr

     

    Vm09qXal-EHfhoV7K9m2vJvUFvURtPslQy-ZU4a1cocoEtvFPJLtmlAX9m_yVey7Y-bURfKxv9zSdri8TKaHESZXnjNDywGe2uuvfdrzuc4CQNAi3NO1cAsMIph1gt-IE0WqgONNW6VVOvCphEc4jGs

    The latest configuration part is to tell WebFOCUS that the connection between them is now being made using SSL, so you’ll need to access your WebFOCUS Client Administration Console Configuration and change the Solr Url to match the one you used to access the Dashboard:

    3T0mRQgV5XnhKZGc-rKQVQXHJ8TEnMz1T6D6a9Qj9r9wO-CU4MMP6QOQKIbPwwXUGvlw-2vOopUPMv1bwglpgDISU9Sh5Q-hmQkgeF2B4cYkbrn8LxllQZIjvKLlo556OgU2wm4WYP6NMXqlaY9Tgj0

    And that should be all, you are now connected in an even more secure way and performing secure searches within your data and WebFOCUS:

    hISbdHBOnt4ncSdYXOZ0gY_bp5tOcAa4vVwN1KXbpvdRmHt9uPP7G4IzdEiFHWeyTYoQ6erE4cHepqgWsDr4AihQCcyHPS3xe-SPzHg0PYeQ3QOjKGfJoFFwoic4R1nToiaV05E1VJJgzUE-1YlXNQI

     

     

    TROUBLESHOOTING

    During the investigation on how to enable SSL (and make it work with WebFOCUS), -John Calappi (who was also an important part on this Technical Article and you can contact him as well 😜), and I found some issues. Even if we were able to start Solr with SSL, WebFOCUS wasn’t able to communicate with it and the message you receive is as follows:

    zKjoKCw1HViP5cLpCodgDcb3SME3MO3EDEXn7GuCYuR7z-3GCheisltVzYJn0tTIdwB2YAXNySLimHw1anFqmLW525wdmI_5BSbumD_Nc61fV32UYEy_GzD_AUrDH7Yrh1VKO_wHexBhDG4zCAN1h2I

     

    This is why I recommend you configure the DEBUG mode on Solr, to try to figure out why it’s not working.

    Our magnify_search.log files from WebFOCUS showed this messages:

    [2024-04-17 12:45:21,648] INFO  main - {} - SolrSearchClientFactory.init() initializing Solr client with: url: https://tibco-pc1t3xv0:8983/solr, username: , collection: ibi-protected
    [2024-04-17 12:45:21,650] INFO  main - {} - createSolrClient(): created SolrClient for url: https://tibco-pc1t3xv0:8983/solr
    [2024-04-17 12:45:21,672] ERROR main - {} - testClient(): error: IOException occurred when talking to server at: https://tibco-pc1t3xv0:8983/solr
    [2024-04-17 12:45:21,673] ERROR main - {} - createSolrClient(): Error testing Solr client
    [2024-04-17 12:45:21,673] ERROR main - {} - Error! Creating SolrClient

     

    Even the Solr service was started and we were able to access the Solr Dashboard using SSL.

    Checking the Solr logs in DEBUG mode showed us that the ‘handshake’ wasn’t being performed. The ‘handshake’ is when you try to communicate with the endpoint securely, but the endpoint doesn’t trust you and doesn’t perform the handshake.

     

    fC5GD879oLST7dWzo1a3eFCc-9ImwOO9FrB9Ekgo39zwoPBBwGkO0dI68NU2vMrX5RPTZtn1E974VrIh7nm1tUt_LQn3ELRhGw6CZm087hBz0nxTZOvRhSQ3QszH5RKl367LMHkobuKbxNjRVvaSu2c



     

    2024-04-08 12:38:40.340 WARN  (main) [   ] o.e.j.u.s.S.config No Client EndPointIdentificationAlgorithm configured for Client@20b9d5d5[provider=null,keyStore=file:///C:/ibi/certs/local/mokochino_pkcs12.jks,trustStore=file:///C:/Program%20Files/Java/jdk-11/lib/security/cacerts]
    2024-04-08 12:38:42.993 DEBUG (qtp1489193907-23) [   ] o.e.j.i.s.SslConnection fill NOT_HANDSHAKING
    2024-04-08 12:38:43.401 DEBUG (qtp1489193907-27) [   ] o.e.j.i.s.SslConnection DecryptedEndPoint@569cafab{l=/10.98.96.15:8983,r=/10.98.96.15:60038,OPEN,fill=-,flush=-,to=414/120000} stored fill exception => javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
    javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown

    We got these messages when the certificate wasn’t added to the cacerts file, and also when the keystore we used didn’t have the .key attached to it, so it was considered a ‘public’ certificate (like having a low fence or an open padlock, both are secure methods, but used incorrectly, so not secure at all). In order to have a proper handshake between products, the keystore needs to have the required files to accept the connections.

    OTHER TIPS

    Make sure that you are adding your certificate to the proper cacerts file, sometimes, there are several Java JDK releases installed and each one has its own cacerts file. For example, when you install WebFOCUS, sometimes it also includes its own jdk (C:\ibi\WebFOCUS93\jdk) or even under Tomcat you can have another one (C:\ibi\tomcat\jdk), Linux/UNIX environments doesn’t usually have them, but Windows does. In that case, I usually delete those ones and use the mklink command to create symbolic links (similar to the Linux ones, not Windows shortcuts) just in case that there’s some hardcoded path pointing there. You could use it as follows:

    mklink /D {destination} {source}

    Sample:

    mklink /D C:\ibi\WebFOCUS93\jdk C:\Progra~1\Java\jdk11              

    It is also recommended to add your new certificate into your client OS, so any browser you use can also trust this one on their side. From your Windows OS, double-click on your .crt file (you can copy the file from the server or the content of it as it’s just a plain-text file) and you’ll see something like this:

    eleh3oYR-68_tLE6t8cYi5V7c6o5w_YfcmzVnQpGp01tetn25L-njT0ImTrr4BbCl5rV-b530PlD8xYHLjr-8ifTyEtIm6WK97KcluWVH6D7kTxo2IacSKJRIuXAOCo_ZH3mywRa8ybpODEO-c8fPOA

    Click on the Install Certificate… and place it under the Trusted Root Certification Authorities:

    1oXKs8GaW5zZJTSJ4xoz7OLUqXJcYmyjGkVTanj0ivy2sOv8FEYSOSo4DxB6d9otvoyfFFelVftYKs1OpibCmyQInAVIHpGU7nVREgy6zkW2wfLkAUJkXhHtFJwz24j5KCY77wKsYF3uUwZsrSm9_uY

    After finishing this process, you’ll see that certificate as valid:

    RQ-Puw5qbbSaDkefYYiKtwLq7KGI6BlBxcHxf2wgDdxWlARO-6OxzAh3S3fSxgNEvnLEGp_XPCWdVkc3DhTqRLBOWPGrSjea4Q2v6dZG4phCoACf9c_jHvlf_O5v2tcoEltckp8bDcX3--rdA1QumHY

    Another option to have SSL in your WebFOCUS Installation that Ben Naphtali also suggested is to put in front of our install a Load Balancer like NGINX and have that using SSL. That way, even if you don’t have SSL configured in WebFOCUS, you won’t be able to access it without going first to NGINX in a secure way (NGINX will manage and redirect the petitions to WebFOCUS and Solr). NGINX, Apache WebServer using the mod_proxy module or mod_jk, or any Load Balancer should work for this.

    As said before, let me know if you want me to write another Technical Article about how to properly install the Load Balancer in front of your WebFOCUS install to secure it, this will also allow you to have different WebFOCUS Clients to handle HighAvailability features in production environments.

    You could also enable SSL in the WebFOCUS Reporting Server Side, but that part is perfectly described in the Security & Administration Manual, so you just need to follow that one to make it work.

    Happy & Secure connections!

    Pablo Alvarez

    • Like 3

    User Feedback

    Recommended Comments

    There are no comments to display.


×
  • Create New...