{"id":3234,"date":"2018-06-27T10:46:35","date_gmt":"2018-06-27T15:46:35","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=3234"},"modified":"2018-06-27T10:52:40","modified_gmt":"2018-06-27T15:52:40","slug":"updating-weblogic-certificate-for-oud-management-utility","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=3234","title":{"rendered":"Updating Weblogic Certificate For OUD Management Utility"},"content":{"rendered":"<p><span style=\"font-size: 12pt; color: #ffffff;\">This is the process I use to update the WebLogic SSL certificate for our OUD management web interface.\u00a0<\/span><\/p>\n<p><span style=\"font-size: 12pt; color: #ffffff;\"><br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># PRE-CHANGE VERIFICATION<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># There are two environment variables set to allow this to work:<br \/>\n#\u00a0<span style=\"font-size: 12pt;\">WLSTOREPASS=Wh@t3v3rY0uU53d # WLSTOREPASS is set to whatever is used for the keystore and truststore password<\/span><br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># OUDINST=\/path\/to\/OUD\/installation (root into which both java and OUD were installed &#8212; if you are using an OS package<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># for java, your paths will be different)<br \/>\n#Log into <a style=\"color: #ffffff;\" href=\"https:\/\/hostname.dommain.gTLD:7002\/console\">https:\/\/hostname.domain.gTLD:7002\/console<\/a> (or whatever your WL console URL is)<br \/>\n# As my WebLogic instance auths users via LDAP, I log in with my UID &amp; pwd &#8230; you may have a generic account like &#8216;admin&#8217;<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Navigate to Domain Structure =&gt; Environment =&gt; Servers<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Select &#8220;AdminServer&#8221;<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Keystores tab &#8212; will tell you the name of the keystore and trust store<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#SSL tab &#8212; will tell you the friendly name of the certificate<br \/>\n<\/span><span style=\"font-size: 12pt;\"># Verify the keystore and truststore are $OUDINST\/Oracle\/Middleware\/${HOSTNAME%%.*}.jks,<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># Verify the friendly name of the certificate is the short hostname<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># Verify the keystore is using the normal keystore password<br \/>\n<\/span><span style=\"font-size: 12pt;\">#[ldap@dell115 ~]$ $OUDINST\/java\/jdk\/bin\/keytool -v -list -keystore $OUDINST\/Oracle\/Middleware\/dell115.jks &#8211;storepass $WLSTOREPASS| grep Alias<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Alias name: dell115<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Alias name: win-we<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Alias name: win-root<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Alias name: winca1-root<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#Alias name: winca1-issuing<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># *** If you do not get any output, remove the &#8221; | grep Alias&#8221; part and check for errors. &#8220;keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect&#8221; means the password is different.<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># *** either try to guess the password (company name or &#8216;a&#8217; are good guesses, along with the java-typical default of changeit)<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># *** to continue using the existing password or you&#8217;ll need to update the keystore and truststore passwords in the web GUI.<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># *** Since the keystores are generated using the process below &#8230; 99% of the time, the password matches.<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">#<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># Generate a cert with appropriate info, export public\/private key as a PFX file named with the short hostname of the server (i.e. dell115.pfx here) and, as the keystore password, use whatever you&#8217;ve set in\u00a0<span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span><\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\">\u00a0<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># DURING THE CHANGE,\u00a0as the ldap service account on the server:<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\">mkdir \/tmp\/ssl<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Put base 64 public keys for our root and web CA in \/tmp\/ssl as Win-Root-CA.b64.cer and Win-Web-CA.b64.cer<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># Put public\/private key export from above\u00a0in \/tmp\/ssl<\/span><span style=\"font-size: 12pt; color: #ffffff;\">\u00a0<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Import the keychain for your certificate<br \/>\n$OUDINST\/java\/jdk\/bin\/keytool -import -v -trustcacerts -alias WIN-ROOT -file \/tmp\/ssl\/Win-Root-CA.b64.cer -keystore \/tmp\/ssl\/${HOSTNAME%%.*}.jks -keypass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span> -storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span><\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\">$OUDINST\/java\/jdk\/bin\/keytool -import -v -trustcacerts -alias WIN-WEB -file \/tmp\/ssl\/Win-Web-CA.b64.cer -keystore \/tmp\/ssl\/${HOSTNAME%%.*}.jks -keypass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span> -storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span><\/span><span style=\"font-size: 12pt; color: #ffffff;\">\u00a0<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># get GUID for cert within PFX file<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">HOSTCERTALIAS=&#8221;$($OUDINST\/java\/jdk\/bin\/keytool -v -list -storetype pkcs12 -keystore \/tmp\/ssl\/${HOSTNAME%%.*}.pfx &#8211;storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS\u00a0<\/span>| grep Alias | cut -d: -f2-)&#8221;<\/span><span style=\"font-size: 12pt; color: #ffffff;\">\u00a0<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Import the private key<br \/>\n$OUDINST\/java\/jdk\/bin\/keytool -importkeystore -srckeystore \/tmp\/ssl\/${HOSTNAME%%.*}.pfx -destkeystore \/tmp\/ssl\/${HOSTNAME%%.*}.jks -srcstoretype pkcs12 -deststoretype JKS -alias $HOSTCERTALIAS -storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS\u00a0<\/span>-srcstorepass Ra1n1ng1<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Change the alias to match what is configured in the web GUI<br \/>\n$OUDINST\/java\/jdk\/bin\/keytool -changealias -alias $HOSTCERTALIAS -destalias ${HOSTNAME%%.*} -keypass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span>-keystore \/tmp\/ssl\/${HOSTNAME%%.*}.jks -storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span><\/span><span style=\"font-size: 12pt; color: #ffffff;\">\u00a0<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Verify you have a WIN-ROOT, WIN-WEB, and hostname record<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\">$OUDINST\/java\/jdk\/bin\/keytool -v -list -keystore \/tmp\/ssl\/${HOSTNAME%%.*}.jks &#8211;storepass <span style=\"font-size: 12pt;\">$WLSTOREPASS<\/span> | grep Alias<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Stop the weblogic server<\/span><\/p>\n<p class=\"xmsonormal\"># Back up current keystore file and move new one into place<br \/>\n<span style=\"font-size: 12pt; color: #ffffff;\">CURRENTDATE=&#8221;$(date +%Y%m%d)&#8221;<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">mv $OUDINST\/Oracle\/Middleware\/${HOSTNAME%%.*}.jks $OUDINST\/Oracle\/Middleware\/$CURRENTDATE.jks<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">cp \/tmp\/ssl\/${HOSTNAME%%.*}.jks $OUDINST\/Oracle\/Middleware\/${HOSTNAME%%.*}.jks<\/span><\/p>\n<p class=\"xmsonormal\"><span style=\"font-size: 12pt; color: #ffffff;\"># Start the weblogic server in the screen session, then disconnect from the screen session <\/span><\/p>\n<p><span style=\"font-size: 12pt; color: #ffffff;\"># Assuming success<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">rm -rf \/tmp\/ssl<\/span><\/p>\n<p><span style=\"font-size: 12pt; color: #ffffff;\"># Backout is<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># stop weblogic<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\">mv $OUDINST\/Oracle\/Middleware\/$CURRENTDATE.jks\u00a0\u00a0$OUDINST\/Oracle\/Middleware\/${HOSTNAME%%.*}.jks<br \/>\n<\/span><span style=\"font-size: 12pt; color: #ffffff;\"># start weblogic<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the process I use to update the WebLogic SSL certificate for our OUD management web interface.\u00a0 # PRE-CHANGE VERIFICATION # There are two environment variables set to allow this to work: #\u00a0WLSTOREPASS=Wh@t3v3rY0uU53d # WLSTOREPASS is set to whatever is used for the keystore and truststore password # OUDINST=\/path\/to\/OUD\/installation (root into which both java &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[591,236,523],"class_list":["post-3234","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-oud","tag-ssl","tag-weblogic"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3234"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3234\/revisions"}],"predecessor-version":[{"id":3238,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3234\/revisions\/3238"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}