SMTP/IMAP/POP3
π§ Email μλ² κ΅¬μΆ (SMTP/IMAP/POP3) κ°μ΄λ π
1οΈβ£ Email μλ²λ?
μ΄λ©μΌ μλ²λ λ©μΌμ μ‘μμ λ° μ μ₯νλ μν μ ν©λλ€.
λνμ μΈ μ΄λ©μΌ νλ‘ν μ½μ λ€μκ³Ό κ°μ΅λλ€.
β SMTP (Simple Mail Transfer Protocol)
λ©μΌμ 보λ΄λ νλ‘ν μ½ (λ°μ )
β IMAP (Internet Message Access Protocol)
μλ²μμ λ©μΌμ κ΄λ¦¬νλ νλ‘ν μ½ (μμ , μλ² λκΈ°ν κ°λ₯)
β POP3 (Post Office Protocol 3)
λ©μΌμ ν΄λΌμ΄μΈνΈλ‘ λ€μ΄λ‘λνλ νλ‘ν μ½ (μμ , μλ²μμ μμ κ°λ₯)
π‘ IMAPκ³Ό POP3 μ°¨μ΄μ
νλ‘ν μ½ | λ°©μ | μ₯μ | λ¨μ |
---|---|---|---|
IMAP | μλ² λκΈ°ν | μ¬λ¬ κΈ°κΈ°μμ μ΄λ©μΌ λκΈ°ν κ°λ₯ | μλ² μ μ₯ κ³΅κ° νμ |
POP3 | λ€μ΄λ‘λ ν μμ | μλ² μ©λ μ μ½ | ν κΈ°κΈ°μμλ§ μ¬μ© κ°λ₯ |
2οΈβ£ Email μλ² μ€μΉ (Postfix + Dovecot)
β
Postfix: SMTP(λ©μΌ λ°μ‘) μλ²
β
Dovecot: IMAP/POP3(λ©μΌ μμ ) μλ²
πΉ Ubuntu/Debianμμ μ€μΉ
sudo apt update
sudo apt install postfix dovecot-core dovecot-imapd dovecot-pop3d -y
πΉ CentOS/RHELμμ μ€μΉ
sudo yum install postfix dovecot -y
μ€μΉ ν μλΉμ€ νμ±ν λ° νμΈ
sudo systemctl enable postfix dovecot
sudo systemctl start postfix dovecot
sudo systemctl status postfix dovecot
3οΈβ£ SMTP μλ² μ€μ (Postfix)
μ€μ νμΌ: /etc/postfix/main.cf
sudo nano /etc/postfix/main.cf
π 1. λλ©μΈ λ° νΈμ€νΈ μ€μ
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
π 2. λ©μΌ 릴λ μ΄ μ°¨λ¨ (μ€νΈ λ°©μ§)
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
π 3. μ€μ μ μ© λ° μλΉμ€ μ¬μμ
sudo systemctl restart postfix
4οΈβ£ IMAP/POP3 μλ² μ€μ (Dovecot)
μ€μ νμΌ: /etc/dovecot/dovecot.conf
sudo nano /etc/dovecot/dovecot.conf
π 1. νλ‘ν μ½ νμ±ν
protocols = imap pop3 lmtp
π 2. λ©μΌ μ μ₯ μμΉ μ§μ
mail_location = maildir:~/Maildir
π 3. μλΉμ€ μ¬μμ
sudo systemctl restart dovecot
5οΈβ£ Email μλ² λ°©νλ²½ μ€μ
β λ©μΌ μλΉμ€μ νμν ν¬νΈ κ°λ°©
μλΉμ€ | ν¬νΈ |
---|---|
SMTP | 25, 587 (TLS) |
IMAP | 143, 993 (SSL) |
POP3 | 110, 995 (SSL) |
πΉ UFW (Ubuntu/Debian)
sudo ufw allow 25/tcp
sudo ufw allow 587/tcp
sudo ufw allow 143/tcp
sudo ufw allow 993/tcp
sudo ufw allow 110/tcp
sudo ufw allow 995/tcp
sudo ufw reload
πΉ firewalld (CentOS/RHEL)
sudo firewall-cmd --permanent --add-service=smtp
sudo firewall-cmd --permanent --add-service=imap
sudo firewall-cmd --permanent --add-service=pop3
sudo firewall-cmd --reload
6οΈβ£ μ΄λ©μΌ μ‘μμ ν μ€νΈ
π 1. SMTP ν μ€νΈ (λ©μΌ 보λ΄κΈ°)
echo "Test Email" | mail -s "Test Subject" user@example.com
π 2. IMAP/POP3 μ°κ²° ν μ€νΈ
telnet mail.example.com 143 # IMAP
telnet mail.example.com 110 # POP3
TLS/SSLμ μ¬μ©ν κ²½μ°
openssl s_client -connect mail.example.com:993 -crlf
openssl s_client -connect mail.example.com:995 -crlf
7οΈβ£ μΉλ©μΌ (Roundcube) μ€μ (μ ν)
β μΉμμ μ΄λ©μΌμ νμΈνλ €λ©΄ Roundcube κ°μ μΉλ©μΌ ν΄λΌμ΄μΈνΈλ₯Ό μ€μΉ κ°λ₯
sudo apt install roundcube -y
μ€μΉ ν /etc/apache2/sites-available/roundcube.conf
μ€μ μ μΆκ°νμ¬ μΉλ©μΌ μ¬μ© κ°λ₯ π
8οΈβ£ Email μλ² λ‘κ·Έ λ° λ¬Έμ ν΄κ²°
π 1. Postfix λ‘κ·Έ νμΈ
sudo journalctl -u postfix -f
π 2. Dovecot λ‘κ·Έ νμΈ
sudo journalctl -u dovecot -f
π 3. λ©μΌ ν νμΈ
mailq
π 4. DNS λ μ½λ (MX, SPF, DKIM) νμΈ
dig MX example.com
9οΈβ£ κ²°λ‘ π
β
SMTP(Postfix) + IMAP/POP3(Dovecot) μ‘°ν©μΌλ‘ Email μλ²λ₯Ό ꡬμΆν μ μμ΅λλ€.
β
DNS μ€μ (MX, SPF, DKIM, DMARC)μ μΆκ°νλ©΄ 보μ κ°ν κ°λ₯ν©λλ€.
β
μΉλ©μΌ(Roundcube)κ³Ό μ°λνλ©΄ λΈλΌμ°μ μμλ μ΄λ©μΌμ κ΄λ¦¬ν μ μμ΅λλ€.
π μΆκ° μλ£
1οΈβ£ Postfix 곡μ λ¬Έμ
2οΈβ£ Dovecot 곡μ λ¬Έμ
3οΈβ£ Roundcube μΉλ©μΌ