{"id":193,"date":"2016-09-13T21:32:34","date_gmt":"2016-09-13T17:02:34","guid":{"rendered":"http:\/\/www.enhisecure.com\/isecureblog\/?p=193"},"modified":"2016-11-29T12:55:15","modified_gmt":"2016-11-29T08:25:15","slug":"enabling-active-directory-ssl-authentication","status":"publish","type":"post","link":"https:\/\/www.enhisecure.com\/isecureblog\/2016\/09\/13\/enabling-active-directory-ssl-authentication\/","title":{"rendered":"Enabling Active directory SSL authentication"},"content":{"rendered":"<p>Using <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/jndi\/\">JNDI\u00a0<\/a>we can\u00a0access the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Active_Directory\">active directory<\/a>,\u00a0but if we want to access the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Active_Directory\">active directory<\/a> using the secure port we need to get the certificate issued by the<a href=\"https:\/\/technet.microsoft.com\/en-in\/windowsserver\/dd448615.aspx\"> active directory certification services<\/a>.<\/p>\n<p>The certificate helps to authenticate the server over\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security\">SSL<\/a>.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security\">SSL\u00a0<\/a>authentication is useful when we need to\u00a0perform\u00a0the administrative stuff like changing password using <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/jndi\/\">JNDI<\/a>.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Active_Directory\">Active directory <\/a>enables us to access the server over <a href=\"https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security\">SSL\u00a0<\/a>using the certificate issued by that server.<\/p>\n<p>To access the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Active_Directory\">active directory<\/a> using the <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/jndi\/\">JNDI\u00a0<\/a>we need to get the certificate issued by the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Active_Directory\">active directory<\/a> and import that into java key tool.<\/p>\n<p>&nbsp;<\/p>\n<h4><a name=\"_Toc461542654\"><\/a>1.\u00a0\u00a0\u00a0\u00a0 <strong>Creating and\u00a0exporting certificate\u00a0file<\/strong><\/h4>\n<p>We can export the certificate which can accept the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security\">SSL\u00a0<\/a>authentication in many ways. But in this article we are exporting the certificate using the internet explorer and command prompt.<\/p>\n<blockquote><p>Note: to export the certificate, server should be installed with\u00a0<a href=\"https:\/\/technet.microsoft.com\/en-in\/windowsserver\/dd448615.aspx\">active directory certification services<\/a>. Refer the following\u00a0<a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc772393(v=ws.10).aspx\">link\u00a0<\/a>to install the\u00a0<a href=\"https:\/\/technet.microsoft.com\/en-in\/windowsserver\/dd448615.aspx\">ADCS<\/a><\/p><\/blockquote>\n<h5><a name=\"_Toc461542655\"><\/a>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<strong> Exporting the certificate using the internet explorer<\/strong><\/h5>\n<ul>\n<li>Open in the internet explorer in the <a href=\"https:\/\/www.microsoft.com\/en-us\/cloud-platform\/windows-server-2012-r2\">windows server<\/a> and click on internet options<\/li>\n<\/ul>\n<ul>\n<li>navigate to content and click on certificate<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-207\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/1-235x300.png\" alt=\"1\" width=\"235\" height=\"300\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/1-235x300.png 235w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/1.png 424w\" sizes=\"auto, (max-width: 235px) 100vw, 235px\" \/><\/p>\n<ul>\n<li>In the certificates tab navigate to trusted root certificates and click on the certificate with your server name. (in this case server name is ADSERVER)<\/li>\n<\/ul>\n<p style=\"text-align: center\">\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-206 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/2-286x300.png\" alt=\"2\" width=\"286\" height=\"300\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/2-286x300.png 286w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/2.png 519w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/p>\n<ul>\n<li>A new popup will populate\u00a0with certificate name that you have selected, in that click on details tab and select copy\u00a0file option.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-205 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/3-239x300.png\" alt=\"3\" width=\"239\" height=\"300\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/3-239x300.png 239w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/3.png 417w\" sizes=\"auto, (max-width: 239px) 100vw, 239px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Then new popup windows will appear, in that click next.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-204 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/4-300x289.png\" alt=\"4\" width=\"300\" height=\"289\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/4-300x289.png 300w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/4.png 551w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>select the option do not export private key and click next<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-203 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/5-300x288.png\" alt=\"5\" width=\"300\" height=\"288\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/5-300x288.png 300w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/5.png 547w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Select the base 64 encoded and click next.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-202 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/6-300x291.png\" alt=\"6\" width=\"300\" height=\"291\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/6-300x291.png 300w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/6.png 545w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Provide the path and name to certificate.<\/li>\n<li>Verify the options and click on finish.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-201 aligncenter\" src=\"http:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/7-300x288.png\" alt=\"7\" width=\"300\" height=\"288\" srcset=\"https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/7-300x288.png 300w, https:\/\/www.enhisecure.com\/isecureblog\/wp-content\/uploads\/2016\/09\/7.png 548w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h5><a name=\"_Toc461542656\"><\/a>\u00a0\u00a0\u00a0\u00a0\u00a0 ii.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<strong>\u00a0 Exporting the certificate using command prompt<\/strong><\/h5>\n<ul>\n<li>open command prompt in your <a href=\"https:\/\/www.microsoft.com\/en-us\/cloud-platform\/windows-server-2012-r2\">windows server<\/a><\/li>\n<li>navigate to the folder where you want save certificate<\/li>\n<li>enter the following command to export the certificate<\/li>\n<\/ul>\n<blockquote>\n<p style=\"text-align: center\"><strong>&gt; certutil -ca.cert sslcert.cer<\/strong><\/p>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><a name=\"_Toc461542657\"><\/a>2.\u00a0\u00a0\u00a0 <strong>Importing certificate into java <a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/technotes\/tools\/solaris\/keytool.html\">keytool<\/a><\/strong><\/h4>\n<p>&nbsp;<\/p>\n<p>After exporting the sslcert.cer file, copy the file into host machine installed with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_(software_platform)\">java<\/a>.<\/p>\n<p>The following steps explains to import sslcert.cer file into java <a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/technotes\/tools\/solaris\/keytool.html\">key tool<\/a> in various environments<\/p>\n<h5><a name=\"_Toc461542658\"><\/a>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<strong>\u00a0 Linux<\/strong><\/h5>\n<ul>\n<li>Open the terminal in the folder which containing the exported file<\/li>\n<li>execute the following command<\/li>\n<\/ul>\n<p style=\"text-align: center\"><strong># keytool -importcer -keystore JAVA_HOME\/jre\/lib\/security\/cacerts -file sslcert.cer<\/strong><\/p>\n<ul>\n<li>Default password for the <a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/security\/KeyStore.html\">keystore <\/a>is: <strong>changeit<\/strong><\/li>\n<li>Enter yes to import the certificate to <a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/security\/KeyStore.html\">key store<\/a><\/li>\n<\/ul>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/strong><\/p>\n<h5><a name=\"_Toc461542659\"><\/a>\u00a0\u00a0\u00a0\u00a0 ii.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Windows<\/strong><\/h5>\n<ul>\n<li>Open the command prompt in administrator.<\/li>\n<li>navigate to the folder containing exported certificate file<\/li>\n<li>Execute the following command<\/li>\n<\/ul>\n<p style=\"text-align: center\"><strong>&gt; keytool -importcer -keystore JAVA_HOME\/jre\/lib\/security\/cacerts -file sslcert.cer<\/strong><\/p>\n<ul>\n<li>Default password for the <a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/security\/KeyStore.html\">keystore <\/a>is: <strong>changeit<\/strong><\/li>\n<li>Enter yes to import the certificate to <a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/security\/KeyStore.html\">key store<\/a><\/li>\n<\/ul>\n<p><strong>\u00a0<\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using JNDI\u00a0we can\u00a0access the active directory,\u00a0but if we want to access the active directory using the secure port we need to get the certificate issued by the active directory certification services. The certificate helps to authenticate the server over\u00a0SSL. SSL\u00a0authentication is useful when we need to\u00a0perform\u00a0the administrative stuff like changing password using JNDI. Active directory [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":266,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[40,28,45],"class_list":["post-193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-active-directory","tag-application-configuration-rules","tag-authentication"],"_links":{"self":[{"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":20,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":212,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/posts\/193\/revisions\/212"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/media\/266"}],"wp:attachment":[{"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.enhisecure.com\/isecureblog\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}