Fetchmail Won’t Put Messages into Cyrus. Postfix LMTP Problem

emailimappostfix

I'm trying to get fetchmail to suck down messages from a POP3 server, and insert them into Cyrus for local IMAP delivery.

Cyrus works fine by itself, and I can connect to it with ThunderBird on a remote computer.

Fetchmail appears to be sucking messages down, but isn't putting them in Cyrus (or anywhere for that matter).

/var/log/mail.log shows:


Aug  5 03:58:57 IMAP postfix/lmtp[8537]: 57ECB1A15BC: to=, relay=none,
delay=77830, delays=77829/0.56/0/0, dsn=4.4.1, status=deferred
(connect to IMAP.IMAP[/var/run/cyrus/socket/lmtp]: No such file or directory)

The socket "/var/run/cyrus/socket/lmtp" does actually exist on the system. It's owned by root:root, but I've chmoded it to 777 for troubleshooting purposes, so there shouldn't be any permission problems.

My postfix main.cf file:


smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

readme_directory = no

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:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = IMAP.IMAP
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = myserver.com, IMAP.IMAP, localhost.IMAP, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

mailbox_transport = lmtp:unix:/var/run/cyrus/socket/lmtp
virtual_transport = lmtp:unix:/var/run/cyrus/socket/lmtp

virtual_alias_domains = somesite.com
virtual_alias_maps = hash:/etc/postfix/virtual
home_mailbox = Maildir/
mailbox_command = 

postfix master.cf


....
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
        -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
...

imapd.conf


...
# Unix domain socket that lmtpd listens on.
lmtpsocket: /var/run/cyrus/socket/lmtp
...

cyrus.conf


...
lmtpunix    cmd="lmtpd" listen="/var/run/cyrus/socket/lmtp" prefork=0 maxchild=20
...

.fetchmailrc


set syslog;
set daemon 90;
set postmaster "postfix"

poll "mail.somesite.com"
with protocol pop3
user "me@somesite.com" there with password "54321" is "me" here --keep

poll "mail.mia.bellsouth.net"
with protocol pop3
user "me" there with password "54321" is "me" here --keep

What else can I try?

Best Answer

Please check if your postfix lmtp is chrooted by configuration in master.cf

if you find a line like

lmtp unix - - - - - lmtp

or even

lmtp unix - - y - - lmtp

you'll need to check if the socket exists in the chroot (most likely /var/spool/postfix).

e.g.: does /var/spool/postfix/var/run/cyrus/socket/lmtp exist? (instead of /var/run/cyrus/socket/lmtp)

If thats the case you can remove chrooting from lmtp, by a line in master.cf like

lmtp unix - - n - - lmtp

or you could mount-bind /var/run/cyrus/socket to coexist within the chroot.