서버 구성 · 3 min read · Dec 31, 2025

Groupware Server With Group-Office, Postfix, Dovecot And SpamAssassin On Debian Lenny (5.0) - Page 2

Postfix 구성

Postfix는 MySQL을 사용하도록 구성해야 합니다:

main.cf의 다음 변수를 설정합니다. 기본 정보를 입력하는 것으로 시작합니다:

# postconf -e 'myhostname = mx-1.example.com'  
# postconf -e 'smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)'  
# postconf -e 'biff = no'  
# postconf -e 'append_dot_mydomain = no'  
# postconf -e 'myorigin = example.com'  
# postconf -e 'mydestination = $myhostname, localhost, locahost.localdomain'  
# postconf -e 'mynetworks = 127.0.0.0/8'  
# postconf -e 'recipient_delimiter = +'  
# postconf -e 'inet_interfaces = all'  
# 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 $virtual_mailbox_limit_maps'   
  
# postconf -e 'smtpd_recipient_restrictions = \  
    permit_mynetworks, \  
    reject_unauth_destination, \  
    reject_rbl_client zen.spamhaus.org, \  
    reject_rbl_client list.dsbl.org, \  
    permit'  
# postconf -e 'message_size_limit=52428800'  
# postconf -e 'mailbox_size_limit=0'

이제 MySQL의 가상 사용자에 대해 구성합니다:

# postconf -e 'virtual_alias_domains ='  
# postconf -e 'virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf'  
# postconf -e 'virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf'  
# postconf -e 'virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf'  
# postconf -e 'virtual_mailbox_base = /vmail'  
# postconf -e 'virtual_minimum_uid = 150'  
# postconf -e 'virtual_uid_maps = static:150'  
# postconf -e 'virtual_gid_maps = static:8'  
# postconf -e 'virtual_create_maildirsize = yes'  
# postconf -e 'virtual_mailbox_extended = yes'  
# postconf -e 'virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf'  
# postconf -e 'virtual_mailbox_limit_override = yes'  
# postconf -e 'virtual_maildir_limit_message = "The user you are trying to reach has exceeded their quota."'  
# postconf -e 'virtual_overquota_bounce = yes'  
# postconf -e 'transport_maps = proxy:mysql:/etc/postfix/mysql_virtual_transports.cf'  
# postconf -e 'relay_domains = proxy:mysql:/etc/postfix/mysql_relay_domains_maps.cf'

Dovecot 배달을 사용할 것입니다:

# postconf -e 'virtual_transport=dovecot'  
# postconf -e 'dovecot_destination_recipient_limit=1'  
# postconf -e 'transport_maps = hash:/etc/postfix/transport'  
# postconf -e 'smtpd_data_restrictions = reject_unauth_pipelining, reject_multi_recipient_bounce, permit'  
# postconf -e 'vacation_destination_recipient_limit = 1'

전송 데이터베이스를 생성합니다:

# cd /etc/postfix  
# postmap transport

Postfix는 MySQL 지원으로 설치되었지만, 이는 이미 데이터베이스를 사용하는 방법을 알고 있다는 의미는 아닙니다. 데이터베이스의 각 유형의 테이블에 대한 다양한 SQL 쿼리 정보를 제공해야 합니다. 이 정보는 main.cf 파일에 정의된 MySQL 파일에 저장됩니다:

/etc/postfix/mysql_virtual_alias_maps.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_aliases
select_field = goto
where_field = address
additional_conditions = and active = '1'

/etc/postfix/mysql_virtual_domains_maps.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_domains
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'

/etc/postfix/mysql_virtual_mailbox_limit_maps.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_mailboxes
select_field = quota
where_field = username
additional_conditions = and active = '1'

/etc/postfix/mysql_virtual_mailbox_maps.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_mailboxes
select_field = maildir
where_field = username
additional_conditions = and active = '1'

/etc/postfix/mysql_virtual_transports.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_domains
select_field = transport
where_field = domain
additional_conditions = and active = '1'

/etc/postfix/mysql_relay_domains_maps.cf:

user = vmail_user
password = vmail_user_password
hosts = localhost
dbname = groupoffice
table = pa_domains
select_field = domain
where_field = domain
additional_conditions = and backupmx = '1' and active = '1'

메일 사용자를 추가합니다:

# useradd -r -u 150 -g mail -d /var/vmail -s /sbin/nologin -c "Virtual Mailbox" vmail  
# mkdir /vmail  
# chmod 770 /vmail/  
# chown vmail:mail /vmail/

Postfix master.cf를 편집합니다:

smtp 서비스의 첫 번째 줄을 변경합니다:

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}
dovecot   unix  -       n       n       -       -       pipe
    flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -d ${recipient}

비-Postfix 소프트웨어와의 인터페이스에 추가합니다:

vacation    unix  -       n       n       -       -       pipe
  flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
Share: X/Twitter LinkedIn

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

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