Certificate Rebind in IIS?
So what is it then? It´s a function to automaticlly replace an SSL certificate bound to a web site. If the certificate is renewed then the old one will be replace with the new one. Great isn´t it?
How does this work?
When you enable Certificate Rebind a task will be added to the Task Scheduler which is triggered by the event ID for certificate renewal (event ID 1001). And when a certificate is renewed a function called “Certificate Services Lifecycle Notifications”, which keeps track of certificate releated stuff, writes the renewal event to the event log and the rebind process starts. It simply provides appcmd.exe with the thumbprint of the expired and new certificate.
Then appcmd locates all websites on that server which uses the old cert. It unbinds the old cert and binds the new certs to the affected websites. And this works for both manually and autoenrolled certificates.
If you are really interested this is the command line:
appcmd.exe renew binding /oldcert:$(OldCertHash) /newcert:$(NewCertHash)
What triggers Event ID1001?
• Action (see sources column)
For old and new certificate:
• Subject names
• Renewal via autoenrollment (action=renew)
• Enrollment for a superseding (action=supersede)
• Renewal via MMC enrollment (action=renew)
• Renewal via certreq.exe (action=renew)
• Manually replacing on cert with another using Replace-Certificate PowerShell CmdLet (action=replace)
Note: If you want to use autoenrollment and the cert got a DNS name och SAN-attribute you have to enable “Use subject information from existing certificates for autoenrollment renewal requests” on the template.
Can this be done any other way and on other systems then IIS?
Sure! By using Powershell you can create custom tasks which is triggered by events created by “Certificate Services Lifecycle Notifications”
An excellent article on certificate rebind can be found here:
How to renew web server certificates automatically?
Certificate Services Lifecycle Notifications
But be aware! There are some pitfals and you should have some kind of idea about what you are doing! And remember: Keep it simple!!