메일 서버 · 14 min read · Oct 09, 2025

완벽한 로드 밸런싱 및 고가용성 웹 클러스터: 2대의 서버에서 Xen을 실행하는 Ubuntu 8.04 Hardy Heron - 페이지 5

11. 메일 서버 (web1, web2)

11.1 Postfix, Courier, Saslauthd, MySQL, phpMyAdmin 설치

Postfix, Courier, Saslauthd, MySQL, phpMyAdmin 설치:

apt-get install postfix postfix-mysql postfix-doc courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl phpmyadmin libpam-smbpass

몇 가지 질문을 하게 됩니다:

웹 기반 관리용 디렉토리를 생성하시겠습니까? <– 아니요
메일 구성의 일반 유형: <– 인터넷 사이트
시스템 메일 이름: <– web1.example.com (또는 web2.example.com)
SSL 인증서 필요 <– 확인
자동으로 재구성할 웹 서버: <– apache2

11.2 Postfix 구성

이제 Postfix에 데이터베이스에서 모든 정보를 찾을 수 있는 위치를 알려줘야 합니다. 따라서 여섯 개의 텍스트 파일을 생성해야 합니다. Postfix에 localhost 대신 IP 주소 127.0.0.1에서 MySQL에 연결하도록 지시하는 것을 알 수 있습니다. 이는 Postfix가 chroot 감옥에서 실행되고 있으며, localhost를 사용하도록 지시하면 연결하려고 시도할 MySQL 소켓에 접근할 수 없기 때문입니다. 127.0.0.1을 사용하면 Postfix는 TCP 네트워킹을 사용하여 MySQL에 연결하며, 이는 chroot 감옥에서도 문제가 없습니다 (대안은 MySQL 소켓을 chroot 감옥으로 이동하는 것이며, 이는 다른 문제를 일으킵니다).

이제 여섯 개의 텍스트 파일을 생성해 보겠습니다.

vi /etc/postfix/mysql-virtual_domains.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT domain AS virtual FROM domains WHERE domain='%s'
hosts = 127.0.0.1

vi /etc/postfix/mysql-virtual_forwardings.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT destination FROM forwardings WHERE source='%s'
hosts = 127.0.0.1

vi /etc/postfix/mysql-virtual_mailboxes.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s'
hosts = 127.0.0.1

vi /etc/postfix/mysql-virtual_email2email.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT email FROM users WHERE email='%s'
hosts = 127.0.0.1

vi /etc/postfix/mysql-virtual_transports.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT transport FROM transport WHERE domain='%s'
hosts = 127.0.0.1

vi /etc/postfix/mysql-virtual_transports_notactive.cf

user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT transport FROM domains WHERE domain='%s'
hosts = 127.0.0.1

그런 다음 이러한 파일의 권한과 그룹을 변경합니다:

chmod o= /etc/postfix/mysql-virtual*.cf
chgrp postfix /etc/postfix/mysql-virtual
*.cf

이제 /home/vmail에 홈 디렉토리가 있는 vmail이라는 사용자와 그룹을 생성합니다. 여기에서 모든 메일 박스가 저장됩니다.

groupadd -g 5000 vmail
useradd -g vmail -u 5000 vmail -d /home/vmail -m
passwd vmail

다음으로 Postfix 구성을 진행합니다.

web2.example.com에서 올바른 ‘myhostname’ 및 ‘mydestination’을 설정했는지 확인하십시오:

postconf -e ‘myhostname = web1.example.com’
postconf -e ‘mydestination = web1.example.com, localhost, localhost.localdomain’
postconf -e ‘mynetworks = 127.0.0.0/8’
postconf -e ‘virtual_alias_domains =’
postconf -e ‘virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf’
postconf -e ‘virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf’
postconf -e ‘virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf’
postconf -e ‘virtual_mailbox_base = /home/vmail’
postconf -e ‘virtual_uid_maps = static:5000’
postconf -e ‘virtual_gid_maps = static:5000’
postconf -e ‘smtpd_sasl_auth_enable = yes’
postconf -e ‘broken_sasl_auth_clients = yes’
postconf -e ‘smtpd_sasl_authenticated_header = yes’
postconf -e ‘smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination’
postconf -e ‘smtpd_use_tls = yes’
postconf -e ‘smtpd_tls_cert_file = /etc/postfix/smtpd.cert’
postconf -e ‘smtpd_tls_key_file = /etc/postfix/smtpd.key’
postconf -e ‘transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf’
postconf -e ‘virtual_create_maildirsize = yes’
postconf -e ‘virtual_mailbox_extended = yes’
postconf -e ‘proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks’

그 후 TLS에 필요한 SSL 인증서를 생성합니다:

cd /etc/postfix
openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509

국가 이름 (2자리 코드) [AU]: <– 귀하의 국가 이름 입력 (예: “DE”).
주 또는 지방 이름 (전체 이름) [Some-State]: <– 귀하의 주 또는 지방 이름 입력.
지역 이름 (예: 도시) []: <– 귀하의 도시 입력.
조직 이름 (예: 회사) [Internet Widgits Pty Ltd]: <– 귀하의 조직 이름 입력 (예: 귀하의 회사 이름).
조직 단위 이름 (예: 섹션) []: <– 귀하의 조직 단위 이름 입력 (예: “IT 부서”).
공통 이름 (예: 귀하의 이름) []: <– 시스템의 완전한 도메인 이름 입력 (예: “server1.example.com”).
이메일 주소 []: <– 귀하의 이메일 주소 입력.

그런 다음 smtpd.key의 권한을 변경합니다:

chmod o= /etc/postfix/smtpd.key

11.3 web2.example.com의 로컬 메일 문제 해결

ldirectord를 구성할 때 web1.example.com만 SMTP (포트 25)에 대해 활성화됩니다. 두 번째 서버는 대기 상태에 있으며 web1.example.com에서 postfix가 실패할 경우에만 활성 역할을 맡습니다.

이렇게 하는 이유는 두 서버가 포트 25에서 모두 활성화되면 외부에서 오는 메일의 절반은 web1로, 나머지 절반은 web2로 전송되기 때문입니다. 동기화하는 것은 악몽이 될 것입니다…

이것은 외부에서 오는 메일에는 잘 작동하지만 web2.example.com의 로컬 메일은 로컬로 배달됩니다. 다시 말해, 웹사이트에 “문의하기” 양식이 있고 방문자가 web2.example.com에 있을 경우, 메일은 모든 메일이 가야 할 web1.example.com에 도달하지 않습니다. 이는 web2.example.com에서 [email protected]로 메일을 보낼 때 DNS 서버에 example.com의 메일 서버 주소를 요청하고, 자신인 192.168.1.106의 응답을 받아 메일이 서버를 떠나지 않기 때문입니다.

트릭은 로컬 메일을 web1.example.com으로 보내기 위해 postfix 전송을 사용하는 것입니다.

이를 달성하기 위해 매 분마다 실행되는 bash 스크립트를 사용하여 로컬 메일을 web1.example.com으로 보냅니다:

web2.example.com

vi /root/check_smtp

#!/bin/bash
# 로드 밸런싱을 위한 로컬 메일 수정
# Copyright (c) 2008 blogama.org
# 이 스크립트는 GNU GPL 버전 2.0 이상에 따라 라이센스가 부여됩니다.
# ---------------------------------------------------------------------
### 이 스크립트의 목적은 로드 밸런싱으로 인한 로컬 메일 문제를 수정하는 것입니다 ###
### 누군가가 이 스크립트를 postconf -e 대신 sed (추잡한)으로 작동하게 만들 수 있다면 알려주세요.
### /etc/postfix/main.cf를 CRONTAB으로 수정하는 것은 저에게는 작동하지 않았습니다.
### 수정할 내용 ###
MASTERSERVER="web1.example.com"
###### 아래는 수정하지 마십시오 ######
### 바이너리 ###
MAIL=$(which mail)
TELNET=$(which telnet)
#이것
POSTCONF="/etc/postfix/main.cf"
### 서버 1이 smtp에서 응답하는지 확인 ###
(
echo "quit"
) | $TELNET $MASTERSERVER 25 | grep Connected > /dev/null 2>&1
if [ "$?" -ne "1" ]; then
  ### 이전 시도에서 web1이 연결되지 않았지만 지금 연결되면, web2는 모든 로컬 메일을 web1으로 전달합니다. ###
  if [ -f smtpactive ]; then
    sed -i 's/transport_maps = .*/transport_maps = proxy:mysql:\/etc\/postfix\/mysql-virtual_transports_notactive.cf/' $POSTCONF
    /etc/init.d/postfix restart
    rm /root/smtpactive
  ### 이전 시도에서 web1이 연결되었고 여전히 연결되면, 아무것도 하지 않고 종료합니다. ###
  else
    exit 1;
  fi
 
else
  ### 이전 시도에서 web1이 연결되지 않았고 여전히 연결되지 않으면, web2는 이미 로컬 메일에 대해 활성화되어 있으므로 아무것도 하지 않고 종료합니다. ###
  cd /root
  if [ -f smtpactive ]; then
    exit 1;
  fi
  ### 이전 시도에서 web1이 연결되었지만 지금은 연결되지 않으면, web2는 로컬 메일에 대해 활성 역할을 맡습니다. ###
  echo "SMTP active on web2" > /root/smtpactive
  sed -i 's/transport_maps = .*/transport_maps = proxy:mysql:\/etc\/postfix\/mysql-virtual_transports.cf/' $POSTCONF
  /etc/init.d/postfix restart
fi

chmod +x /root/check_smtp

이제 다음과 같이 web1.example.com으로 모든 로컬 메일을 전달합니다:

postconf -e ‘transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports_notactive.cf
/etc/init.d/postfix restart

그리고 스크립트를 crontab에 추가합니다:

crontab -e

[...]
* * * * * /root/check_smtp >/dev/null 2>&1
[...]  

11.4 Saslauthd 구성

mkdir -p /var/spool/postfix/var/run/saslauthd

그런 다음 /etc/default/saslauthd를 편집합니다. START를 yes로 설정하고 OPTIONS=”-c -m /var/run/saslauthd” 줄을 OPTIONS=”-c -m /var/spool/postfix/var/run/saslauthd -r”로 변경합니다:

vi /etc/default/saslauthd

#
# saslauthd 데몬에 대한 설정
# 자세한 내용은 /usr/share/doc/sasl2-bin/README.Debian을 참조하십시오.
#
# saslauthd가 자동으로 시작 시 실행되어야 합니까? (기본값: 아니요)
START=yes
# 이 saslauthd 인스턴스에 대한 설명. 권장.
# (제안: SASL 인증 데몬)
DESC="SASL 인증 데몬"
# 이 saslauthd 인스턴스의 짧은 이름. 강력히 권장.
# (제안: saslauthd)
NAME="saslauthd"
# saslauthd가 사용할 인증 메커니즘은 무엇입니까? (기본값: pam)
#
# 이 Debian 패키지에서 사용할 수 있는 옵션:
# getpwent  -- getpwent() 라이브러리 함수 사용
# kerberos5 -- Kerberos 5 사용
# pam       -- PAM 사용
# rimap     -- 원격 IMAP 서버 사용
# shadow    -- 로컬 섀도우 비밀번호 파일 사용
# sasldb    -- 로컬 sasldb 데이터베이스 파일 사용
# ldap      -- LDAP 사용 (구성은 /etc/saslauthd.conf에 있음)
#
# 한 번에 하나의 옵션만 사용할 수 있습니다. 자세한 내용은 saslauthd 매뉴얼 페이지를 참조하십시오.
#
# 예: MECHANISMS="pam"
MECHANISMS="pam"
# 이 메커니즘에 대한 추가 옵션. (기본값: 없음)
# 메커니즘별 옵션에 대한 정보는 saslauthd 매뉴얼 페이지를 참조하십시오.
MECH_OPTIONS=""
# 몇 개의 saslauthd 프로세스를 실행해야 합니까? (기본값: 5)
# 0의 값은 각 연결에 대해 새 프로세스를 포크합니다.
THREADS=5
# 기타 옵션 (기본값: -c -m /var/run/saslauthd)
# 참고: -m 옵션을 반드시 지정해야 saslauthd가 실행됩니다!
#
# /usr/share/doc/sasl2-bin/README.Debian에서 Debian 전용 정보 참조.
# saslauthd 매뉴얼 페이지에서 이러한 옵션에 대한 일반 정보 참조.
#
# postfix 사용자를 위한 예: "-c -m /var/spool/postfix/var/run/saslauthd"
#OPTIONS="-c -m /var/run/saslauthd"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"

그런 다음 /etc/pam.d/smtp 파일을 생성합니다. 다음 두 줄만 포함되어야 합니다 (정확한 데이터베이스 세부정보를 입력해야 합니다):

vi /etc/pam.d/smtp

auth    required   pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1

다음으로 /etc/postfix/sasl/smtpd.conf 파일을 생성합니다. 다음과 같아야 합니다:

vi /etc/postfix/sasl/smtpd.conf

pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: mail_admin
sql_passwd: mail_admin_password
sql_database: mail
sql_select: select password from users where email = '%u'

그런 다음 postfix 사용자를 sasl 그룹에 추가합니다 (이렇게 하면 Postfix가 saslauthd에 접근할 수 있는 권한을 갖습니다):

adduser postfix sasl

그런 다음 Postfix와 Saslauthd를 재시작합니다:

/etc/init.d/postfix restart
/etc/init.d/saslauthd restart

11.5 Courier 구성

이제 Courier가 MySQL 데이터베이스에 대해 인증하도록 설정해야 합니다. 먼저 /etc/courier/authdaemonrc를 편집하고 authmodulelist의 값을 다음과 같이 변경합니다:

vi /etc/courier/authdaemonrc

[...]
authmodulelist="authmysql"
[...]

그런 다음 /etc/courier/authmysqlrc의 백업을 만들고 이전 파일을 비웁니다:

cp /etc/courier/authmysqlrc /etc/courier/authmysqlrc_orig
cat /dev/null > /etc/courier/authmysqlrc

그런 다음 /etc/courier/authmysqlrc를 열고 다음 줄을 추가합니다:

vi /etc/courier/authmysqlrc

MYSQL_SERVER localhost
MYSQL_USERNAME mail_admin
MYSQL_PASSWORD mail_admin_password
MYSQL_PORT 0
MYSQL_DATABASE mail
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD 5000
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD "/home/vmail"
MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
#MYSQL_NAME_FIELD
#MYSQL_QUOTA_FIELD quota

그런 다음 Courier를 재시작합니다:

/etc/init.d/courier-authdaemon restart
/etc/init.d/courier-imap restart
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop restart
/etc/init.d/courier-pop-ssl restart

telnet localhost pop3를 실행하여 POP3 서버가 제대로 작동하는지 확인할 수 있습니다. +OK Hello there.를 반환해야 합니다. (quit을 입력하여 Linux 셸로 돌아갑니다.)

root@server1:/etc/postfix# telnet localhost pop3
Trying 127.0.0.1…
Connected to localhost.localdomain.
Escape character is ‘^]’.
+OK Hello there.
quit
+OK Better luck next time.
Connection closed by foreign host.

11.6 /etc/aliases 수정

이제 /etc/aliases를 열어야 합니다. postmaster가 root를 가리키고 root가 자신의 사용자 이름이나 이메일 주소를 가리키도록 확인하십시오. 예를 들어:

vi /etc/aliases

[...]
postmaster: root
root: [email protected]
[...]

/etc/aliases를 수정할 때마다 다음을 실행해야 합니다:

newaliases

그런 다음 Postfix를 재시작합니다:

/etc/init.d/postfix restart

11.7 Spamassassin

이제 Spamassassin을 설치합니다:

apt-get install spamassassin spamc

비루트로 실행되도록 spamd 사용자 및 그룹을 추가합니다:

groupadd spamd
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
mkdir /var/log/spamassassin
chown spamd:spamd /var/log/spamassassin

/etc/default/spamassassin를 편집하여 다음 옵션이 설정되도록 합니다:

vi /etc/default/spamassassin

# /etc/default/spamassassin
# Duncan Findlay
# 경고: 사용하기 전에 README.spamd를 읽으십시오.
# 보안 위험이 있을 수 있습니다.
# spamd를 활성화하려면 1로 변경하십시오.
ENABLED=1
# 옵션
# 가능한 옵션에 대한 정보는 man spamd를 참조하십시오. -d 옵션은 자동으로 추가됩니다.
# SpamAssassin은 preforking 모델을 사용하므로 주의하십시오! --max-children이 5보다 높게 설정되지 않도록 해야 합니다.
#OPTIONS="--create-prefs --max-children 5 --helper-home-dir"
SAHOME="/var/log/spamassassin/"
OPTIONS="--create-prefs --max-children 5 --username spamd -H ${SAHOME} -s ${SAHOME}spamd.log"
# PID 파일
# spamd가 PID를 파일에 기록해야 하는 위치는 어디입니까? 위의 -u 또는 --username 옵션을 사용하는 경우, 이 파일은 해당 사용자가 쓸 수 있어야 합니다.
# 그렇지 않으면 init 스크립트가 spamd를 종료할 수 없습니다.
PIDFILE="/var/run/spamd.pid"
# spamd의 nice 수준 설정
#NICE="--nicelevel 15"
# Cronjob
# spamassassin의 규칙을 매일 밤 자동으로 업데이트하도록 크론 작업을 활성화하려면 0이 아닌 값으로 설정하십시오.
CRON=0

spamassassin 데몬을 시작합니다:

/etc/init.d/spamassassin start

다음과 같이 Postfix에 spamassassin을 추가합니다:

vi /etc/postfix/master.cf

구성 파일의 첫 번째 줄을 다음과 같이 수정합니다:

smtp      inet  n       -       -       -       -       smtpd -o content_filter=spamassassin

그리고 파일 끝에 다음을 추가합니다:

spamassassin unix -     n       n       -       -       pipe
        user=spamd argv=/usr/bin/spamc -f -e  
        /usr/sbin/sendmail -oi -f ${sender} ${recipient}

11.8 Postfix 테스트

Postfix가 SMTP-AUTH 및 TLS를 준비했는지 확인하려면 다음을 실행합니다:

telnet localhost 25

Postfix 메일 서버에 연결한 후 다음을 입력합니다:

ehlo localhost

250-STARTTLS 및 250-AUTH LOGIN PLAIN 줄이 보이면 모든 것이 정상입니다.

이제 quit을 입력하여 셸로 돌아갑니다.

11.9 데이터베이스 채우기

어느 서버에서든 (둘 다 아님!):

mysql -u root -p

USE mail;
INSERT INTO domains (domain) VALUES (‘example.com’);
INSERT INTO users (email, password) VALUES (‘ [email protected] ‘, ENCRYPT(‘secret’));
quit;

비밀번호에 대해 MYSQL ENCRYPT 함수를 사용하는 것을 절대 잊지 마십시오!

11.10 Maildir 생성 시 환영 이메일 보내기

새 이메일 계정을 생성하고 (POP3/IMAP으로) 이메일을 가져오려고 하면 Maildir이 존재하지 않는다는 오류 메시지가 표시될 수 있습니다. Maildir은 새 계정에 대한 첫 번째 이메일이 도착할 때 자동으로 생성됩니다. 따라서 새 계정에 환영 이메일을 보내는 것이 좋습니다.

먼저 mailx 패키지를 설치합니다:

apt-get install mailx

다음과 같이 [email protected]로 환영 이메일을 보냅니다:

mailx [email protected]

제목을 입력하라는 메시지가 표시됩니다. 제목을 입력한 후 ENTER를 누르고, 다음 줄에 메시지를 입력합니다. 메시지가 완료되면 ENTER를 다시 눌러 새 줄로 이동한 다음 CTRL+D를 누릅니다. 메일을 cc하고 싶지 않으면 ENTER를 다시 누릅니다:

root@server1:/usr/local/sbin# mailx [email protected] Subject: Welcome <– ENTER Welcome! Have fun with your new mail account. <– ENTER <– CTRL+D Cc: <– ENTER

11.11 SquirrelMail 설치

SquirrelMail은 사용자가 브라우저에서 이메일을 보내고 받을 수 있도록 해주는 웹메일 인터페이스입니다. 이 장에서는 SquirrelMail을 설치하고 설정을 조정하여 사용자가 SquirrelMail 인터페이스에서 이메일 계정 비밀번호를 변경할 수 있도록 하는 방법을 보여줍니다.

SquirrelMail을 설치하려면 다음을 실행합니다:

apt-get install squirrelmail php-pear

다음으로 SquirrelMail 패키지와 함께 제공되는 Apache 구성을 /etc/apache2/conf.d 디렉토리로 복사하고 Apache를 재시작합니다:

cp /etc/squirrelmail/apache.conf /etc/apache2/conf.d/squirrelmail.conf
/etc/init.d/apache2 restart

SquirrelMail은 몇 가지 사전 설치된 플러그인을 제공하지만, 불행히도 그 중 어느 것도 MySQL 데이터베이스에서 이메일 비밀번호를 변경할 수 있는 기능이 없습니다. 그러나 수동으로 설치할 수 있는 Change SQL Password 플러그인이 있습니다:

이 플러그인은 Pear-DB 패키지에 의존하므로 이를 설치합니다:

pear install DB

그런 다음 Change SQL Password 플러그인 자체를 설치합니다:

cd /usr/share/squirrelmail/plugins
wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_sqlpass-3.3-1.2.tar.gz
tar xvfz change_sqlpass-3.3-1.2.tar.gz
cd change_sqlpass
cp config.php.sample config.php

이제 config.php를 편집하고 설정에 맞게 조정해야 합니다. 다음과 같이 $csp_dsn, $lookup_password_query, $password_update_queries, $password_encryption, $csp_salt_static 및 $csp_delimiter 변수를 조정하고 $csp_salt_query는 주석 처리합니다:

mv /usr/share/squirrelmail/plugins/change_sqlpass/config.php /usr/share/squirrelmail/plugins/change_sqlpass/config.php.bak
vi /usr/share/squirrelmail/plugins/change_sqlpass/config.php

그리고 다음을 복사하여 붙여넣습니다:

참고로 변경된 줄은 다음과 같습니다:

[...]
$csp_dsn = 'mysql://mail_admin:mail_admin_password@localhost/mail';
[...]
$lookup_password_query = 'SELECT count(*) FROM users WHERE email = "%1" AND password = %4';
[...]
$password_update_queries = array('UPDATE users SET password = %4 WHERE email = "%1"');
[...]
$password_encryption = 'MYSQLENCRYPT';
[...]
$csp_salt_static = 'LEFT(password, 2)';
[...]
//$csp_salt_query = 'SELECT salt FROM users WHERE username = "%1"';
[...]
$csp_delimiter = '@';
[...]

Change SQL Password 플러그인은 Compatibility 플러그인에도 의존하므로 다음과 같이 설치합니다:

cd /usr/share/squirrelmail/plugins
wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-2.0.11-1.0.tar.gz
tar xvfz compatibility-2.0.11-1.0.tar.gz

이제 SquirrelMail 구성으로 들어가 SquirrelMail에 Courier를 POP3 및 IMAP 서버로 사용한다고 알리고 Change SQL Password 및 Compatibility 플러그인을 활성화해야 합니다:

/usr/sbin/squirrelmail-configure

다음 메뉴가 표시됩니다. 다음과 같이 탐색합니다:

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages
D.  Set pre-defined settings for specific IMAP servers
C   Turn color on
S   Save data
Q   Quit
Command >> <-- D
SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
우리가 SquirrelMail을 빌드하는 동안, 우리는 일부 서버에서 더 잘 작동하는 기본 설정을 발견했습니다. 이 옵션을 선택하면 해당 서버에 대한 몇 가지 사전 정의된 설정이 설정됩니다.
모든 것이 올바른지 확인해야 합니다. 이것은 모든 것을 변경하지 않습니다. 변경되는 설정은 몇 가지에 불과합니다.
귀하의 IMAP 서버를 선택하십시오:
    bincimap    = Binc IMAP 서버
    courier     = Courier IMAP 서버
    cyrus       = Cyrus IMAP 서버
    dovecot     = Dovecot Secure IMAP 서버
    exchange    = Microsoft Exchange IMAP 서버
    hmailserver = hMailServer
    macosx      = Mac OS X 메일 서버
    mercury32   = Mercury/32
    uw          = University of Washington의 IMAP 서버
    quit        = 아무것도 변경하지 않음
Command >> <-- courier
imap_server_type = courier
         default_folder_prefix = INBOX.
                  trash_folder = Trash
                   sent_folder = Sent
                  draft_folder = Drafts
            show_prefix_option = false
          default_sub_of_inbox = false
show_contain_subfolders_option = false
            optional_delimiter = .
                 delete_folder = true
Press any key to continue... <-- 아무 키나 누르세요
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages
D.  Set pre-defined settings for specific IMAP servers
C   Turn color on
S   Save data
Q   Quit
Command >> <-- 8
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
  Available Plugins:
    1. abook_take
    2. administrator
    3. bug_report
    4. calendar
    5. change_sqlpass
    6. compatibility
    7. delete_move_next
    8. demo
    9. filters
    10. fortune
    11. info
    12. listcommands
    13. mail_fetch
    14. message_details
    15. newmail
    16. sent_subfolders
    17. spamcop
    18. squirrelspell
    19. test
    20. translate
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >> <-- 6 (또는 compatibility 플러그인의 번호 - change_sqlpass 플러그인에 필요함)
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. compatibility
  Available Plugins:
    2. abook_take
    3. administrator
    4. bug_report
    5. calendar
    6. change_sqlpass
    7. delete_move_next
    8. demo
    9. filters
    10. fortune
    11. info
    12. listcommands
    13. mail_fetch
    14. message_details
    15. newmail
    16. sent_subfolders
    17. spamcop
    18. squirrelspell
    19. test
    20. translate
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >> <-- 6 (change_sqlpass 플러그인의 번호)
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. compatibility
    2. change_sqlpass
  Available Plugins:
    3. abook_take
    4. administrator
    5. bug_report
    6. calendar
    7. delete_move_next
    8. demo
    9. filters
    10. fortune
    11. info
    12. listcommands
    13. mail_fetch
    14. message_details
    15. newmail
    16. sent_subfolders
    17. spamcop
    18. squirrelspell
    19. test
    20. translate
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >> S
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. compatibility
    2. change_sqlpass
  Available Plugins:
    3. abook_take
    4. administrator
    5. bug_report
    6. calendar
    7. delete_move_next
    8. demo
    9. filters
    10. fortune
    11. info
    12. listcommands
    13. mail_fetch
    14. message_details
    15. newmail
    16. sent_subfolders
    17. spamcop
    18. squirrelspell
    19. test
    20. translate
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >> S
Data saved in config.php
Press enter to continue... <-- 아무 키나 누르세요

이제 브라우저에서 http://192.168.1.104/squirrelmail을 입력하여 SquirrelMail에 접근할 수 있습니다.

이메일 주소 (예: [email protected])와 비밀번호로 로그인합니다.

비밀번호는 옵션 –> 비밀번호 변경에서 변경할 수 있습니다.

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.