<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>How to add a certificate to Dynatrace Server TrustStore | Dynatrace help</title>
    <description></description>
    <link>https://www.dynatrace.com/support/help/</link>
    <atom:link href="https://www.dynatrace.com/support/help/setup-and-configuration/dynatrace-managed/configuration/how-to-add-a-certificate-to-server-trust-store/feed.xml" rel="self" type="application/rss+xml"/>
    <lastBuildDate>Fri, 18 Oct 2019 07:17:18 +0200</lastBuildDate>
    <pubDate>Fri, 10 May 2019 12:19:48 +0200</pubDate>
    <generator>Metalsmith v2.3.0</generator>
    <item>
      <title>How to add a certificate to Dynatrace Server TrustStore updated on Fri, 10 May 2019 12:19:48 +0200</title>
      <description>&lt;p&gt;There may be times when you need to manually add a certificate to the Dynatrace Server TrustStore, for example if Dynatrace Server refuses to accept a certificate when sending emails or WebHook notifications. This typically happens when a self-signed certificate is used.&lt;/p&gt;
&lt;h2 id=&quot;how-to-know-when-dynatrace-server-isn-t-accepting-certificates&quot;&gt;How to know when Dynatrace Server isn&amp;apos;t accepting certificates
      &lt;span class=&quot;shortlink-copy shortlink-copy-js&quot; data-clipboard-text=&quot;https://www.dynatrace.com/support/help/shortlink/managed-server-truststore#how-to-know-when-dynatrace-server-isn-t-accepting-certificates&quot;&gt;
      &lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;If Dynatrace Server is having trouble sending notifications, look for any &lt;a href=&quot;https://www.dynatrace.com/support/help/setup-and-configuration/dynatrace-managed/installation/dynatrace-managed-hardware-and-system-requirements/&quot;&gt;files in the log directory&lt;/a&gt; of your Dynatrace Server installation that have the name pattern &lt;code&gt;server.*.*.log&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If any files with this naming pattern exist in the log folder, search through those log files for the following entry:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-java hljs&quot;&gt;sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Log entries such as the example above indicate that the certificate provided by the notification receiver wasn&amp;apos;t accepted by Dynatrace Server. The reason for this is usually that the certificate isn&amp;apos;t trusted.&lt;/p&gt;
&lt;h2 id=&quot;add-a-custom-certificate-to-the-dynatrace-server-truststore&quot;&gt;Add a custom certificate to the Dynatrace Server TrustStore
      &lt;span class=&quot;shortlink-copy shortlink-copy-js&quot; data-clipboard-text=&quot;https://www.dynatrace.com/support/help/shortlink/managed-server-truststore#add-a-custom-certificate-to-the-dynatrace-server-truststore&quot;&gt;
      &lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;You can use the Java KeyTool to enter commands to create the KeyStore. Dynatrace redistributes Java Keytool as part of the JRE installed with Dynatrace Server. By default, this tool is available in &lt;code&gt;&amp;lt;dynatrace-managed-installation-directory&amp;gt;/gateway/jre/bin&lt;/code&gt; or, depending on your deployment, in &lt;code&gt;/opt/dynatrace-managed/jre/bin&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;step&quot;&gt;
&lt;p&gt;Open a command prompt and switch to the directory where the Java KeyTool is located.&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;step&quot;&gt;
&lt;p&gt;(optional) Create the KeyStore for the custom certificate.&lt;br&gt;
See &lt;a href=&quot;https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html&quot;&gt;Generating a KeyStore and TrustStore&lt;/a&gt; for information on creating a Java KeyStore.&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;step&quot;&gt;
&lt;p&gt;Export the custom certificate in CER format.&lt;br&gt;
For example, to export a certificate that you want to name &lt;code&gt;customcertificate.cer&lt;/code&gt;, specifying a password and the alias, enter a command similar to the following (&lt;strong&gt;Note&lt;/strong&gt;: You must insert your organization&amp;apos;s file paths, file names, and password into these commands in place of the included sample values).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;keytool -export -storepass passwd -alias dynatracealias -keystore /usr/java/jre/lib/security/cacerts -file /tmp/customcertificate.cer&lt;/code&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;step&quot;&gt;
&lt;p&gt;Import trusted certificate into Dynatrace Managed keystore.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create the &lt;code&gt;import_trusted_certificate.sh&lt;/code&gt; script file:&lt;/li&gt;
&lt;/ol&gt;
&lt;section class=&quot;expandable expandable--separated&quot; id=&quot;expand-140import_trusted_certificatesh&quot;&gt;
&lt;a class=&quot;expandable__trigger&quot; href=&quot;#expand-140import_trusted_certificatesh&quot;&gt;import_trusted_certificate.sh&lt;/a&gt;
&lt;article class=&quot;expandable__content&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash hljs&quot;&gt;&lt;span class=&quot;hljs-meta&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot;&gt;# Importing trusted certificate into Dynatrace Managed keystores&lt;/span&gt;

CERT_TO_IMPORT=&lt;span class=&quot;hljs-variable&quot;&gt;$1&lt;/span&gt;
CERT_ALIAS=&lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt;

&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; [ -z &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;&lt;span class=&quot;hljs-variable&quot;&gt;$CERT_TO_IMPORT&lt;/span&gt;&amp;quot;&lt;/span&gt; ] || [ -z &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;&lt;span class=&quot;hljs-variable&quot;&gt;$CERT_ALIAS&lt;/span&gt;&amp;quot;&lt;/span&gt; ]; &lt;span class=&quot;hljs-keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;hljs-built_in&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Usage: &lt;span class=&quot;hljs-variable&quot;&gt;$0&lt;/span&gt; &amp;lt;certificate-path-to-import&amp;gt; &amp;lt;alias-for-certificate&amp;gt;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;hljs-built_in&quot;&gt;exit&lt;/span&gt; 1
&lt;span class=&quot;hljs-keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;hljs-built_in&quot;&gt;export&lt;/span&gt; PRODUCT_PATH=`grep -E &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;PRODUCT_PATH\s*=&amp;quot;&lt;/span&gt; /etc/dynatrace.conf | sed -r &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;s/^[^=]+=\s*//&amp;quot;&lt;/span&gt;`
&lt;span class=&quot;hljs-built_in&quot;&gt;export&lt;/span&gt; JAVA_HOME=&lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/jre
&lt;span class=&quot;hljs-built_in&quot;&gt;export&lt;/span&gt; KEYTOOL=&lt;span class=&quot;hljs-variable&quot;&gt;$JAVA_HOME&lt;/span&gt;/bin/keytool

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-title&quot;&gt;importCert&lt;/span&gt;&lt;/span&gt;() {
    &lt;span class=&quot;hljs-built_in&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Importing &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_TO_IMPORT&lt;/span&gt; into &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt; at alias &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_ALIAS&lt;/span&gt; ...&amp;quot;&lt;/span&gt;
    cp -f &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt;.bak
    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot;&gt;$KEYTOOL&lt;/span&gt; -importcert -trustcacerts -noprompt -keystore &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt; -storepass &lt;span class=&quot;hljs-variable&quot;&gt;$1&lt;/span&gt; -&lt;span class=&quot;hljs-built_in&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_ALIAS&lt;/span&gt; -file &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_TO_IMPORT&lt;/span&gt;; &lt;span class=&quot;hljs-keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;hljs-built_in&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Importing &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_TO_IMPORT&lt;/span&gt; into &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt; at alias &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_ALIAS&lt;/span&gt; ... success&amp;quot;&lt;/span&gt;
        rm -f &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt;.bak
    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;hljs-built_in&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Importing &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_TO_IMPORT&lt;/span&gt; into &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt; at alias &lt;span class=&quot;hljs-variable&quot;&gt;$CERT_ALIAS&lt;/span&gt; ... failed&amp;quot;&lt;/span&gt;
        mv -f &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt;.bak &lt;span class=&quot;hljs-variable&quot;&gt;$2&lt;/span&gt;
        &lt;span class=&quot;hljs-built_in&quot;&gt;exit&lt;/span&gt; 1
    &lt;span class=&quot;hljs-keyword&quot;&gt;fi&lt;/span&gt;
}

importCert changeit &lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/jre/lib/security/cacerts
importCert changeit &lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/nodekeeper/jre/lib/security/cacerts

importCert trusted &lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/nodekeeper/conf/trusted.jks
importCert trusted &lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/server/conf/trusted.jks
importCert trusted &lt;span class=&quot;hljs-variable&quot;&gt;$PRODUCT_PATH&lt;/span&gt;/security-Gateway/ssl/customkeys/trusted.jks
&lt;/code&gt;&lt;/pre&gt;
&lt;/article&gt;
&lt;/section&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Make the &lt;code&gt;import_trusted_certificate.sh&lt;/code&gt; script executable:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&quot;hljs&quot;&gt;chmod +x import_trusted_certificate&lt;span class=&quot;hljs-selector-class&quot;&gt;.sh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Run the &lt;code&gt;import_trusted_certificate.sh&lt;/code&gt; script to import the certificate:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&quot;hljs&quot;&gt;import_trusted_certificate.&lt;span class=&quot;hljs-keyword&quot;&gt;sh&lt;/span&gt; &lt;span class=&quot;hljs-symbol&quot;&gt;&amp;lt;full_path_to_cer_file&amp;gt;&lt;/span&gt; &lt;span class=&quot;hljs-symbol&quot;&gt;&amp;lt;alias_for_certificate&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class=&quot;step&quot;&gt;
&lt;p&gt;Restart Dynatrace Server.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;hljs&quot;&gt;&lt;span class=&quot;hljs-regexp&quot;&gt;/opt/&lt;/span&gt;dynatrace-managed&lt;span class=&quot;hljs-regexp&quot;&gt;/launcher/&lt;/span&gt;dynatrace.sh restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
</description>
      <pubDate>Fri, 10 May 2019 12:19:48 +0200</pubDate>
      <link>https://www.dynatrace.com/support/help/setup-and-configuration/dynatrace-managed/configuration/how-to-add-a-certificate-to-server-trust-store/?updated=fri-10-may-2019-12-19-48-0200</link>
      <guid isPermaLink="true">https://www.dynatrace.com/support/help/setup-and-configuration/dynatrace-managed/configuration/how-to-add-a-certificate-to-server-trust-store/</guid>
    </item>
  </channel>
</rss>