Здравствуйте.
Пытаюсь запилить почтовик в связке postfix, mysql и dovecot, но что-то идет не так (freebsd 10.3). Какие-то глобальные конфиги даже не пытался пихать, пока с простейшим не фурчит.echo "test" | mail root
May 15 12:36:56 mail2 postfix/pickup[1285]: 6ECFB2199B58: uid=0 from=<root>
May 15 12:36:56 mail2 postfix/cleanup[1405]: 6ECFB2199B58: message-id=<20170515093656.6ECFB2199B58@mail2.tratata.local>
May 15 12:36:56 mail2 postfix/qmgr[1286]: 6ECFB2199B58: from=<root@tratata.local>, size=297, nrcpt=1 (queue active)
May 15 12:36:56 mail2 postfix/trivial-rewrite[1406]: warning: do not list domain tratata.local in BOTH mydestination and virtual_mailbox_domains
May 15 12:36:56 mail2 postfix/trivial-rewrite[1406]: warning: do not list domain tratata.local in BOTH mydestination and virtual_mailbox_domains
May 15 12:36:56 mail2 postfix/local[1407]: 6ECFB2199B58: to=<mailadmin@tratata.local>, orig_to=<root>, relay=local, delay=0.05, delays=0.02/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "mailadmin")
May 15 12:36:56 mail2 postfix/cleanup[1405]: 7767E2199B5A: message-id=<20170515093656.7767E2199B5A@mail2.tratata.local>
May 15 12:36:56 mail2 postfix/bounce[1408]: 6ECFB2199B58: sender non-delivery notification: 7767E2199B5A
May 15 12:36:56 mail2 postfix/qmgr[1286]: 7767E2199B5A: from=<>, size=2271, nrcpt=1 (queue active)
May 15 12:36:56 mail2 postfix/trivial-rewrite[1406]: warning: do not list domain tratata.local in BOTH mydestination and virtual_mailbox_domains
May 15 12:36:56 mail2 postfix/qmgr[1286]: 6ECFB2199B58: removed
May 15 12:36:56 mail2 postfix/local[1407]: 7767E2199B5A: to=<mailadmin@tratata.local>, orig_to=<root@tratata.local>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.1.1, status=bounced (unknown user: "mailadmin")
May 15 12:36:56 mail2 postfix/qmgr[1286]: 7767E2199B5A: removed
Почтовый /usr/local/etc/postfix/main.cf
compatibility_level = 2
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
mail_owner = postfix
myhostname = mail2.tratata.local
mydomain = tratata.local
myorigin = $mydomain
mydestination = mail2.tratata.local, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
alias_maps = hash:/etc/mail/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = /usr/local/share/doc/postfix
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = /usr/local/share/doc/postfix
inet_protocols = ipv4
meta_directory = /usr/local/libexec/postfix
shlib_directory = /usr/local/lib/postfix
virtual_mailbox_domains = mysql:/usr/local/etc/postfix/virtual/domains.sql
virtual_mailbox_maps = mysql:/usr/local/etc/postfix/virtual/users.sql
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
cat /usr/local/etc/postfix/virtual/domains.sql
unix:file=/tmp/mysql.sock
user = reader
password = 12345678
dbname = mail
table = domains
select_field = domain
where_field = domain
cat /usr/local/etc/postfix/virtual/users.sql
unix:file=/tmp/mysql.sock
user = reader
password = 12345678
dbname = mail
table = users
select_field = concat ( '/mail', home )
where_field = email
сам файл для создания mysql простейший:
create database mail DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
use mail;
create table domains (
domain char(32) NOT NULL UNIQUE
);
insert into domains value ( 'tratata.local' );
create table users (
email VARCHAR(32) NOT NULL UNIQUE PRIMARY KEY,
home VARCHAR(16) NOT NULL UNIQUE,
password VARCHAR(64) NOT NULL
) ENGINE = InnoDB;
insert into users value ('mailadmin@tratata.local','mailadmin','12345');
insert into users value ('test@tratata.local','test','12345');
grant select on mail.* to 'reader'@'localhost';
grant select on mail.* to 'reader'@'127.0.0.1';
grant select on mail.* to 'reader'@'::1';
use mysql;
update user set password=password('12345678') where user='reader';
flush privileges;
ну и довекотовский /usr/local/etc/dovecot/dovecot-sql.conf.ext
driver = mysql
connect = host=/tmp/mysql.sock dbname=mail user=reader password=12345678
default_pass_scheme = PLAIN
user_query = select concat ( '/MAIL/', home ) as home from users where email = '%u'
password_query = select password from users where email = '%u'