{"id":850,"date":"2023-03-23T22:14:22","date_gmt":"2023-03-23T22:14:22","guid":{"rendered":"https:\/\/robinplomp.com\/?p=850"},"modified":"2023-03-23T22:14:22","modified_gmt":"2023-03-23T22:14:22","slug":"replace-local-manager-certificate","status":"publish","type":"post","link":"https:\/\/robinplomp.com\/?p=850","title":{"rendered":"Replace Local Manager Certificate"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"179\" height=\"150\" title=\"image\" align=\"left\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2022\/09\/image_thumb-5.png\" border=\"0\">A customer send out the request to take a look at a few alarms they received in the NSX Manager console. The alarm they received was about a expiring certificate for local manager. <\/p>\n<p>We did some investigating from the NSX Manager and it was clear that this was a self-signed (not linked to the company own PKI infrastructure) and it was in use. This last comment means we have to use the <strong>Application Programing Interface <\/strong>(API) to tell NSX to use the new certificate.<\/p>\n<p>Since this is a production environment we don\u2019t do anything before we have verified that a recent backup of the NSX database is available. Please take note that a VMware snapshot is not supported the restore a NSX Manager Cluster. It is&nbsp; best practice to have a scheduled NSX Manager backup schedule. Before we start working on the environment we create a manual backup of the NSX database.<\/p>\n<p><!--more--><\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"163\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb.png\" border=\"0\"><\/a><\/p>\n<p>When we have verified that we have a recent backup we move to the certificate node (Click system &gt; click certificates &gt; click the certificates tab) to verify which certificate we need to update. <\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"19\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-1.png\" border=\"0\"><\/a><\/p>\n<p>Under certificates we move to the tab CSR and select Generate CSR&gt; Generate CSR.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"367\" height=\"211\" title=\"image\" style=\"margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-2.png\" border=\"0\"><\/a><\/p>\n<p>In the following screen we need to collect data for the new certificate.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"382\" height=\"451\" title=\"image\" style=\"margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-3.png\" border=\"0\"><\/a><\/p>\n<p>Under the tab CSR we see our new request.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"550\" height=\"93\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-4.png\" border=\"0\"><\/a><\/p>\n<p>By selecting this line we choose Self Sign Certificate for CSR from the context menu.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"430\" height=\"260\" title=\"image\" style=\"margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-5.png\" border=\"0\"><\/a><\/p>\n<p>In the following window we can choose how long the certificate is valid and indicate if this is a service certificate (which it is not).<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"431\" height=\"255\" title=\"image\" style=\"margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-6.png\" border=\"0\"><\/a><\/p>\n<p>The certificate is now created, but we are not finished we have to tell NSX to use the new certificate. To create the API calls to configure this we need the have the certificate ID. <\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"603\" height=\"96\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-7.png\" border=\"0\"><\/a><\/p>\n<p>We are able to locate this information from the NSX Manager UI.<\/p>\n<p>For the next phase we need Postman.<\/p>\n<p>Create the following command:<br \/>POST <a href=\"https:\/\/&lt;nsx-mgr.fqdn&gt;\/api\/v1\/trust-management\/certificates?action=set_pi_certificate_for_federation\">https:\/\/&lt;nsx-mgr.fqdn&gt;\/api\/v1\/trust-management\/certificates?action=set_pi_certificate_for_federation<\/a><\/p>\n<p>Enter your credentials for the NSX Manager on the authorization tab.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" width=\"555\" height=\"227\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-8.png\" border=\"0\"><\/a><\/p>\n<p>On tab header add key Content-Type, with value application\/json<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" width=\"568\" height=\"140\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-9.png\" border=\"0\"><\/a><\/p>\n<p>On tab Body, choose raw and select format JSON<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"218\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-10.png\" border=\"0\"><\/a><\/p>\n<p>Add the folowing lines<\/p>\n<p><strong>{ \u201ccert_id\u201d: \u201c&lt;id&gt;\u201d,<\/strong><\/p>\n<p><strong>\u201cservice_type\u201d: \u201cLOCAL_MANAGER\u201d }<\/strong><\/p>\n<p>Now you are ready to click send. If you entered everything correctly you will see the following message:<br \/><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-11.png\"><img loading=\"lazy\" decoding=\"async\" width=\"451\" height=\"64\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-11.png\" border=\"0\"><\/a><\/p>\n<p>Next we return to the certificate node. Notice that the new certificate is valid and in use.<\/p>\n<p><a href=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image-12.png\"><img loading=\"lazy\" decoding=\"async\" width=\"625\" height=\"38\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/robinplomp.com\/wp-content\/uploads\/2023\/03\/image_thumb-12.png\" border=\"0\"><\/a><\/p>\n<p>You can now remove the expired certificate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer send out the request to take a look at a few alarms they received in the NSX Manager console. The alarm they received was about a expiring certificate for local manager. We did some investigating from the NSX Manager and it was clear that this was a self-signed (not linked to the company &hellip; <a href=\"https:\/\/robinplomp.com\/?p=850\" class=\"more-link\">Lees verder <span class=\"screen-reader-text\">Replace Local Manager Certificate<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[76,78,58],"class_list":["post-850","post","type-post","status-publish","format-standard","hentry","category-nsx-t","tag-api","tag-certificate","tag-nsx"],"_links":{"self":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=850"}],"version-history":[{"count":1,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/850\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/850\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}