Como renovar un certificado Self-Signed en Exchange 2007

Por Daniel Seveso

Los certificados "Self-Signed" son certificados provisorios que permiten la comunicación segura y encripción de datos entre servidores de la organización inmediatamente luego de la instalación de Exchange. Estos certificados se crean y configuran durante la instalación de los roles de Exchange 2007, y los mismos expiran al año de su creación. Debido a sus limitaciones, la recomendación general es que luego de instalar Exchange, obtengas un certificado comercial o de una autoridad certificadora local.

Confirmando la expiración

Si estás usando un ambiente de laboratorio o simplemente no has reemplazado el certificado en tu ambiente de producción, y el certificado expira, verás los siguientes eventos en el log de aplicaciones:

 

Event Type: Warning
Event Source: MSExchangeTransport
Event Category: TransportService
Event ID: 12015
Date: 12/31/2008
Time: 10:34:53 AM
User: N/A
Computer: NETE12-1
Description:
An internal transport certificate expired. Thumbprint:6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF

Event Type: Error
Event Source: MSExchangeTransport
Event Category: TransportService
Event ID: 12014
Date: 12/31/2008
Time: 10:34:53 AM
User: N/A
Computer: NETE12-1
Description:
Microsoft Exchange couldn't find a certificate that contains the domain name NetE12-1.dseveso.net in the personal store on the local computer. Therefore, it is unable to support the STARTTLS SMTP verb for the connector Default NETE12-1 with a FQDN parameter of NetE12-1.dseveso.net. If the connector's FQDN is not specified, the computer's FQDN is used. Verify the connector configuration and the installed certificates to make sure that there is a certificate with a domain name for that FQDN. If this certificate exists, run Enable-ExchangeCertificate -Services SMTP to make sure that the Microsoft Exchange Transport service has access to the certificate key.

Lo primero que debes hacer es confirmar esta información obteniendo las propiedades del certificado. El Thumbprint es el atributo único del certificado que nos permite ubicarlo, y lo utilizamos para filtrar el siguiente comando:

 

[PS] C:\>Get-ExchangeCertificate | Where {$_.Thumbprint -eq "6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF"} |fl

AccessRules : {System.Security.AccessControl.CryptoKeyAccessRule, System
.Security.AccessControl.CryptoKeyAccessRule, System.Securi
ty.AccessControl.CryptoKeyAccessRule}
CertificateDomains : {NetE12-1, NetE12-1.dseveso.net}
HasPrivateKey : True
IsSelfSigned : True
Issuer : CN=NetE12-1
NotAfter : 7/18/2008 7:27:32 AM
NotBefore : 7/18/2007 7:27:32 AM
PublicKeySize : 2048
RootCAType : Unknown
SerialNumber : 2672EF8DBF41B18246F520E7FC364890
Services : IMAP, POP, IIS, SMTP
Status : Invalid
Subject : CN=NetE12-1
Thumbprint : 6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF

Vemos que es un "Self-Signed" certificate, que su estado es inválido y que su fecha de expiración (NotAfter) es 7/18/2008.

En Exchange 2007 los certificados "Self-Signed" se emiten con dos nombres o "Subject Alternative Name", que corresponden a la propiedad "CertificateDomains" del comando anterior. Los mismos son el nombre de NetBIOS y el FQDN ( Fully Qualified Domain Name) del servidor.

Creando un nuevo certificado

Una vez confirmado que necesitamos un nuevo certificado, usamos el siguiente procedimiento para crear el nuevo certificado "Self-Signed".

  1. La forma más directa de crear el nuevo certificado es clonarlo. Significa que pasamos las propiedades del certificado expirado para crear el nuevo. El clonado del certificado lo haces con el siguiente comando:

    [PS] C:\>Get-ExchangeCertificate | Where {$_.Thumbprint -eq "6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF"} | New-ExchangeCertificate

    Recibirás el siguiente pedido de confirmación para reemplazar el certificado anterior, al cual responderás "y"

    Confirm
    Overwrite existing default SMTP certificate,'6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF' (expires 7/18/2008 7:27:32 AM), with certificate '813E2977C565866BFBA1EF660653F6128F5827E4' (expires 12/31/2009 12:27:46 PM)?

  2. Inspeccionamos las propiedades del nuevo certificado:

    [PS] C:\>Get-ExchangeCertificate | Where {$_.Thumbprint -eq "813E2977C565866BFBA1EF660653F6128F5827E4"} | fl

    AccessRules : {System.Security.AccessControl.CryptoKeyAccessRule, System
    .Security.AccessControl.CryptoKeyAccessRule, System.Securi
    ty.AccessControl.CryptoKeyAccessRule}
    CertificateDomains : {NetE12-1, NetE12-1.dseveso.net}
    HasPrivateKey : True
    IsSelfSigned : True
    Issuer : CN=NetE12-1
    NotAfter : 12/31/2009 12:27:46 PM
    NotBefore : 12/31/2008 12:27:46 PM
    PublicKeySize : 2048
    RootCAType : None
    SerialNumber : 303583ADA3B6889E4C7B7F14CCB08578
    Services : IMAP, POP, SMTP
    Status : Valid
    Subject : CN=NetE12-1
    Thumbprint : 813E2977C565866BFBA1EF660653F6128F5827E4

  3. Como puedes notar en el parámetro "Services", el certificado no ha sido asociado al servicio Web (IIS). Para asociarlo, primero removemos el certificado expirado para evitar cualquier conflicto:

    [PS] C:\>Remove-ExchangeCertificate -Thumbprint 6C5EAB868FF1F052B2F04C177CFC2677B4E8CEBF

    Luego asocia el nuevo certificado con los servicios IMAP, POP, IIS y SMTP

    [PS] C:\>Enable-ExchangeCertificate -Thumbprint 813E2977C565866BFBA1EF660653F6128F5827E4 -Services IMAP, POP, IIS, SMTP

  4. Verifica el resultado de la asociación:

    [PS] C:\>Get-ExchangeCertificate | Where {$_.Thumbprint -eq "813E2977C565866BFBA1EF660653F6128F5827E4"} | fl

    AccessRules : {System.Security.AccessControl.CryptoKeyAccessRule, System
    .Security.AccessControl.CryptoKeyAccessRule, System.Securi
    ty.AccessControl.CryptoKeyAccessRule}
    CertificateDomains : {NetE12-1, NetE12-1.dseveso.net}
    HasPrivateKey : True
    IsSelfSigned : True
    Issuer : CN=NetE12-1
    NotAfter : 12/31/2009 12:27:46 PM
    NotBefore : 12/31/2008 12:27:46 PM
    PublicKeySize : 2048
    RootCAType : None
    SerialNumber : 303583ADA3B6889E4C7B7F14CCB08578
    Services : IMAP, POP, IIS, SMTP
    Status : Valid
    Subject : CN=NetE12-1
    Thumbprint : 813E2977C565866BFBA1EF660653F6128F5827E4

 

Luego de recrear el certificado, ya no tendremos el mensaje de error inicial (al menos por el próximo año...)

 

Referencias