[6] Exchange Server 2019 – Aktualizacja certyfikatów
15 stycznia 2025Certyfikaty dla usług Exchange Server są generowane i konfigurowane podczas instalacji, jednak w razie potrzeby możesz je zastąpić swoimi własnymi certyfikatami.
W tym przykładzie używa certyfikatu z podpisem własnym – tak jak to opisano w „Tworzenie certyfikatu z podpisem własnym – Rocky Linux 9”. Jednak nic nie stoi na przeszkodzie, aby skorzystać z certyfikatów na przykład od Let’s Encrypt – o tym jak je uzyskać przeczytasz w „Tworzenie certyfikatu z wykorzystaniem Let’s Encrypt – Rocky Linux 9”.
Zaloguj się do komputera z system Rocky Linux 9 i stwórz zestaw certyfikatów dla komputera z zainstalowanym serwerem pocztowym Exchange 2019.
[root@vrl01 ~]# cd /etc/pki/tls/certs/ [root@vrl01 certs]# vi /etc/ssl/openssl.cnf # dodaj na końcu [ zicher.lab ] subjectAltName = DNS:vwsr02.zicher.lab [root@vrl01 certs]# openssl genrsa -aes128 2048 > winserver.key Enter PEM pass phrase: # wpisz hasło dla klucza Verifying - Enter PEM pass phrase: # wpisz hasło dla klucza ponownie [root@vrl01 certs]# openssl rsa -in winserver.key -out winserver.key Enter pass phrase for winserver.key: # wpisz hasło klucza writing RSA key [root@vrl01 certs]# openssl req -utf8 -new -key winserver.key -out winserver.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:PL State or Province Name (full name) []:Katowice Locality Name (eg, city) [Default City]:Rybnik Organization Name (eg, company) [Default Company Ltd]:zicher.LAB Organizational Unit Name (eg, section) []:zicherLAB Common Name (eg, your name or your server's hostname) []:vwsr02.zicher.lab Email Address []:administrator@zicher.lab Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: [root@vrl01 certs]# openssl x509 -in winserver.csr -out winserver.crt -req -signkey winserver.key -extfile /etc/ssl/openssl.cnf -extensions zicher.lab -days 3650 Certificate request self-signature ok subject=C = PL, ST = Katowice, L = Rybnik, O = zicher.LAB, OU = zicherLAB, CN = vwsr02.zicher.lab, emailAddress = administrator@zicher.lab # wyeksportuj stworzone certyfikaty do formatu zrozumiałego przez system Windows [root@vrl01 certs]# openssl pkcs12 -export -in winserver.crt -inkey winserver.key -out crt_for_exchange.pfx Enter Export Password: # wpisz hasło dla certyfikatu Verifying - Enter Export Password: # wpisz hasło dla certyfikatu ponownie [root@vrl01 certs]# ll razem 32 lrwxrwxrwx. 1 root root 49 2023-09-13 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem lrwxrwxrwx. 1 root root 55 2023-09-13 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt -rw-------. 1 root root 2787 06-18 23:48 crt_for_exchange.pfx -rw-r--r--. 1 root root 2212 04-09 12:17 postfix.pem -rw-r--r--. 1 root root 1432 03-12 12:54 server.crt -rw-r--r--. 1 root root 1066 03-12 12:53 server.csr -rw-------. 1 root root 1704 03-12 12:53 server.key -rw-r--r--. 1 root root 1464 06-18 23:43 winserver.crt -rw-r--r--. 1 root root 1082 06-18 23:42 winserver.csr -rw-r--r--. 1 root root 1704 06-18 23:38 winserver.key
Przenieś bezpiecznym kanałem certyfikat z serwera gdzie został on wygenerowany, na serwer pocztowy Exchange.
Uruchom PowerShell z uprawnieniami administratora i skonfiguruj certyfikaty na komputerze z zainstalowanym serwerem pocztowym Exchange 2019.
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows # zachowaj w zmiennej hasło do certyfikatu, który stworzyłeś dla serwera pocztowego Exchange, na początku tego rozdziału PS C:\Windows\system32> $Password = ConvertTo-SecureString -AsPlainText -Force "1Tajne&Haslo2"
W przypadku interfejsu graficznego układ certyfikatów przedstawia się następująco.
# zaimportuj certyfikat do [Cert:\LocalMachine\My] PS C:\Windows\system32> Import-PfxCertificate -FilePath C:\Users\exchangeadmin\Documents\crt_for_exchange.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $Password PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My Thumbprint Subject ---------- ------- 4F98625DF182540243A317EA13597618C2CE3680 E=administrator@zicher.lab, CN=vwsr02.zicher.lab, OU=zicherLAB, O=zicher.LAB, L... PS C:\Windows\system32> Get-ChildItem Cert:\LocalMachine\My PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My Thumbprint Subject ---------- ------- F067DF06831B787569CE4733E7EC6100C912D529 CN=Microsoft Exchange Server Auth Certificate 4F98625DF182540243A317EA13597618C2CE3680 E=administrator@zicher.lab, CN=vwsr02.zicher.lab, OU=zicherLAB, O=zicher.LAB, L... 4B7E0D6910E54185E58A7EC5B4EDDFC023D66AA6 CN=WMSvc-SHA2-VWSR02 34B469A546406EBFF97738DD861FB3DA10B3AED9 CN=vwsr02 # wszystkie certyfikaty oprócz [4F98625DF182540243A317EA13597618C2CE3680] zostały wygenerowane automatycznie w czasie instalacji serwera pocztowego Exchange 2019 PS C:\Windows\system32> LaunchEMS Welcome to the Exchange Management Shell! Full list of cmdlets: Get-Command Only Exchange cmdlets: Get-ExCommand Cmdlets that match a specific string: Help *<string>* Get general help: Help Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -? Exchange team blog: Get-ExBlog Show full output for a command: <command> | Format-List Show quick reference guide: QuickRef VERBOSE: Connecting to vwsr02.zicher.lab. VERBOSE: Connected to vwsr02.zicher.lab. # przypisz nowy certyfikat do usług [PS] C:\Windows\system32>Enable-ExchangeCertificate -Thumbprint 4F98625DF182540243A317EA13597618C2CE3680 -Services POP,IMAP,IIS,SMTP Confirm Overwrite the existing default SMTP certificate? Current certificate: '34B469A546406EBFF97738DD861FB3DA10B3AED9' (expires 18.06.2029 01:41:19) Replace it with certificate: '4F98625DF182540243A317EA13597618C2CE3680' (expires 16.06.2034 23:43:25) [Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y # zrestartuj usługę Exchange [PS] C:\Windows\system32>Restart-Service MSExchangeIS [PS] C:\Windows\system32>Get-ExchangeCertificate Thumbprint Services Subject ---------- -------- ------- 4F98625DF182540243A317EA13597618C2CE3680 IP.WS.. E=administrator@zicher.lab, CN=vwsr02.ziche... F067DF06831B787569CE4733E7EC6100C912D529 ....... CN=Microsoft Exchange Server Auth Certificate 34B469A546406EBFF97738DD861FB3DA10B3AED9 IP.W... CN=vwsr02 4B7E0D6910E54185E58A7EC5B4EDDFC023D66AA6 ....... CN=WMSvc-SHA2-VWSR02 [PS] C:\Windows\system32>exit