I am trying to automatically move mails detected as spam to the junk folder but my sieve filters are not running.
I can send and receive mails and mails are detected as spam.
X-Virus-Scanned: amavisd-new at ...
X-Spam-Flag: YES
X-Spam-Score: 999.802
X-Spam-Level: ****************************************************************
X-Spam-Status: Yes, score=999.802 tagged_above=-999 required=5
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, GTUBE=1000,
HTML_MESSAGE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001]
autolearn=no autolearn_force=no
I think the problem is, that postfix does not deliver mails via dovecot but I can not figure out why.
My System:
Arch Linux
postfix 3.3.2-3
dovecot 2.3.4.1-1
Things I have done or checked again and again...
pidgeonehole is installed
The dovecot-lmtp socket exists in /var/spool/postfix/private and is read- and writable to postfix
The virtual_transport in postfix main.cf is set to lmtps:unix:private/dovecot-lmtp
lmtp service and protocol blocks in dovecot.conf are present and protocols value contains lmtp
path to global sieve scripts seems to be correct
sieve scripts are compiling without errors
Folder junk exists
Dovecot never logs anything related to lmtp even if mail_debug = yes is set
I really dont have any idea anymore. So below are some relevant information. Being in hope that someone can help me to get this to working.
Here is an excerpt of the postfix log where postfix always sais ...status=sent (delivered to maildir)
Feb 10 19:37:59 hostname postfix/w.x.y.z/postscreen[1133]: CONNECT from [209.85.208.174]:44008 to [w.x.y.z]:25
Feb 10 19:37:59 hostname postfix/dnsblog[1136]: addr 209.85.208.174 listed by domain dnsbl.sorbs.net as 127.0.0.6
Feb 10 19:37:59 hostname postfix/dnsblog[1138]: addr 209.85.208.174 listed by domain hostkarma.junkemailfilter.com as 127.0.0.3
Feb 10 19:37:59 hostname postfix/dnsblog[1138]: addr 209.85.208.174 listed by domain hostkarma.junkemailfilter.com as 127.0.1.1
Feb 10 19:38:00 hostname postfix/w.x.y.z/postscreen[1133]: PASS OLD [209.85.208.174]:44008
Feb 10 19:38:00 hostname postfix/w.x.y.z/smtpd[1142]: connect from mail-lj1-f174.google.com[209.85.208.174]
Feb 10 19:38:00 hostname postfix/w.x.y.z/smtpd[1142]: Anonymous TLS connection established from mail-lj1-f174.google.com[209.85.208.174]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Feb 10 19:38:00 hostname postfix/w.x.y.z/smtpd[1142]: NOQUEUE: client=mail-lj1-f174.google.com[209.85.208.174]
Feb 10 19:38:02 hostname postfix/smtpd[1159]: connect from unknown[127.0.0.1]
Feb 10 19:38:02 hostname postfix/smtpd[1159]: 6262DAE1876: client=unknown[127.0.0.1]
Feb 10 19:38:02 hostname postfix/cleanup[1160]: 6262DAE1876: message-id=
Feb 10 19:38:02 hostname postfix/smtpd[1159]: disconnect from unknown[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Feb 10 19:38:02 hostname postfix/qmgr[28602]: 6262DAE1876: from=, size=5817, nrcpt=1 (queue active)
Feb 10 19:38:02 hostname postfix/smtpd[1159]: connect from unknown[127.0.0.1]
Feb 10 19:38:02 hostname postfix/smtpd[1159]: 67345AE1879: client=unknown[127.0.0.1], orig_client=mail-lj1-f174.google.com[209.85.208.174]
Feb 10 19:38:02 hostname postfix/cleanup[1160]: 67345AE1879: message-id=
Feb 10 19:38:02 hostname postfix/smtpd[1159]: disconnect from unknown[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 quit=1 commands=6
Feb 10 19:38:02 hostname postfix/qmgr[28602]: 67345AE1879: from=, size=3901, nrcpt=1 (queue active)
Feb 10 19:38:02 hostname postfix/w.x.y.z/smtpd[1142]: proxy-accept: END-OF-MESSAGE: 250 2.0.0 from MTA(smtp:[127.0.0.1]:10035): 250 2.0.0 Ok: queued as 67345AE1879; from= to= proto=ESMTP helo=
Feb 10 19:38:02 hostname postfix/virtual[1161]: 6262DAE1876: to=, orig_to=, relay=virtual, delay=0.05, delays=0.02/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Feb 10 19:38:02 hostname postfix/qmgr[28602]: 6262DAE1876: removed
Feb 10 19:38:02 hostname postfix/virtual[1161]: 67345AE1879: to=, relay=virtual, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Feb 10 19:38:02 hostname postfix/qmgr[28602]: 67345AE1879: removed
In postfix master.cf I set:
...
lmtps unix - - - - - lmtp
-o lmtp_use_tls=yes
-o lmtp_tls_loglevel=1
-o lmtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt
-o lmtp_enforce_tls=yes
-o lmtp_tls_mandatory_protocols=!SSLv2,!SSLv3
-o lmtp_tls_protocols=!SSLv2,!SSLv3
-o lmtp_tls_mandatory_ciphers=high
-o lmtp_tls_ciphers=high
-o lmtp_send_xforward_command=yes
-o lmtp_tls_security_level=encrypt
-o lmtp_tls_note_starttls_offer=yes
...
In postfix main.cf I set:
...
virtual_transport = lmtps:unix:private/dovecot-lmtp
...
dovecot.conf:
...
protocols = imap lmtp sieve
...
service managesieve-login {
inet_listener sieve {
port = 4190
}
service_count = 1
process_min_avail = 2
vsz_limit = 128M
}
service managesieve {
process_limit = 256
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
user = vmail
}
...
protocol lmtp {
mail_plugins = quota sieve acl notify
auth_socket_path = /var/run/dovecot/auth-master
postmaster_address = ...
}
protocol sieve {
managesieve_max_line_length = 65536
mail_max_userip_connections = 10
mail_plugins =
managesieve_logout_format = bytes=%i/%o
managesieve_implementation_string = Dovecot Pigeonhole
managesieve_sieve_capability =
managesieve_notify_capability =
managesieve_max_compile_errors = 5
}
...
plugin {
...
sieve_extensions = +spamtest
sieve_spamtest_status_type = score
sieve_spamtest_status_header = \
X-Spam_score: (-?[[:digit:]]+\.[[:digit:]]).*
sieve_spamtest_max_value = 5.0
# Own sieve filters are located in the home directory
sieve = file:~/sieve;active=~/.dovecot.sieve
# The global filter is located outside
sieve_before = /var/lib/dovecot/sieve/move_to_spam_folder.sieve
sieve_max_script_size = 1M
sieve_quota_max_scripts = 0
sieve_quota_max_storage = 0
# Continue even if the quota can not be determined
# Valid for the Postfix policy service provided from Dovecot
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is over quota"
sieve_plugins = sieve_imapsieve sieve_extprograms
# From elsewhere to Spam folder
imapsieve_mailbox1_name = Junk
imapsieve_mailbox1_cause = COPY
imapsieve_mailbox1_before = file:/var/lib/dovecot/sieve/report-spam.sieve
# From Spam folder to elsewhere
imapsieve_mailbox2_name = *
imapsieve_mailbox2_from = Junk
imapsieve_mailbox2_cause = COPY
imapsieve_mailbox2_before = file:/var/lib/dovecot/sieve/report-ham.sieve
sieve_pipe_bin_dir = /var/lib/dovecot/sieve
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}
Finally the global sieve script:
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
}
Related
I am writing a REST plugin for Foswiki using Perl and I am facing an reliability issue when using File::Find. I have tried my best to write a minimal reproducible example. The plugin uses File::Find to traverse directories and print the filenames in the HTTP response. The REST request is working properly 4 times, but stop to work the 5th time. The HTTP status remain “HTTP/1.1 200 OK” but no file is reported by File::Find anymore.
The webserver is nginx and is configured to use FastCGI. It appear to run 4 working threads managed by foswiki-fcgi-pm:
> ps aux
www-data 16957 0.0 7.7 83412 78332 ? Ss 16:52 0:00 foswiki-fcgi-pm
www-data 16960 0.0 7.5 83960 76740 ? S 16:52 0:00 foswiki-fcgi
www-data 16961 0.0 7.6 84004 76828 ? S 16:52 0:00 foswiki-fcgi
www-data 16962 0.0 7.6 83956 76844 ? S 16:52 0:00 foswiki-fcgi
www-data 16963 0.0 7.5 83960 76740 ? S 16:52 0:00 foswiki-fcgi
Firstly, the plugin initialization simply register the REST handler:
sub initPlugin {
my ( $topic, $web, $user, $installWeb ) = #_;
# check for Plugins.pm versions
if ( $Foswiki::Plugins::VERSION < 2.3 ) {
Foswiki::Func::writeWarning( 'Version mismatch between ',
__PACKAGE__, ' and Plugins.pm' );
return 0;
}
Foswiki::Func::registerRESTHandler(
'restbug', \&RestBug,
authenticate => 0, # Set to 0 if handler should be useable by WikiGuest
validate => 0, # Set to 0 to disable StrikeOne CSRF protection
http_allow => 'GET,POST', # Set to 'GET,POST' to allow use HTTP GET and POST
description => 'Debug'
);
# Plugin correctly initialized
return 1;
}
Secondly, the REST handler is implemented as follow, printing all the files it can possibly find:
sub RestBug {
my ($session, $subject, $verb, $response) = #_;
my #Directories = ("/var/www/foswiki/tools");
sub findfilestest
{
$response->print("FILE $_\n");
}
find({ wanted => \&findfilestest }, #Directories );
}
When I test the REST service with a HTTP request, the first 4 times I get the following HTTP response, which seems quite satisfying:
HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Tue, 22 Nov 2022 09:23:10 GMT
Content-Length: 541
Connection: keep-alive
Set-Cookie: SFOSWIKISID=385db599c5d66bb19591e1eef7f1a854; path=/; secure; HttpOnly
FILE .
FILE foswiki.freebsd.init-script
FILE bulk_copy.pl
FILE dependencies
FILE mod_perl_startup.pl
FILE geturl.pl
FILE extender.pl
FILE extension_installer
FILE configure
FILE lighttpd.pl
FILE foswiki.freebsd.etc-defaults
FILE save-pending-checkins
FILE babelify
FILE upgrade_emails.pl
FILE tick_foswiki.pl
FILE foswiki.defaults
FILE rewriteshebang.pl
FILE fix_file_permissions.sh
FILE foswiki.init-script
FILE convertTopicSettings.pl
FILE mailnotify
FILE html2tml.pl
FILE tml2html.pl
FILE systemd
FILE foswiki.service
The following attempts give this unexpected response:
HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Tue, 22 Nov 2022 09:24:56 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: SFOSWIKISID=724b2c4b1ddfbebd25d0dc2a0f182142; path=/; secure; HttpOnly
Note that if I restart Foswiki with the command systemctl restart foswiki, the REST service work again 4 more times.
How to make this REST service work more than 4 times in a row?
I'm new to Freeswitch and looking for help from experts. My problem is below.
I'm trying to do below scenario in Perl:
When I'm getting an incoming call to script (test.pl) I play a file to it and then put inbound session to on-hold. Then I try to make new outbound session from a separate script (test2.pl). If outbound call get answer, then I break inbound session from on-hold and bridge both sessions. The scrips are like below.
test.pl
use strict;
use warnings;
our $session;
if( $session->ready() ) {
$session->setVariable( 'hangup_after_bridge', 'false' );
$session->setVariable( 'continue_on_fail', 'true' );
$session->answer();
my $api = new freeswitch::API;
$api->execute('perlrun', '/usr/share/freeswitch/scripts/test2.pl ' . $session->get_uuid());
$session->setVariable('playback_timeout_sec', '70');
$session->execute("playback", '$${hold_music}');
if ($session->getVariable('outbound_answered') == 'true') {
my $outbound_uuid = $session->getVariable('outbound_uuid');
my $outbound_session = new freeswitch::Session($outbound_uuid);
if ($outbound_session->ready()) {
$session->bridge($outbound_session);
} else {
# outbound session disconnected.
}
} else {
# outbound session didn't answer.
}
} else {
# Inbound disconneected.
}
1;
test2.pl
use strict;
use warnings;
my $api = new freeswitch::API;
my $inbound_uuid = $ARGV[0];
my $inbound_session = new freeswitch::Session( $inbound_uuid );
my $originate_str = "sofia/gateway/outbound/0416661666";
my $outbound_session = new freeswitch::Session( $originate_str );
my $hangup_cause_out = $outbound_session->hangupCause();
$inbound_session->setVariable( 'outbound_uuid', $outbound_session->get_uuid() );
if ( $outbound_session->ready() ) {
if ( $inbound_session->ready() ) {
$inbound_session->setVariable('outbound_answered', 'true');
$outbound_session->streamFile("/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-please_hold_while_party_contacted.wav");
$inbound_session->execute('break');
while ($inbound_session->ready()) {
sleep(10);
# Inbound sessnio ok, continue outbound session.
}
} else {
# Inbound session got disconnected while we trying outbound.
}
} else {
# Outbound call failed.
}
1;
Debian syslog:
Jul 19 13:14:50 XXX systemd[1]: freeswitch.service: Main process exited, code=killed, status=6/ABRT
Jul 19 13:14:50 XXX systemd[1]: freeswitch.service: Unit entered failed state.
Jul 19 13:14:50 XXX systemd[1]: freeswitch.service: Failed with result 'signal'.
Jul 19 13:14:50 XXX systemd[1]: freeswitch.service: Service hold-off time over, scheduling restart.
Jul 19 13:14:50 XXX systemd[1]: Stopped freeswitch.
Jul 19 13:14:50 XXX systemd[1]: Starting freeswitch...
The expected scenario work without issues. But my issue is Freeswitch getting restart when inbound session hangup by incoming call party while Freeswitch ringing outbound party.
UPDATE1:
I think I need to handle inbound session hangup event but kinda lost here. May be I'm doing all wrong.
UPDATE2:
I been seen this issue in Freeswitch 1.8.7. I tried testing the same code in Freeswitch 1.6.20 and it didn't crash, but gave below error,
[ERR] freeswitch_perl.cpp:114 session is not initalized
So it seems Freeswitch 1.8 mod_perl module not handling it properly.
Looking for suggestions from Freeswitch experts.
Thank you!
I setup a mail server on VPS and I installed roundcube to manage webmail. when i send e-mail in intern it work's but when i try to send an e-mail to another mail server (gmail) i get this error :
SMTP Error (454): Failed to add recipient "user#gmail.com" (4.7.1 : Relay access denied).
but when i send the same e-mail with thunderbird it works so here what i found at logs:
with roundcube:
Dec 4 18:44:09 vpsxxxxxx postfix/smtpd[3013]: connect from xxx.xxx.xxx.xxx
Dec 4 18:44:09 vpsxxxxxx postfix/smtpd[3013]: warning: connect to Milter service inet:127.0.0.1:8891: Connection refused
Dec 4 18:44:09 vpsxxxxxx postfix/smtpd[3013]: NOQUEUE: reject: RCPT from xxx.xxx.xxx.xxx: 454 4.7.1 <user#gmail.com>: Relay access denied; from=<user#domain.com> to=<user#gmail.com> proto=ESMTP helo=<mail.domain.com>
Dec 4 18:44:09 vpsxxxxxx postfix/smtpd[3013]: disconnect from xxx.xxx.xxx.xxx ehlo=1 mail=1 rcpt=0/1 rset=1 quit=1 commands=4/5
with thunderbird :
Dec 4 18:44:55 vpsxxxxxx postfix/smtpd[3016]: connect from unknown[xxx.xxx.xxx.xxx]
Dec 4 18:44:55 vpsxxxxxx postfix/smtpd[3016]: warning: connect to Milter service inet:127.0.0.1:8891: Connection refused
Dec 4 18:44:58 vpsxxxxxx postfix/smtpd[3016]: 64DCD5EEC4: client=unknown[xxx.xxx.xxx.xxx], sasl_method=PLAIN, sasl_username=user#domain.com
Dec 4 18:44:58 vpsxxxxxx postfix/cleanup[3019]: 64DCD5EEC4: message-id=<9bf8a7ca-9d6a-847c-5350-0f5c4350951f#domain.com>
Dec 4 18:44:58 vpsxxxxxx postfix/qmgr[2865]: 64DCD5EEC4: from=<user#domain.com>, size=1810, nrcpt=1 (queue active)
Dec 4 18:44:58 vpsxxxxxx postfix/smtpd[3016]: disconnect from unknown[xxx.xxx.xxx.xxx] ehlo=2 starttls=1 auth=1 mail=1 rcpt=1 data=1 quit=1 commands=8
Dec 4 18:44:59 vpsxxxxxx postfix/smtp[3020]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c07::1b]:25: Cannot assign requested address
Dec 4 18:45:00 vpsxxxxxx postfix/smtp[3020]: 64DCD5EEC4: to=<user#gmail.com>, relay=gmail-smtp-in.l.google.com[66.102.1.27]:25, delay=1.7, delays=0.25/0.01/0.52/0.91, dsn=2.0.0, status=sent (250 2.0.0 OK 1543945500 f16si12703624wrt.428 - gsmtp)
Dec 4 18:45:00 vpsxxxxxx postfix/qmgr[2865]: 64DCD5EEC4: removed
Dec 4 18:45:01 vpsxxxxxx dovecot: imap-login: Login: user=<user#domain.com>, method=PLAIN, rip=xxx.xxx.xxx.xxx, lip=yyy.yyy.yyy.yyy, mpid=3025, TLS, session=<HDgM0zV8EcXE5dog>
Dec 4 18:45:01 vpsxxxxxx dovecot: imap-login: Login: user=<user#domain.com>, method=PLAIN, rip=xxx.xxx.xxx.xxx, lip=yyy.yyy.yyy.yyy, mpid=3026, TLS, session=<dIQM0zV8EsXE5dog>
Dec 4 18:45:01 vpsxxxxxx dovecot: imap(user#domain.com): Logged out in=1669 out=552
config.inc.php
<?php
$config['db_dsnw'] = 'mysql://databaseuser:password#localhost/database';
$config['default_host'] = 'localhost';
$config['smtp_server'] = 'mail.domain.com';
$config['support_url'] = '';
$config['ip_check'] = true;
$config['des_key'] = 'DES_KEY';
$config['username_domain'] = 'domain.com';
$config['product_name'] = 'domain Webmail';
$config['plugins'] = array(
'acl', 'additional_message_headers', 'archive', 'attachment_reminder', 'autologon',
'debug_logger', 'emoticons', 'enigma', 'example_addressbook', 'help', 'hide_blockquote',
'http_authentication', 'identicon', 'identity_select', 'jqueryui', 'krb_authentication',
'managesieve', 'markasjunk', 'new_user_dialog', 'new_user_identity', 'newmail_notifier',
'password', 'redundant_attachments', 'show_additional_headers', 'squirrelmail_usercopy',
'subscriptions_option', 'userinfo', 'vcard_attachments', 'virtuser_file', 'virtuser_query', 'zipdownload'
);
$config['language'] = 'en_EN';
$config['enable_spellcheck'] = false;
?>
domain.com is my Domain name
It was a configuration problem. I add this to config.inc.php, and it works
$config['smtp_server'] = 'tls://mail.domain.com';
$config['smtp_port'] = 587;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
);
I'm trying to make a local docker-dovecot machine to archive my e-mails. I would like to query them with Apple Mail. I have a simple ubuntu docker machine (on an VM with parallels, because I'm on a Mac).
I have this local.conf:
# A comma separated list of IPs or hosts where to listen in for connections.
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
listen = *,::
# Protocols we want to be serving.
protocols = imap
# Static passdb.
# This can be used for situations where Dovecot doesn't need to verify the
# username or the password, or if there is a single password for all users:
passdb {
driver = static
args = password=dovecot
}
# Location for users' mailboxes. The default is empty, which means that Dovecot
# tries to find the mailboxes automatically. This won't work if the user
# doesn't yet have any mail, so you should explicitly tell Dovecot the full
# location.
#
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
# isn't enough. You'll also need to tell Dovecot where the other mailboxes are
# kept. This is called the "root mail directory", and it must be the first
# path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
# %u - username
# %n - user part in user#domain, same as %u if there's no domain
# %d - domain part in user#domain, empty if there's no domain
# %h - home directory
#
# See doc/wiki/Variables.txt for full list. Some examples:
#
# mail_location = maildir:~/Maildir
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
mail_location = maildir:/var/mail/%n
# System user and group used to access mails. If you use multiple, userdb
# can override these by returning uid or gid fields. You can use either numbers
# or names. <doc/wiki/UserIds.txt>
# mail_uid = CHANGE_THIS_to_your_short_user_name_or_uid
# mail_gid = admin
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
ssl = no
# Login user is internally used by login processes. This is the most untrusted
# user in Dovecot system. It shouldn't have access to anything at all.
# default_login_user = _dovenull
# Internal user is used by unprivileged processes. It should be separate from
# login user, so that login processes can't disturb other processes.
# default_internal_user = _dovecot
# Setting limits.
default_process_limit = 10
default_client_limit = 50
and I'm getting this from Apple Mail
May 23 07:15:58 Mail[87524] <Debug>: <0x7fe16f021cd0:[Non-authenticated]> Wrote: 1.11 ID ("name" "Mac OS X Mail" "version" "9.3 (3124)" "os" "Mac OS X" "os-version" "10.11.5 (15F34)" "vendor" "Apple Inc.")
May 23 07:15:58 Mail[87524] <Debug>: <0x7fe16f021cd0:[Non-authenticated]> Read: * ID {
name = Dovecot;
}
May 23 07:15:58 Mail[87524] <Debug>: <0x7fe16f021cd0:[Non-authenticated]> Read: 1.11 OK
May 23 07:15:58 Mail[87524] <Debug>: <0x7fe16f021cd0:[Non-authenticated]> Wrote: 3.11 LOGOUT
May 23 07:16:00 Mail[87524] <Debug>: <0x7fe16aa14590:[Disconnected]> Read: * OK [CAPABILITY (
IMAP4REV1,
"LITERAL+",
"SASL-IR",
"LOGIN-REFERRALS",
ID,
ENABLE,
IDLE,
"AUTH=PLAIN",
"AUTH=LOGIN"
)]
May 23 07:16:00 Mail[87524] <Debug>: <0x7fe16aa14590:[Non-authenticated]> Wrote: 1.23 ID ("name" "Mac OS X Mail" "version" "9.3 (3124)" "os" "Mac OS X" "os-version" "10.11.5 (15F34)" "vendor" "Apple Inc.")
May 23 07:16:00 Mail[87524] <Debug>: <0x7fe16aa14590:[Non-authenticated]> Read: * ID {
name = Dovecot;
}
May 23 07:16:00 Mail[87524] <Debug>: <0x7fe16aa14590:[Non-authenticated]> Read: 1.23 OK
May 23 07:16:00 Mail[87524] <Debug>: <0x7fe16aa14590:[Non-authenticated]> Wrote: 3.23 LOGOUT
and this from dovecot (mail.log):
May 23 05:07:22 f8ab3e20742f dovecot: master: Dovecot v2.2.9 starting up (core dumps disabled)
May 23 05:07:22 f8ab3e20742f dovecot: ssl-params: Generating SSL parameters
May 23 05:07:29 f8ab3e20742f dovecot: ssl-params: SSL parameters regeneration completed
May 23 05:07:52 f8ab3e20742f dovecot: imap-login: Aborted login (no auth attempts in 0 secs): user=<>, rip=10.211.55.2, lip=172.17.0.2, session=<IJwtbHszbgAK0zcC>
May 23 05:07:54 f8ab3e20742f dovecot: imap-login: Aborted login (no auth attempts in 0 secs): user=<>, rip=10.211.55.2, lip=172.17.0.2, session=<qsRNbHszdgAK0zcC>
The output of doveconf -n is (so "disable_plaintext_auth = no" is active):
# 2.2.9: /etc/dovecot/dovecot.conf
# OS: Linux 4.4.8-boot2docker x86_64 Ubuntu 14.04.4 LTS aufs
auth_mechanisms = plain login
default_client_limit = 50
default_process_limit = 10
disable_plaintext_auth = no
listen = *,::
mail_location = maildir:/var/mail/%n
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = password=dovecot
driver = static
}
protocols = imap
ssl = no
Any suggestions why this login isn't working?
Thanks!
The solution is to fix and configure the following line correctly (from local.conf):
# mail_uid = CHANGE_THIS_to_your_short_user_name_or_uid
How did I find out? Thanks to #Kondybas for the pointer to try another client. I used Thunderbird and it produced dovecot log entries (why didn't Apple Mail produce these lines? No clue), saying that it couldn't switch to mail_uid user context. I extended dovecot Dockerfile and switched the user appropriately. Afterwards it worked with Thunderbird and then with Apple Mail.
Trying to configure Exim mail server using this article. I can use this server inside my local network but when I try to use it from internet I taking some errors. Ports 10000-20000 translate to server machine. Everything I doing inside the docker image of CentOS 7. Host machine with CentOS 7 too.
Abbreviations:
test_domain.tk - my test domain
test1, test2 - test users
test#external.com - test external email
123.456.789.876 - my external ip (I have router with NAT)
10.0.7.30 - docker's tunnel
Starting docker with command: docker run -d --name mail -h test_domain.tk -p 10025:25 -p 10587:587 -p 10465:465 -p 10143:143 -p 10993:993 mail/server:localwork start_server
start_server:
#!/bin/bash -e
/usr/sbin/dovecot && /usr/sbin/exim -v -bdf -q30m
/etc/exim/exim.conf:
primary_hostname = test_domain.tk
domainlist local_domains = # : localhost : test_domain.tk
domainlist relay_to_domains =
hostlist relay_from_hosts =
acl_smtp_mail = acl_check_mail
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
acl_smtp_mime = acl_check_mime
av_scanner = clamd:/var/run/clamd.exim/clamd.sock
tls_advertise_hosts = *
tls_certificate = /etc/ssl/default.crt
tls_privatekey = /etc/ssl/default.key
daemon_smtp_ports = 25 : 465 : 587
tls_on_connect_ports = 465
allow_domain_literals
never_users = root
auth_advertise_hosts = *
rfc1413_hosts = *
rfc1413_query_timeout = 5s
ignore_bounce_errors_after = 2d
timeout_frozen_after = 7d
begin acl
acl_check_mail:
deny condition = ${if eq{$sender_helo_name}{} {1}}
message = Nice boys say HELO first
warn condition = ${if eq{$sender_host_name}{} {1}}
set acl_m_greylistreasons = Host $sender_host_address lacks reverse DNS\n$acl_m_greylistreasons
accept
acl_check_rcpt:
accept hosts = :
control = dkim_disable_verify
deny message = Restricted characters in address
domains = +local_domains
local_parts = ^[.] : ^.*[#%!/|]
deny message = Restricted characters in address
domains = !+local_domains
local_parts = ^[./|] : ^.*[#%!] : ^.*/\\.\\./
accept local_parts = postmaster
domains = +local_domains
require verify = sender
accept hosts = +relay_from_hosts
control = submission
control = dkim_disable_verify
accept authenticated = *
control = submission
control = dkim_disable_verify
require message = relay not permitted
domains = +local_domains : +relay_to_domains
require verify = recipient
accept
acl_check_data:
warn condition = ${if !def:h_Message-ID: {1}}
set acl_m_greylistreasons = Message lacks Message-Id: header. Consult RFC2822.\n$acl_m_greylistreasons
accept
acl_check_mime:
deny message = Blacklisted file extension detected
condition = ${if match \
{${lc:$mime_filename}} \
{\N(\.exe|\.pif|\.bat|\.scr|\.lnk|\.com)$\N} \
{1}{0}}
accept
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# if ipv6-enabled then instead use:
# ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1
no_more
system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
file_transport = address_file
pipe_transport = address_pipe
userforward:
driver = redirect
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
file = $home/.forward
allow_filter
no_verify
no_expn
check_ancestor
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
procmail:
driver = accept
check_local_user
require_files = ${local_part}:+${home}/.procmailrc:/usr/bin/procmail
transport = procmail
no_verify
localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = local_delivery
cannot_route_message = Unknown user
begin transports
remote_smtp:
driver = smtp
remote_msa:
driver = smtp
port = 587
hosts_require_auth = *
procmail:
driver = pipe
command = "/usr/bin/procmail -d $local_part"
return_path_add
delivery_date_add
envelope_to_add
user = $local_part
initgroups
return_output
local_delivery:
driver = appendfile
directory = $home/Maildir
maildir_format
maildir_use_size_file
delivery_date_add
envelope_to_add
return_path_add
address_pipe:
driver = pipe
return_output
address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
address_reply:
driver = autoreply
begin retry
* * F,2h,15m; G,16h,1h,1.5; F,4d,6h
begin rewrite
begin authenticators
dovecot_login:
driver = dovecot
public_name = LOGIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1
dovecot_plain:
driver = dovecot
public_name = PLAIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1
exim log:
8 LOG: MAIN
8 exim 4.84 daemon started: pid=8, -q30m, listening for SMTP on port 25 (IPv6 and IPv4) port 587 (IPv6 and IPv4) and for SMTPS on port 465 (IPv6 and IPv4)
16 LOG: host_lookup_failed MAIN
16 no host name found for IP address 123.456.789.876
16 LOG: MAIN REJECT
16 H=([10.0.7.30]) [123.456.789.876] X=SSLv3:DHE-RSA-AES128-SHA:128 F=<test1#test_domain.tk> rejected RCPT <test#external.com>: relay not permitted
16 LOG: lost_incoming_connection MAIN
16 unexpected disconnection while reading SMTP command from ([10.0.7.30]) [123.456.789.876]
When I try to connect from internet I got timeout error in mail client and empty logs in Exim. It's probably problem of work with router. How to make it works?
Ask me if you need more data. Thanks in advance.
You have your docker internal ports (for example 10025) mapped to standard smtp ports (for example 25), but you have exim listening on the standard ports instead of the mapped internal ports. Configure exim to listen on 10025, 10465, 10587 and see if the behavior changes.
It seems there's an issue with reverse DNS lookup according to this ancient post. Try disabling host_lookup and see if that works:
host_lookup = 0.0.0.0/0
If it does you'll have to fix your DNS settings to map the right domain to your host.