2011년 8월 2일 화요일

[Gentoo Linux] netqmail/vpopmail Virtual Mail Hosting System Guide



원문: http://www.gentoo.org/doc/en/qmail-howto.xml


1.  Introduction

2.  netqmail (talking to myself)
emerge mail-mta/netqmail
conflicts 발생하면
{
emerge netqmail -p
emerge -C mail-mta/ssmtp
}

vi /var/qmail/control/servercert.cnf
--------------------------------------------------------------------------------
[ req ]
# you can increase this value, but be aware that it will make things much slower
# this should be a power of 2!
default_bits = 1024
# leave the rest of these alone!
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
prompt = no

[ req_dn ]
# 2-Letter ISO country code
C=KR
# FULL name of state/province/district
# NO abbreviations!
ST=Seoul
# FULL name of city
# NO abbreviations!
L=Seoul
# Full Name of your organization
# NO abbreviations!
O=javaya.org
# Leave this alone unless specifically need to change it!
OU=Automatically-generated Qmail SMTP SSL key
# This should be a FQDN that resolves to the IP of your server
CN=localhost
# This should be the email address for the administrator of the server
emailAddress=postmaster@javaya.org

# Leave this alone!
[ cert_type ]
nsCertType = server
--------------------------------------------------------------------------------
emerge --config netqmail

# cd /var/qmail/alias
# echo qmailmaster > .qmail-root
# echo qmailmaster > .qmail-postmaster
# echo qmailmaster > .qmail-mailer-daemon


# rc-update add svscan default
# /etc/init.d/svscan start
# cd /service
# ln -s /var/qmail/supervise/qmail-send qmail-send


<yskim>
emerge mail-client/mutt


<yskim>
hostname --fqdn
위 명령을 실행한 결과가 javaya.org 등 적절한 결과가 나오지 않는다면 다음 과정을 실행
# vi /etc/conf.d/hostname
# /etc/init.d/hostname restart
# vi /var/qmail/control/me
# vi /var/qmail/control/defaultdomain
# vi /var/qmail/control/plusdomain
# vi /var/qmail/control/locals
# vi /var/qmail/control/rcpthosts


# ssh wmjavayaorg@localhost
# maildirmake .maildir
# qmail-inject root << EOF
test root e-mail!
EOF
# qmail-inject postmaster << EOF
test postmaster e-mail!
EOF
# qmail-inject wmjavayaorg << EOF
test wmjavayaorg@javaya.org e-mail!
EOF
# mutt
정상적으로 위의 메세지가 도착했는지 확인

3.  vpopmail
# emerge vpopmail

<yskim>
/etc/make.conf 파일의 USE에 mysql이 포함되어 있는지 확인하고 없다면 추가한뒤

emerge -C vpopmail
emerge vpopmail


# rc-update add mysql default
If you just emerged mysql for the first time, make sure you run
the ebuild <mysql.ebuild> config command and follow the
directions before starting the mysql server.

# /etc/init.d/mysql start
# nano /etc/vpopmail.conf
(Change the password from 'secret' to 'qlalfdldia')
# mysql -p << EOF
create database vpopmail;
use mysql;
grant select, insert, update, delete, create, drop on vpopmail.* to vpopmail@localhostidentified by 'qlalfdldia';
flush privileges;
EOF
(The following steps may or may not be needed, but we run them just to be sure)
# chown root:vpopmail /etc/vpopmail.conf
# chmod 640 /etc/vpopmail.conf
# chown root:vpopmail /var/vpopmail/bin/vchkpw
# chmod 4711 /var/vpopmail/bin/vchkpw


(You only have to do this if the vadddomain step below results in "command not found")
# source /etc/profile

(While debugging vpopmail, you may want to consult the logs)
# mysql -u vpopmail -p
mysql> select * from vpopmail.vlog;

# vadddomain javaya.org qlalfdldia
(Now quickly verify the domain is setup properly)
# printf "postmaster@javaya.org\0qlalfdldia\0blah\0" | vchkpw `which id` 3<&0
uid=89(vpopmail) gid=89(vpopmail) groups=0(root)
(If you don't see something similar to above, then permissions somewhere are incorrect)

# vadduser qmailmaster@javaya.org qlalfdldia

4.  Courier POP/IMAP

# emerge net-mail/courier-imap

# vi /etc/courier/authlib/authdaemonrc
(Set the authmodulelist variable to only contain "authvchkpw")
authmodulelist에 authvchkpw 만 지정
--------------------------------------------------------------------------------
#authmodulelist="authmysql "
authmodulelist="authvchkpw"
--------------------------------------------------------------------------------

# cd /etc/courier-imap
# vi pop3d.cnf
(Edit the [ req_dn ] section)
[ req_dn ]을 다음과 같이 수정
--------------------------------------------------------------------------------
[ req_dn ]
C=KR
ST=Seoul
L=Seoul
O=Courier Mail Server
OU=Automatically-generated POP3 SSL key
CN=localhost
emailAddress=postmaster@javaya.org
--------------------------------------------------------------------------------

# mkpop3dcert
# rc-update add courier-pop3d-ssl default
# /etc/init.d/courier-pop3d-ssl start


# cd /etc/courier-imap
# vi imapd.cnf
(Edit the [ req_dn ] section)
[ req_dn ]을 다음과 같이 수정
--------------------------------------------------------------------------------
[ req_dn ]
C=KR
ST=Seoul
L=Seoul
O=Courier Mail Server
OU=Automatically-generated IMAP SSL key
CN=localhost
emailAddress=postmaster@javaya.org
--------------------------------------------------------------------------------

# mkimapdcert
# rc-update add courier-imapd-ssl default
# /etc/init.d/courier-imapd-ssl start


5.  netqmail (talking to the world)

# cd /var/qmail/control/
# nano conf-smtpd
(Uncomment the SMTP-AUTH variables and set QMAIL_SMTP_CHECKPASSWORD to /var/vpopmail/bin/vchkpw)
QMAIL_SMTP_CHECKPASSWORD 부분을 다음과 같이 수정
--------------------------------------------------------------------------------
#QMAIL_SMTP_CHECKPASSWORD="/bin/cmd5checkpw"
QMAIL_SMTP_CHECKPASSWORD="/var/vpopmail/bin/vchkpw"
--------------------------------------------------------------------------------

# nano servercert.cnf
(Edit the [ req_dn ] section)
[ req_dn ]을 다음과 같이 수정
--------------------------------------------------------------------------------
# 2-Letter ISO country code
C=KR
# FULL name of state/province/district
# NO abbreviations!
ST=Seoul
# FULL name of city
# NO abbreviations!
L=Seoul
# Full Name of your organization
# NO abbreviations!
O=javaya.org
# Leave this alone unless specifically need to change it!
OU=Automatically-generated Qmail SMTP SSL key
# This should be a FQDN that resolves to the IP of your server
CN=localhost
# This should be the email address for the administrator of the server
emailAddress=postmaster@javaya.org
--------------------------------------------------------------------------------

# mkservercert
# cd /service
# ln -s /var/qmail/supervise/qmail-smtpd qmail-smtpd
# /etc/init.d/svscan restart

********************************************************************************
여기까지만 설치함
********************************************************************************

6.  Horde / IMP Webmail Client
# emerge horde-imp

<yskim>
horde.php 가 conf.php/conf.xml로 바뀐듯..


# cd /var/www/localhost/htdocs/horde/config/
# for f in *.dist ; do mv ${f} ${f/.dist} ; done
# vi horde.php
(Under 'Horde Authentication':)
$conf['auth']['driver'] = 'imap';
$conf['auth']['params']['dsn'] = '{localhost:993/imap/ssl/novalidate-cert}';

(Under 'Horde Logging':)
$conf['log']['name'] = '/var/log/apache2/horde.log';

(Under 'Problem Reporting':)
$conf['problems']['enabled'] = true;
$conf['problems']['email'] = 'webmaster@wh0rd.org';

# nano registry.php
(Under 'Handlers':)
$this->registry['auth']['login'] = 'imp';
$this->registry['auth']['logout'] = 'imp';

(Under 'Application registry':)
Set the 'status' element of applications['imp'] from 'inactive' to 'active'

# touch /var/log/apache2/horde.log
# chown apache:apache /var/log/apache2/horde.log


# cd /var/www/localhost/htdocs/horde/imp/config/
# for f in *.dist ; do mv ${f} ${f/.dist} ; done
# vi servers.php


<yskim>
# vi /etc/apache2/vhosts.d/00_default_vhost.conf
--------------------------------------------------------------------------------
<VirtualHost *:80>
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
    ServerAdmin webmaster@javaya.org
    DocumentRoot "/var/www/localhost/"
    ServerName horde.javaya.org
    RailsDefaultUser wmjavayaorg
    ErrorLog /var/log/apache2/horde.localhost-error_log
    CustomLog /var/log/apache2/horde.localhost-access_log common
</VirtualHost>
--------------------------------------------------------------------------------
# vi /var/named/personal/javaya.org
--------------------------------------------------------------------------------
horde           IN      CNAME   @
--------------------------------------------------------------------------------
# /etc/init.d/named restart







********************************************************************************
Horde 설치
********************************************************************************
emerge horde

cd /var/www/localhost/htdocs/horde/config/
for f in *.dist; do cp $f `basename $f .dist`; done


vi /var/www/localhost/htdocs/horde/scripts/sql/create.mysql.sql
mysql -u root < /var/www/localhost/htdocs/horde/scripts/sql/create.mysql.sql

http://horde.javaya.org/horde/admin/setup/config.php
    Setup ->
    Authentication -> What backend should we use for authenticating users to Horde?
        IMAP / DSN / {localhost:993/imap/ssl/novalidate-cert}
    Logging
        /var/log/apache2/horde.log
    Problem Reporting -> Where should problem report emails be sent?
        webmaster@javaya.org
    Problem Reporting -> If Horde cannot determine a user's ...
        javaya.org

    Generate Horde Configuration 클릭
  
--------------------------------------------------------------------------------
<?php
/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: horde/config/conf.xml,v 1.74.2.41 2006/08/04 17:13:25 jan Exp $
$conf['debug_level'] = E_ALL;
$conf['max_exec_time'] = 0;
$conf['use_ssl'] = 2;
$conf['server']['name'] = $_SERVER['SERVER_NAME'];
$conf['server']['port'] = $_SERVER['SERVER_PORT'];
$conf['compress_pages'] = true;
$conf['umask'] = 077;
$conf['session']['name'] = 'Horde';
$conf['session']['use_only_cookies'] = true;
$conf['session']['cache_limiter'] = 'nocache';
$conf['session']['timeout'] = 0;
$conf['cookie']['domain'] = $_SERVER['SERVER_NAME'];
$conf['cookie']['path'] = '/horde';
$conf['sql']['phptype'] = false;
$conf['auth']['admins'] = array('wmjavayaorg@javaya.org');
$conf['auth']['checkip'] = true;
$conf['auth']['checkbrowser'] = true;
$conf['auth']['alternate_login'] = false;
$conf['auth']['redirect_on_logout'] = false;
$conf['auth']['params']['dsn'] = '{localhost:993/imap/ssl/novalidate-cert}';
$conf['auth']['params']['imapconfig'] = 'dsn';
$conf['auth']['driver'] = 'imap';
$conf['signup']['allow'] = false;
$conf['log']['priority'] = PEAR_LOG_NOTICE;
$conf['log']['ident'] = 'HORDE';
$conf['log']['params'] = array();
$conf['log']['name'] = '/var/log/apache2/horde.log';
$conf['log']['params']['append'] = true;
$conf['log']['type'] = 'file';
$conf['log']['enabled'] = true;
$conf['log_accesskeys'] = false;
$conf['prefs']['driver'] = 'session';
$conf['datatree']['driver'] = 'null';
$conf['group']['driver'] = 'datatree';
$conf['cache']['default_lifetime'] = 1800;
$conf['cache']['params']['dir'] = Horde::getTempDir();
$conf['cache']['params']['gc'] = 86400;
$conf['cache']['driver'] = 'file';
$conf['token']['driver'] = 'none';
$conf['mailer']['params']['sendmail_path'] = '/usr/lib/sendmail';
$conf['mailer']['params']['sendmail_args'] = '-oi';
$conf['mailer']['type'] = 'sendmail';
$conf['vfs']['params']['vfsroot'] = '/tmp';
$conf['vfs']['type'] = 'file';
$conf['sessionhandler']['type'] = 'none';
$conf['problems']['email'] = 'webmaster@javaya.org';
$conf['problems']['maildomain'] = 'javaya.org';
$conf['problems']['tickets'] = false;
$conf['menu']['apps'] = array('imp');
$conf['menu']['always'] = false;
$conf['menu']['links']['help'] = 'all';
$conf['menu']['links']['help_about'] = true;
$conf['menu']['links']['options'] = 'authenticated';
$conf['menu']['links']['problem'] = 'all';
$conf['menu']['links']['login'] = 'all';
$conf['menu']['links']['logout'] = 'authenticated';
$conf['hooks']['permsdenied'] = false;
$conf['hooks']['username'] = false;
$conf['hooks']['preauthenticate'] = false;
$conf['hooks']['postauthenticate'] = false;
$conf['hooks']['authldap'] = false;
$conf['portal']['fixed_blocks'] = array();
$conf['accounts']['driver'] = 'null';
$conf['imsp']['enabled'] = false;
$conf['kolab']['enabled'] = false;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */
--------------------------------------------------------------------------------


********************************************************************************
Horde IMP 설치
********************************************************************************
emerge horde-imp

cd /var/www/localhost/htdocs/horde/imp/config/
for f in *.dist; do cp $f `basename $f .dist`; done

vi /var/www/localhost/htdocs/horde/imp/config/conf.php
--------------------------------------------------------------------------------
<?php
/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: imp/config/conf.xml,v 1.53.2.16 2006/12/24 05:06:57 chuck Exp $
$conf['utils']['gnupg_keyserver'] = array('wwwkeys.pgp.net');
$conf['utils']['gnupg_timeout'] = '10';
$conf['menu']['apps'] = array('imp');
$conf['user']['select_sentmail_folder'] = false;
$conf['user']['allow_resume_all_in_drafts'] = false;
$conf['user']['allow_folders'] = true;
$conf['user']['allow_resume_all'] = false;
$conf['user']['allow_view_source'] = true;
$conf['user']['alternate_login'] = false;
$conf['user']['redirect_on_logout'] = false;
$conf['server']['change_server'] = false;
$conf['server']['change_port'] = false;
$conf['server']['change_protocol'] = false;
$conf['server']['change_smtphost'] = false;
$conf['server']['change_smtpport'] = false;
$conf['server']['server_list'] = 'none';
$conf['server']['sort_limit'] = '0';
$conf['server']['cache_folders'] = false;
$conf['server']['cache_msgbody'] = false;
$conf['mailbox']['show_attachments'] = false;
$conf['mailbox']['show_preview'] = false;
$conf['mailbox']['show_xpriority'] = false;
$conf['fetchmail']['show_account_colors'] = false;
$conf['fetchmail']['size_limit'] = '4000000';
$conf['msgsettings']['filtering']['words'] = './config/filter.txt';
$conf['msgsettings']['filtering']['replacement'] = '****';
$conf['spam']['reporting'] = false;
$conf['notspam']['reporting'] = false;
$conf['msg']['prepend_header'] = true;
$conf['msg']['append_trailer'] = true;
$conf['compose']['allow_cc'] = true;
$conf['compose']['allow_bcc'] = true;
$conf['compose']['allow_receipts'] = true;
$conf['compose']['special_characters'] = true;
$conf['compose']['use_vfs'] = false;
$conf['compose']['link_all_attachments'] = false;
$conf['compose']['link_attachments_notify'] = true;
$conf['compose']['link_attachments'] = true;
$conf['compose']['add_maildomain_to_unexpandable'] = false;
$conf['compose']['attach_size_limit'] = '0';
$conf['compose']['attach_count_limit'] = '0';
$conf['hooks']['vinfo'] = false;
$conf['hooks']['signature'] = false;
$conf['hooks']['trailer'] = false;
$conf['hooks']['fetchmail_filter'] = false;
$conf['hooks']['mbox_redirect'] = false;
$conf['hooks']['mbox_icon'] = false;
$conf['hooks']['spam_bounce'] = false;
$conf['maillog']['use_maillog'] = true;
$conf['tasklist']['use_tasklist'] = true;
$conf['notepad']['use_notepad'] = true;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */
--------------------------------------------------------------------------------

댓글 없음:

댓글 쓰기