POP3 & SMTP in E2k7

E2k7 에서 POP3와 SMTP 설정

1. EMC 에서 HUB 롤을 인스톨하면, 기본적으로 두 개의 Receive connector가 생긴다. 그 중 하나가 587 포트를 사용하는 Default Client 로 명명되어진 커넥터 이다. 이는, POP3또는 IMAP4를 사용하는 클라이언트 APP로부터 메일을 받는 HUB 서버인 경우이다.

Hub Transport server receiving e-mail submissions from a client application that uses Post Office Protocol version 3 (POP3) or IMAP4

Client

This Receive connector is automatically created on every Hub Transport server when the role is installed. By default, this Receive connector is configured to receive e-mail through TCP Port 587.

OUTLOOK Express를 통해서 이 커넥터를 이용해 메일을 보내기 위해서는 다음과 같이 두 군데 설정을 해야 한다.

먼저 클라이언트에서의 설정은 포트를 587로 변경한다.

clip_image002

서버단에서는 아래와 같이 Anonymous에 대해서 check를 해야 한다.

clip_image004

위 설정을 무시하고, 그냥 Default Receive Connector의 25포트를 통해서도 보낼 수 있다.

덧붙여, 내부 사용자가 아닌 외부로 메일을 보내는 경우는 공히 두 경우 아래와 같이 SMTP Relay 에러가 발생 한다.

clip_image006

따라서 다음과 같이 RELAY 허용관련 설정을 추가한다.

clip_image008

다음은 POP3에 대한 설정이다.

아무런 설정을 하지 않으면 보통 다음과 같은 에러가 발생한다.

clip_image010

인증서 없이 POP3를 이용하고자 할 때는 서버에서 Server configuration의 Client Access에서 POP3 and IMAP4탭을 선택한 뒤, POP3의 인증 탭에서 아래와 같이 첫번째 인증방식을 선택한다.

clip_image012

위에서 두 번째 인증방식을 사용코자 할 때는 클라이언트 Outlook express에서 다음을 체크해 준다.

clip_image013clip_image015

TIP>

When a user tries to log on to Exchange Server with Outlook Express and Secure Password Authentication, the client will pass the credentials of the user logged on to the workstation. If the logon works using the Clear Text option: <NT Domain/NT Account/Alias>, the user will have to change his or her mailbox alias to the Windows NT account name in order to use Secure Password Authentication. This is because Secure Password Authentication will not pass the mailbox alias information. It defaults to <NT DOMAIN\NTACCOUNT> and Exchange Server assumes the alias to be the Windows NT account.

자 이번엔 SMTP와 POP3의 SSL을 위한 설정을 해 보자.

1. 우선 인증서 SAN을 발급한다.

clip_image017

2. CAS서버에서 인증서 관련 요청 작업을 수행한다.

clip_image019

clip_image021

clip_image023

아래와 같이 Saved Request 항목에 1번 과정에서 생성한 Certreq.txt의 내용을 복사하고, Certificate Template는 Web Server를 선택한다.

clip_image025

아래와 같이 인증서를 로컬 서버에 저장합니다.

clip_image027

clip_image029

3. 인증서 등록 작업을 아래와 같이 파워셀에서 수행을 한다.

clip_image031

방금 생성한 인증서를 IIS 서버에서 확인 할 수 있다.

clip_image033

POP3관련해서도 다음과 같이 X.509 Certificate name에서 확인을 할 수 있다.

clip_image035

만약 방금 생성한 인증서가 아니면, Secure communications의 Server Certificate를 선택하고, 방금 생성한 것으로 바꾸는 작업을 한다.

clip_image037

clip_image039

clip_image041

4. 추가로 테스트를 하는 클라이언트에서 인증서 체인을 선택한다.

clip_image043

5. 현재 인증서와 서비스의 맵핑 정보를 보고자 할 때는 다음과 같다.

clip_image044clip_image046

위와 같이 특정 Certificate(Thumbprint)에 대해서 특정 Service가 enable된다.

TIP>

The Enable-ExchangeCertificate cmdlet enables certificates when it updates the metadata that is stored with the certificate. To enable an existing certificate to work with different services, run the Enable-ExchangeCertificate command and specify the services that you want to enable. You can rerun this cmdlet if you want to add new services that use the certificate.

Remember that different services have different metadata requirements on a given certificate. In addition, the Enable-ExchangeCertificate cmdlet is only additive. That means that you can't disable or remove specific services from the certificate by using the Enable-ExchangeCertificate command.

To disable a certificate without removing or deleting the certificate, set the Services parameter to None. Setting the Services parameter to None does not remove any service metadata from the certificate.

[클라이언트 테스트]

[CASE1]

1. workgroup클라이언트 Outlook express에서 인증서체인을 설치하지 않음.

2. POP3서버 정보에 Pop3.kbiz.net을 입력함.

3. 보내기 받기를 하는 순간 “사용자가 연결한 서버에서 사용하는 보안 인증서를 확인할 수 없습니다. 인증서는 체인은 처리되었지만, 신뢰공급자에 의해 신뢰되지 않은 루트 인증서에서 중지되었습니다.” 경고 창이 뜸.

4. 인증서 체인을 클라이언트에 인스톨 한 뒤, 더 이상 위 경고창 뜨지 않음.

[CASE2]

5. POP3서버 정보에 인증서에 등록한 FQDN이 아닌, Receive Connector 를 가진 허브서버의 IP를 넣음.

6. 다음과 같은 경고가 뜸. “사용자가 연결한 서버에서 사용하는 보안 인증서를 확인할 수 없습니다. 인증서의 CN이름이 전달된 값과 일치하지 않습니다. 이 서버를 계속 사용하시겠습니까?”

7. 인증서 등록시 사용했던 FQDN을 넣으면 정상적으로 됨.

[CASE3]

8. 이번엔 SMTP 서버 등록정보에 IP를 넣고, 메시지 한 개를 작성 한 후 보내기 시도함. 0x800CCC1A 에러가 발생함. KB832566 참조. SECURE Connection관련 에러임.

9. IP를 지우고 인증서 SAN 에 등록한 SMTP.kbiz.net을 입력함. 그 후 정상화 됨.

===================================================================

[CASE4]

10. 클라이언트에서 SSL를 모두 OFF시키고, 메시지를 새로이 작성 한 후 메시지 전송 시도함. SMTP 관련하여 다음 에러가 발생함.

“보낸 사람의 전자 메일 주소를 서버에서 거부하였으므로 이 메시지를 보낼 수 없습니다. 보낸 사람의 전자메일 주소는 *** 입니다. 제목 ** 계정** 서버 ****, 프로토콜 **** 서버응답: ‘451 5.7.3 Must issue a STARTTLS command first’, 포트: 25. 보안(SSL):아니오, 서버오류: 451, 오류번호: 0x800CCC78

POP3는 SSL을 OFF해도 정상적임.

[CASE5]

11. 클라이언트에서 SMTP SSL을 enable하고, 서버단 설정은 다음과 같이 SAN 리스트에 없는 FQDN으로 입력함. 클라이언트는 SMTP.kbiz.net으로 접근.

clip_image047clip_image049

새로운 메시지를 클라이언트에서 생성하고 보내기 버튼 클릭하면, 다음과 같은 경고창이 발생함.

“사용자가 연결한 서버에서 사용하는 보안 인증서를 확인할 수 없습니다. 인증서는 체인은 처리되었지만, 신뢰공급자에 의해 신뢰되지 않은 루트 인증서에서 중지되었습니다.”

위 에러가 난 이유는 인증서에 Infoguy.Kbiz.net 이 없어서 이다. 만약에 SAN에 이를 추가했으면, 클라이언트에서 SMTP.kbiz.net이란 불일치 되는 이름으로 접근해도 에러가 발생한다. 위 FQDN 설정에서 Infoguy 만 넣어도 동작한다. 이는 SAN에 있기 때문이다.

결국, 클라이언트가 접근하는 URL과 인증서 체인상에 있는 SAN 에 등록된 URL이 일치하고, 이 내용이 RC에 등록되어 있으면 동작하는 것이다.

clip_image051

기본적으로는 Exchange Server authentication과 Offer Basic authentication only after starting TLS 까지 체크되어 있다.

클라이언트에서 SMTP SSL을 사용하고 싶지 않을 때는 서버 단에서 TLS 설정을 OFF한다.

clip_image053

아웃룩 클라이언트와 같은 SMTP Client가 HUB 서버들과 TLS를 요구할 때, STARTTLS가 사용된다. 아래는 그 과정이다.

**STARTTLS**

TIP>

When an SMTP session is established, the receiving server initiates a certificate selection process to determine which certificate to use in the TLS negotiation. The sending server also performs a certificate selection process. For more information about that process, see Selection of Outbound Anonymous TLS Certificates.

This topic describes the certificate selection process for inbound STARTTLS. All the steps described in this topic are performed on the receiving server. The following figure shows the steps of this process.

Selection of an inbound STARTTLS certificate
clip_image054

  1. When the SMTP session is established, Microsoft Exchange calls a process to load the certificates.

clip_image055clip_image056clip_image057clip_image059

  1. In the load certificate function, the Receive connector to which the session is connected is checked to see whether the AuthMechanism property is set to a value of TLS. You can set the AuthMechanism property on the Receive connector by using the Set-ReceiveConnector cmdlet. You can also set the AuthMechanism property to TLS by selecting Transport Security Layer (TLS) on the Authentication tab of a given Receive connector.
    If TLS is not enabled as an authentication mechanism, the server does not advertise X-STARTTLS as an option to the sending server and no certificate is loaded. If TLS is enabled as an authentication mechanism, the certificate selection process continues to the next step.
  2. The certificate selection process retrieves the fully qualified domain name (FQDN) value from the Receive connector configuration. If the FQDN value on the Receive connector is null, the server's physical FQDN is retrieved.
  3. The certificate selection process searches the local computer certificate store for certificates that match the FQDN. If a certificate is not found, the server does not advertise X-STARTTLS, no certificate is loaded, and Event ID 12014 is logged in the Application log.
  4. The certificate selection process searches for all certificates in the certificate store that have a matching FQDN. From this list, the certificate selection process identifies a list of eligible certificates. Eligible certificates must meet the following criteria:
    • The certificate is an X.509 version 3 or a later version certificate.
    • The certificate has an associated private key.
    • The Subject or Subject Alternate Name fields contain the FQDN that was retrieved in step 3.
    • The certificate is enabled for Secure Sockets Layer (SSL)/TLS use. Specifically, the SMTP service has been enabled for this certificate by using the Enable-ExchangeCertificate cmdlet.
  5. If no eligible certificates are found after these checks, the server does not advertise X-STARTTLS, no certificate is loaded, and Event ID 12014 is logged in the Application log.
  6. From the eligible certificates, the best certificate is selected based on the following sequence:
    • Sort eligible certificates by most recent Valid from date. Valid from is a Version 1 field on the certificate.
    • The first valid public key infrastructure (PKI) certificate that is found in this list is used.
    • If no valid PKI certificates are found, the first self-signed certificate is used.
  7. The certificate is checked to see whether it has expired. The Valid to field in the certificate properties is compared to the current date and time. If the certificate has not expired, STARTTLS is advertised. If the certificate has expired, Event ID 12016 is logged in the Application log, but STARTTLS is still advertised.

**Anonymous TLS**

1. HUB와 EDGE간의 SMTP session 에 사용됨.

2. HUB끼리의 SMTP Session에 사용됨.

인증서 로딩 프로세스à수신 커넥터에서 인증 메커니즘을 체크àAD에 쿼리하여 해당 서버에 존재하는 인증서의 Thumbprint를 확인à Thumbprint에 근거하여 Certificate Store를 체크àExpire date 체크àPKI인지 Self-signed인지 체크àPKI선호àbest certificate 가 msExchServerInterTLSCert와 일치하는 지 체크à일치하면 Anonymous TLS통신 시작.

다음과 같은 구조가 있다고 가정하자.

clip_image061

HUB 서버에서 SAN을 발급할 때, mail.kbiz.net/Hub1.Kbiz.net/Hub2.Kbiz.net/Hub3.Kbiz.net/Autodiscover.Kbiz.net/Hub1/Hub2/Hub3로 생성한다. Private Key exportable로 해서 이를 다른 허브로 Export한 뒤 Import한다. EDGE도 동일한 방법으로 한다.

HUB간의 Server TO Server의 X-anonymous 통신을 위해서는 Exchange Server authentication이 체크되어야 하고, Receive connector의 FQDN이 반드시 Netbios 명 또는 Phsycal PQDN 또는 Null이 되어야 한다.

위 세 이름은 모두 SAN에 등록되어 있다.

만약, SMTP 전용서버도 TLS로 다수 서버를 L4 하에 구축하고자 할 때는, SAN에 mail.kbiz.net을 추가하고, FQDN항목에 servername.kbiz.net 또는 servername을 입력하고, 클라이언트에서는 mail.kbiz.net으로 SMTP 서버를 지정한 후 SSL 통해서 보내면 아무런 에러 없이 발송할 수 있다.

따라서, SMTP SSL을 위해서는 Receive connector에 등록한 이름이 SAN에 있고, 클라이언트도 SAN에 등록된 이름으로 SMTP 서버 입력을 해야 한다는 것이다.