[VMware vSphere] vCenter Server のマシン SSL 証明書を 10 年の有効期限で更新する

今回は vCenter Server のマシン SSL 証明書 (デフォルトの VMCA に署名された)
を 10 年の有効期限で更新する方法について記載します。

vCenter Server のマシン SSL 証明書を 10 年の有効期限で更新する

更新前の有効期限確認

まずは、以下のコマンドで更新前の有効期限を確認しておきます。

for store in $(/usr/lib/vmware-vmafd/bin/vecs-cli store list | grep -v TRUSTED_ROOT_CRLS); do echo "[*] Store :" $store; /usr/lib/vmware-vmafd/bin/vecs-cli entry list --store $store --text | grep -ie "Alias" -ie "Not After";done;

実行結果は以下となり、マシン SSL 証明書は 2025 年までが有効期限
となっています。

[*] Store : MACHINE_SSL_CERT ★★★
Alias :	__MACHINE_CERT ★★★
            Not After : Feb 17 13:51:01 2025 GMT ★★★
[*] Store : TRUSTED_ROOTS
Alias :	362fb7047e535b83da4a7c03dc7a14f93e2315b2
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : machine
Alias :	machine
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vsphere-webclient
Alias :	vsphere-webclient
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vpxd
Alias :	vpxd
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vpxd-extension
Alias :	vpxd-extension
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : hvc
Alias :	hvc
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : data-encipherment
Alias :	data-encipherment
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : APPLMGMT_PASSWORD
[*] Store : SMS
Alias :	sms_self_signed
            Not After : Feb 18 02:00:57 2033 GMT
[*] Store : wcp
Alias :	wcp
            Not After : Feb 12 01:50:59 2033 GMT

vCenter Server の各バージョンにおける証明書のデフォルトの
有効期限は以下にまとめています。

マシン SSL 証明書の更新手順

まずは、KB90561 の Attachments から [fixcerts.py] をダウンロードします。

・How to Replace Expired Certificates on vCenter Server using Fixcerts Python Script (90561)
 https://kb.vmware.com/s/article/90561?lang=en_US

上記 KB90561 からダウンロードした [fixcerts.py] を WinSCP 等を使用
して vCSA にアップロードするか、KB90561 の Resolution に記載された
手順でコピペします。

vCSA 上に [fixcerts.py] のアップロードが完了した後、以下のコマンドで
マシン SSL 証明書を更新します。

python fixcerts.py replace --certType machinessl --serviceRestart True --validityDays 3650

[–serviceRestart True] オプションにより証明書更新後に、自動でサービス再起動
を行うようにします。

[–validityDays 3650] オプションにより、証明書の有効期限を指定します。
※ 1 ~ 3650 日の間で指定できます。

実際に実行してみると以下のようになります。

root@vcsa [ ~ ]# python fixcerts.py replace --certType machinessl --serviceRestart True --validityDays 3650
Please enter the password for administrator@vsphere.local to proceed further : ★"administrator@vsphere.local" のパスワード入力
+--------------------+----------------------+
|  CertificateType   |       Validity       |
+--------------------+----------------------+
|  MACHINE_SSL_CERT  | Feb 17 13:51:01 2025 |
|      machine       | Feb 12 01:50:59 2033 |
| vsphere-webclient  | Feb 12 01:50:59 2033 |
|        vpxd        | Feb 12 01:50:59 2033 |
|   vpxd-extension   | Feb 12 01:50:59 2033 |
|        hvc         | Feb 12 01:50:59 2033 |
| data-encipherment  | Feb 12 01:50:59 2033 |
|        SMS         | Feb 18 02:00:57 2033 |
|        wcp         | Feb 12 01:50:59 2033 |
| Signing Cert (STS) | Feb 12 01:50:59 2033 |
+--------------------+----------------------+
+------------------------------------------+----------------------+------+
|           TRUSTED_ROOTS_Alias            |       Validity       | Type |
+------------------------------------------+----------------------+------+
| 362fb7047e535b83da4a7c03dc7a14f93e2315b2 | Feb 12 01:50:59 2033 |  CA  |
+------------------------------------------+----------------------+------+

This script will replace the certificates on vCenter Server, please read below important points :

	1. Services needs to be restarted for certificate replacement, you may do it manually or let the script do it
	2. Services on partner VCs in Linked Mode also needs to be restarted after replacing STS (Secure Token Signing) certificate, as VCs in ELM uses same STS Certificate
	   Note: Point 2 is Not Applicable for vCenter Server 8.0, as service restart is not required for STS Certificate Replacement on 8.0.
	3. Please make sure you have taken OFFLINE SNAPSHOT of all the VCs in the Linked Mode before continuing with the Certificate replacement


Please read above points and enter YES to proceed further [[Yes/yes/YES/Y/y]] ? y

Reading Hostname Type & Deployment Type.
...Waiting for Status
......Success


Doing Pre-Check before starting the actual certificate replacement
...Waiting for Status
......Success


Following are the Certificate Fields based on existing Machine SSL Certificate :
Country		: US
Organization	: VMware
OrgUnit		: VMware Engineering
State		: California
Locality	: Palo Alto

Do you want to proceed with the default values mentioned above ? please enter YES/NO [[Yes/yes/YES/Y/y] or [No/no/NO/N/n]] ? y
Replacing Machine SSL Cert.
...Waiting for Status
......Success

Updating SSL Trust of Services with new Machine SSL Certificate.
...Waiting for Status
......Success


Stopping All Services.
...Waiting for Status
......Success


Starting All Services.
...Waiting for Status
......Success


Validity of Certificates post replacement:
+--------------------+----------------------+
|  CertificateType   |       Validity       |
+--------------------+----------------------+
|  MACHINE_SSL_CERT  | Feb 11 22:15:11 2033 |
|      machine       | Feb 12 01:50:59 2033 |
| vsphere-webclient  | Feb 12 01:50:59 2033 |
|        vpxd        | Feb 12 01:50:59 2033 |
|   vpxd-extension   | Feb 12 01:50:59 2033 |
|        hvc         | Feb 12 01:50:59 2033 |
| data-encipherment  | Feb 12 01:50:59 2033 |
|        SMS         | Feb 18 02:00:57 2033 |
|        wcp         | Feb 12 01:50:59 2033 |
| Signing Cert (STS) | Feb 12 01:50:59 2033 |
+--------------------+----------------------+
+------------------------------------------+----------------------+------+
|           TRUSTED_ROOTS_Alias            |       Validity       | Type |
+------------------------------------------+----------------------+------+
| 362fb7047e535b83da4a7c03dc7a14f93e2315b2 | Feb 12 01:50:59 2033 |  CA  |
+------------------------------------------+----------------------+------+

Successfully Completed the Certificate Replacement -> Total Execution Time ## 655 seconds ##

更新が完了した後に、再度証明書の有効期限を確認すると 2033 年まで
有効期限が伸びていることが確認できます。

※※※注意事項※※※
vCenter Server の各種証明書は最大でルート証明書の有効期限までで
しか更新をすることができません。

そのため、更新時のオプションで 10 年の有効期限を指定して更新を
実施しましたが、ルート証明書の有効期限と同じ有効期限で更新が行わ
れています。

10 年の有効期限で更新するとは記載していますが、最大でルート証明書
の有効期限まででの更新となります。
(ルート証明書の有効期限が残り 10 年であれば、マシン SSL 証明書も
10 年の有効期限で更新可能)

[*] Store : MACHINE_SSL_CERT ★★★
Alias :	__MACHINE_CERT ★★★
            Not After : Feb 11 22:15:11 2033 GMT ★★★
[*] Store : TRUSTED_ROOTS
Alias :	362fb7047e535b83da4a7c03dc7a14f93e2315b2
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : machine
Alias :	machine
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vsphere-webclient
Alias :	vsphere-webclient
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vpxd
Alias :	vpxd
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : vpxd-extension
Alias :	vpxd-extension
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : hvc
Alias :	hvc
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : data-encipherment
Alias :	data-encipherment
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : APPLMGMT_PASSWORD
[*] Store : SMS
Alias :	sms_self_signed
            Not After : Feb 18 02:00:57 2033 GMT
[*] Store : wcp
Alias :	wcp
            Not After : Feb 12 01:50:59 2033 GMT
[*] Store : BACKUP_STORE
Alias :	bkp___MACHINE_CERT
            Not After : Feb 17 13:51:01 2025 GMT

まとめ

今回は、これまで 2 年の有効期限でしか更新できなかった マシン SSL
証明書を最大 10 年の有効期限で更新する方法について記載しました。

KB90561 の [fixcerts.py] を使用することで他の証明書でも色々行える
ようになっています。

・How to Replace Expired Certificates on vCenter Server using Fixcerts Python Script (90561)
 https://kb.vmware.com/s/article/90561?lang=en_US

以下の記事で WCP 証明書を 10 年の有効期限で更新する方法を記載して
いますが、KB90561 の [fixcerts.py] でも 10 年の有効期限で更新できる
と思います。 ※実際に確認はしていません。

タイトルとURLをコピーしました