Saturday, March 7, 2009

Tutorial Dovecot and Postfix

I user postfix and dovecot , but i can't configure auth..

/etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = jony.atlantica.us
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = jony.atlantica.us
mydestination = jony.atlantica.us
mynetworks = 192.168.0.0/28, 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
delay_notice_recipient = d3v1ous
queue_directory = /var/mail
bounce_notice_recipient = d3v1ous
2bounce_notice_recipient = d3v1ous
error_notice_recipient = d3v1ous

# User

# helo restrictions
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions =
permit_mynetworks,
reject_invalid_hostname,
permit

# sender restrictions
smtpd_sender_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit

# recipient restriction
smtpd_recipient_restrictions =
reject_unauth_pipelining,
permit_sasl_authenticated,
permit_mynetworks,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_destination

#enable SMTP auth for relaying
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = /private/auth-client
# deliver with dovecot
dovecot_destination_recipient_limit = 1
mailbox_transport = dovecot
local_recipient_maps =

##########################################################################################################################

/etc/dovecot/dovecot.conf

shutdown_clients = yes
ssl_disable = no
base_dir = /var/run/dovecot/
protocols = imap pop3 imaps pop3s
listen = [::]
protocol imap {
listen = *:143
ssl_listen = *:993
login_executable = /usr/lib/dovecot/imap-login
mail_executable = /usr/lib/dovecot/imap
}
protocol pop3 {
listen = *:110
ssl_listen = *:995
login_executable = /usr/lib/dovecot/pop3-login
mail_executable = /usr/lib/dovecot/pop3
pop3_no_flag_updates = yes
pop3_reuse_xuidl = no
pop3_lock_session = no
pop3_uidl_format = %08Xu%08Xv
pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol lda {
postmaster_address = main@main.com
}
disable_plaintext_auth = no
log_timestamp = "%b %d %H:%M:%S "
syslog_facility = mail
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_process_size = 64
login_process_per_connection = yes
login_processes_count = 16
login_max_processes_count = 128
login_max_connections = 256
login_greeting = Dovecot ready.
login_log_format_elements = user=<%u> rip=%r %c
login_log_format = %$: %s
mail_location = mbox:~/mail/:INBOX=/var/mail/%u
mail_full_filesystem_access = no
mail_debug = no
mail_log_prefix = "%Us(%u): "
mail_read_mmaped = no
lock_method = fcntl
mail_drop_priv_before_exec = no
verbose_proctitle = no
#first_valid_uid = 10000
#last_valid_uid = 10000
#first_valid_gid = 10000
#last_valid_gid = 10000
max_mail_processes = 1024
mail_process_size = 256
mail_max_keyword_length = 50
umask = 0077
valid_chroot_dirs = /
mbox_read_locks = fcntl
mbox_write_locks = fcntl
mbox_lock_timeout = 300
mbox_dotlock_change_timeout = 120
mbox_dirty_syncs = yes
auth_executable = /usr/lib/dovecot/dovecot-auth
auth_process_size = 256
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
auth_username_format = %Lu
auth_verbose = no
auth_debug = no
auth_debug_passwords = no
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
count = 1
ssl_require_client_cert = no
ssl_username_from_cert = no
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0660
user = dovecot
group = dovecot
}
client {
path = /var/spool/postfix/private/auth-client
mode = 0666
user = postfix
group = mail
}
}
}

##########################################################################################################################

ls /var/spool/postfix/private/auth-client -l
srw-rw-rw- 1 postfix mail 0 2008-03-18 11:19 /var/spool/postfix/private/auth-client

ls /var/run/dovecot/auth-master -l
srw-rw---- 1 dovecot dovecot 0 2008-03-18 11:19 /var/run/dovecot/auth-master

/var/log/mail.log

Mar 18 11:20:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139
Mar 18 11:20:56 main dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 18 11:20:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139
Mar 18 11:20:56 main dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 18 11:20:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139
Mar 18 11:20:56 main dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 18 11:20:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139
Mar 18 11:20:56 main dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 18 11:20:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139
Mar 18 11:20:56 main dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 18 11:21:56 main dovecot: imap-login: Login: user=, rip=217.18.252.139

##########################################################################################################################

/var/log/mail.log

Mar 18 11:40:32 jony postfix/master[30724]: daemon started -- version 2.3.8, configuration /etc/postfix
Mar 18 11:40:34 jony postfix/smtpd[30731]: warning: SASL: Connect to private/auth-client failed: No such file or directory
Mar 18 11:40:34 jony postfix/smtpd[30731]: fatal: no SASL authentication mechanisms
Mar 18 11:40:35 jony postfix/master[30724]: warning: process /usr/lib/postfix/smtpd pid 30731 exit status 1
Mar 18 11:40:35 jony postfix/master[30724]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling