Certificate selection is a process that Exchange components perform to determine which certificate should be used for an incoming connection. SMTP STARTTLS, POP3, and IMAP4 all perform a similar selection process to determine which certificate to use for a particular session. This process is fairly deterministic. However, it can be confusing, especially when more than one certificate is installed on the computer.
This section describes the certification selection process for SMTP STARTTLS, SMTP X-AnonymousTLS, POP3, and IMAP4. For more information about transport-specific certificate selection, see SMTP TLS Certificate Selection.
SMTP STARTTLS
STARTTLS is the SMTP verb that initiates a secure TLS session. STARTTLS is only advertised by Exchange if a valid certificate exists on the computer that is running Exchange.
To advertise or use STARTTLS, Exchange selects a certificate based on the FQDN and a matching value in the CertificateDomains field of a certificate. The FQDN is based on the following information:
- Outbound STARTTLS The certificate is selected based on the value of FQDN on a Send connector.
- Inbound STARTTLS The certificate is selected is based on the value of FQDN on a Receive connector.
Note: |
|---|
|
For outbound STARTTLS and inbound STARTTLS, if the FQDN of the connector is not specified, the physical FQDN of the Exchange server is used for the match.
|
After the FQDN is determined, Exchange searches Personal certificate store on the host computer for all valid certificates. A certificate is valid for TLS use if it meets all the following requirements:
-
The Enhanced Key Usage field contains either the Server Authentication object identifier (also known as OID) or is null.
-
The PKI certificate extension lists an RSA key with a minimum of 1024 bits.
-
The certificate validates the certificate chain up to a trusted root, or the certificate is self-signed.
-
The certificate and certificate chain passes the revocation check.
-
The private key is present and available.
-
The private key is not stored in a removable device.
-
The private key is not protected with a password.
If more than one valid certificate is found, Exchange selects a certificate based on the following criteria:
- The value in the NotBefore field Exchange selects the newest valid certificate.
- Certificates issued by a trusted CA vs. self-signed certificates Exchange selects certificates issued by a trusted CA over self-signed certificates.
In most cases, Exchange selects a certificate issued by a trusted CA over a self-signed certificate regardless of the age of the certificate. If a valid certificate is not found, STARTTLS is not advertised.
SMTP X-AnonymousTLS
X-AnonymousTLS is used to help secure communication between two Hub Transport servers and between Hub Transport servers and Edge Transport servers. In Exchange 2007 SP1, the certificate selection process has been simplified so that if no certificate is found, a temporary encryption key is generated for the session.
Exchange searches for an internal transport certificate. If a valid internal transport certificate cannot be found, Exchange searches for a valid CA certificate.
Therefore, for Hub-to-Hub communication where the Kerberos protocol is used for authentication, the absence of a valid internal transport certificate does not fail the SMTP session. The SMTP session is encrypted by using the temporary encryption key. In this case, an event is logged and you must create a new internal transport certificate by running the New-ExchangeCertificate cmdlet without arguments on the computer that is generating the event.
For Hub-to-Edge communication, where the Edge Transport server is subscribed to the organization, if a valid internal transport certificate is not found, the session fails and an error is logged. In this case, you must run the New-ExchangeCertificate cmdlet without arguments on the computer that generates the event and then run the Microsoft Exchange EdgeSync service again.
POP3 and IMAP4
As with the certificate selection process for SMTP STARTTLS, in the process for POP3 and IMAP4, Exchange must select a FQDN and find a certificate based on a matching value in the CertificateDomains field. The FQDN is chosen on the basis of the X509CertificateName attribute in the POP3 or IMAP4 service settings. You can view the X509CertificateName attribute by running the Get-POPSettings cmdlet or the Get-IMAPSettings cmdlet. For more information, see Get-POPSettings and Get-IMAPSettings.
The selection process for POP3 and IMAP4 in Exchange 2007 SP1 is the same as the process for SMTP STARTTLS.
Note: |
|---|
|
In Exchange 2007 RTM, there are two major exceptions in the certificate selection processes for POP3 and IMAP4. Certificates issued by a trusted CA are not preferred over self-signed certificates. Instead, Exchange 2007 selects the newest certificate. Also, in Exchange 2007 RTM, POP3 and IMAP4 do not support wildcard domains on certificates. This means that if the X509CertificateName attribute is set to mail.fourthcoffee.com for either the POP3 settings or IMAP4 settings, Exchange 2007 will not support a certificate that only contains *.fourthcoffee.com as a certificate domain.
|
Unified Messaging
If the Microsoft Exchange Unified Messaging service is started in Secured mode, it will query the local Personal certificate store to find a valid certificate to use for TLS to enable encryption. The Microsoft Exchange Unified Messaging service will first look for a valid certificate that has been issued by a private PKI or a public CA. If an appropriate certificate is not found, it will look for a self-signed certificate. If no PKI, public, or self-signed certificate is found, the Microsoft Exchange Unified Messaging service creates a self-signed certificate to use to start in Secure mode. If the UM server is starting in Unsecured mode, no certificate is needed.
All the details of the certificate that is used to start in Secured mode are logged whenever a certificate is used or if the certificate has changed. Some details that are logged include the following:
-
Issuer Name
-
Serial Number
-
Thumbprint
The thumbprint is the Secure Hash Algorithm (SHA1) hash. It can be used to uniquely identify the certificate that is used. You can export the certificate that is used by the Microsoft Exchange Unified Messaging service to start in Secured mode from the local certificate store and import this certificate onto the Unified Messaging IP gateways and IP PBXs on your network into the trusted certificate store.
After an appropriate certificate has been found and used, the Microsoft Exchange Unified Messaging service logs an event one month before the certificate that is being used expires. If you do not make any changes to the certificate during this time, the Microsoft Exchange Unified Messaging service logs an event each day until the certificate expires and each day after the certificate has expired.
When the Unified Messaging server looks for a certificate to use for mutual TLS to establish an encrypted channel, it looks in the trusted root certificate store. If there are multiple certificates that are valid and from different issuers, the Unified Messaging server selects the valid certificate that has the longest time remaining before expiration. If multiple certificates exist, the Unified Messaging server selects the certificates based on the issuer and the date that the certificate will expire. The Unified Messaging server looks for a valid certificate in the following order of preference:
-
PKI or public certificate with the longest expiration period.
-
PKI or commercial certificate with the shortest expiration period.
-
Self-signed certificate with the longest expiration period.
-
Self-signed certificate with the shortest expiration period.
Return to top