#freeze
[[CentOS]]
** postfix[#m1582486]
postfix のデータベース対応版を yum でインストール
centosplus を有効に
vi /etc/yum.repos.d/CentOS-Base.repo
[centosplus]
enabled=1
yum update
centosplusのkernelで再起動
(NICのドライバ等インストールしなおす)
yum --disablerepo=base,updates install postfix
echo "exclude=postfix" >> /etc/yum.conf
alternatives --config mta
/etc/rc.d/init.d/postfix start
chkconfig --list postfix
postconf -m|grep mysql
設定
virtual用のフォルダ用意
/usr/sbin/useradd -u 10000 -s /bin/false vuser
mkdir /mail
chown vuser:vuser /mail
chmod 771 /mail
==> /etc/postfix/main.cf <==
manpage_directory = /usr/share/man
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
myhostname = host.zenno.net
mynetworks = 127.0.0.0/8
home_mailbox = Maildir/
disable_vrfy_command = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
virtual_mailbox_base = /mail
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 10000
virtual_uid_maps = static:10000
virtual_gid_maps = static:10000
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_inbox = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
==> mysql_virtual_alias_maps.cf <==
user = postfix
password = ********
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
==> mysql_virtual_domains_maps.cf <==
user = postfix
password = ********
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active = '1'
==> mysql_virtual_mailbox_limit_maps.cf <==
user = postfix
password = ********
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
==> mysql_virtual_mailbox_maps.cf <==
user = postfix
password = ********
hosts = localhost
dbname = postfix
table = mailbox
select_field = concat(maildir,'Maildir/')
where_field = username
submissionポート
/etc/postfix/master.cf
> submission inet n - n - - smtpd
** Dovecot [#udd82180]
yum install dovecot
chkconfig dovecot on
chkconfig --list dovecot
==> /etc/dovecot.conf <==
protocols = imap pop3
auth default {
mechanisms = plain login digest-md5 cram-md5
passdb sql {
args = /etc/dovecot-mysql.conf
}
userdb sql {
args = /etc/dovecot-mysql.conf
}
user = root
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
==> /etc/dovecot-mysql.conf <==
driver = mysql
default_pass_scheme = PLAIN
connect = dbname=postfix user=postfix host=/var/lib/mysql/mysql.sock password=********
password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'
user_query = SELECT concat('/mail/', maildir) as home, 10000 as uid, 10000 as gid FROM mailbox WHERE username = '%u' AND active = '1'
yum install cyrus-sasl-plain cyrus-sasl-md5
** MySQL [#s152ecb1]
CREATE DATABASE postfix;
CREATE USER 'postfix'@'localhost' IDENTIFIED BY '********';
GRANT ALL PRIVILEGES ON `postfix` . * TO 'postfix'@'localhost';
** postfixadmin [#oafbb2f0]
# diff config.inc.php.org config.inc.php
31c31
< $CONF['configured'] = false;
---
> $CONF['configured'] = true;
37c37
< $CONF['postfix_admin_url'] = '';
---
> $CONF['postfix_admin_url'] = 'http://host.zenno.net/postfixadmin';
53c53
< $CONF['database_password'] = 'postfixadmin';
---
> $CONF['database_password'] = '********';
76c76
< $CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld';
---
> $CONF['admin_email'] = 'postmaster@host.zenno.net';
90c90
< $CONF['encrypt'] = 'md5crypt';
---
> $CONF['encrypt'] = 'cleartext';
109c109
< $CONF['page_size'] = '10';
---
> $CONF['page_size'] = '100';
114,117c114,117
< 'abuse' => 'abuse@change-this-to-your.domain.tld',
< 'hostmaster' => 'hostmaster@change-this-to-your.domain.tld',
< 'postmaster' => 'postmaster@change-this-to-your.domain.tld',
< 'webmaster' => 'webmaster@change-this-to-your.domain.tld'
---
> 'abuse' => 'abuse@host.zenno.net',
> 'hostmaster' => 'hostmaster@host.zenno.net',
> 'postmaster' => 'postmaster@host.zenno.net',
> 'webmaster' => 'webmaster@host.zenno.net'
125c125
< $CONF['domain_path'] = 'NO';
---
> $CONF['domain_path'] = 'YES';
131c131
< $CONF['domain_in_mailbox'] = 'YES';
---
> $CONF['domain_in_mailbox'] = 'NO';
167c167
< $CONF['vacation_domain'] = 'autoreply.change-this-to-your.domain.tld';
---
> $CONF['vacation_domain'] = 'autoreply.host.zenno.net';
200c200
< $CONF['backup'] = 'YES';
---
> $CONF['backup'] = 'NO';
204c204
< $CONF['sendmail'] = 'YES';
---
> $CONF['sendmail'] = 'NO';
212c212
< $CONF['fetchmail'] = 'YES';
---
> $CONF['fetchmail'] = 'NO';
224c224
< $CONF['user_footer_link'] = "http://change-this-to-your.domain.tld/main";
---
> $CONF['user_footer_link'] = "http://host.zenno.net/main";
230,231c230,231
< $CONF['footer_text'] = 'Return to change-this-to-your.domain.tld';
< $CONF['footer_link'] = 'http://change-this-to-your.domain.tld';
---
> $CONF['footer_text'] = 'Return to host.zenno.net';
> $CONF['footer_link'] = 'http://host.zenno.net';
244c244
< $CONF['emailcheck_resolve_domain']='YES';
---
> $CONF['emailcheck_resolve_domain']='NO';
** phpMyAdmin [#q1e1ec03]
yum --enablerepo=epel install phpMyAdmin
vi /etc/httpd/conf.d/phpMyAdmin.conf
allow from 192.168.0.0/24