certify icon indicating copy to clipboard operation
certify copied to clipboard

Certificate renewals with Exchange/ Edge server

Open webprofusion-chrisc opened this issue 8 years ago • 8 comments

@lucize Issue text copied from: https://github.com/webprofusion/certify/issues/270#issuecomment-386429764

@webprofusion-chrisc so here is my experience with the app this is the situation before renew

[PS] C:\Windows\system32>Get-ExchangeCertificate

Thumbprint                                Services   Subject
----------                                --------   -------
5E4325D6195B5E2932EAE402F515172DC827D083  IP.WS.     CN=mail
8E309044815B47A130C6151644263D781DF839C0  ....SF     CN=Fede
7CC1A6A8C7151C6E7D8079030334B4C8353CE67C  ....S.     CN=exhc

image

after the renew

[PS] C:\Windows\system32>Get-ExchangeCertificate

Thumbprint                                Services   Subject
----------                                --------   -------
90158F1DC655C04E65E91198EA507562A837ECC4  IP....     CN=mail.t
8E309044815B47A130C6151644263D781DF839C0  ....SF     CN=Federa
7CC1A6A8C7151C6E7D8079030334B4C8353CE67C  ....S.     CN=exhctn

image

so the thumbprint was changed after the console reload:

image

the certificate is missing smtp and iis I now manually assign the certificate to smtp and iis

image

and

image

so I need to make a new

New-EdgeSubscription -FileName "C:\temp\EdgeSubscriptionInfo.xml" and import the file in the edgesync interface on the management console

these are the event viewer error right after the renew

MSExchange EdgeSync
Microsoft Exchange EdgeSync can't find the replication credential on edge01tn.etc.local to synchronize with Edge server %2. This may happen if %1 joined the current Active Directory site after subscription for %2 was established. To have this Hub Transport server participate in EdgeSync, re-subscribe %2 to the current Active Directory site.

and

MSExchange Transport
Microsoft Exchange could not load the certificate with thumbprint of 5E4325D6195B5E2932EAE402F515172DC827D083 from the personal store on the local computer. This certificate was configured for authentication with other Exchange servers. Mail flow to other Exchange servers could be affected by this error. If the certificate with this thumbprint still exists in the personal store, run Enable-ExchangeCertificate 5E4325D6195B5E2932EAE402F515172DC827D083 -Services SMTP to resolve the issue. If the certificate does not exist in the personal store, restore it from backup by using the Import-ExchangeCertificate cmdlet, or create a new certificate for the FQDN or the server enabled for SMTP by running the following command: New-ExchangeCertificate -DomainName serverfqdn -Services SMTP. Meanwhile, the certificate with thumbprint 7CC1A6A8C7151C6E7D8079030334B4C8353CE67C is being used.

so the old certificate is still present in the AD (as a thumbprint) and there are references to it

webprofusion-chrisc avatar May 04 '18 00:05 webprofusion-chrisc

@lucize the app will request/renewal certificates and install them into the computer certificate store, it can also update bindings in IIS (for websites). Beyond that it does not do configuration of other services unless you use additional powershell scripting.

Did you use a script to enable the certificate in exchange? If so can you provide an example?

webprofusion-chrisc avatar May 04 '18 00:05 webprofusion-chrisc

so before using this app I would make a certificate request using the web interface provided and import the certificate using the management console and after that assign the services to the new certificate (IMAP,POP,IIS,SMTP)

using this approach would not lead to edge certificate corruption, but I'll try to use for smtp a self signed cert and only for iis,imap and pop the let's encrypt one and see what will happen

lucize avatar May 05 '18 10:05 lucize

@lucize Ok, in Certify you need to add a 'Post Request' script like this: https://docs.certifytheweb.com/docs/script-hooks.html#example-enable-certificate-for-exchange-2013-2016-services-on-same-server

Otherwise your new certificate only gets set in IIS (https traffic), not for other services.

The exact script will vary depending on the environment and what you need to enable, but it's the standard powershell method and you should be able to construct a suitable script for what you need.

webprofusion-chrisc avatar May 05 '18 11:05 webprofusion-chrisc

Hi,

i am now using the new Version. I think you might have a Problem in your Exchange Powershell Script...

You are using:

This script enables the use of the newly retrieved and stored certificate with common Exchange services

For more script info see https://github.com/webprofusion/certify/blob/master/docs/Request%20Script%20Hooks.md

param($result)

tell Exchange which services to use this certificate for

Enable-ExchangeCertificate -Thumbprint $result.ManagedItem.CertificateThumbprintHash -Services POP,IMAP,SMTP,IIS

but its not working as it should! because you dont add this line "Add-PSSnapin Exchange" and when you run a test, it wont tell me if its OK or not... So i added "write-output "Powershell Script Erfolgreich?" $result.IsSuccess"

Here is the correct Script.... Maybe you fix it in a Update?!

This script enables the use of the newly retrieved and stored certificate with common Exchange services

For more script info see https://github.com/webprofusion/certify/blob/master/docs/Request%20Script%20Hooks.md

param($result)

tell Exchange which services to use this certificate for

Script by Jaggl

param($result) write-output "Powershell Script Erfolgreich?" $result.IsSuccess Add-PSSnapin Exchange Enable-ExchangeCertificate -Thumbprint $result.ManagedItem.CertificateThumbprintHash -Services "SMTP, IMAP, POP, IIS" –Force

Jaggl-AT avatar Aug 07 '18 14:08 Jaggl-AT

i see you released a new version but you still did not fix it :(

Jaggl-AT avatar Aug 22 '18 08:08 Jaggl-AT

@Jaggl-AT sorry about that, the most recent updates have been mostly stability/bug fixes.

webprofusion-chrisc avatar Aug 22 '18 10:08 webprofusion-chrisc

yeah but i think this is also a bug because the script is not working is it is ;)

Jaggl-AT avatar Aug 22 '18 11:08 Jaggl-AT

Superseded by the new Deployment Task for Exchange in v5.x

webprofusion-chrisc avatar May 13 '20 05:05 webprofusion-chrisc