catatnight / docker-postfix Goto Github PK
View Code? Open in Web Editor NEWrun postfix with smtp authentication (sasldb) in a docker container
License: MIT License
run postfix with smtp authentication (sasldb) in a docker container
License: MIT License
Hi. Please add TLS for outgoing connection so gmail will stop indicate emails as "not encrypted"
smtp_use_tls=yes -> /etc/postfix/main.cf
Hello, could you please provide some help?
I've got a project on SF4. KVM virtual server and docker. I use this docker image. When i connect to container and run postfix check - everything is ok, but from the project it does not want to send email with error
app.ERROR: Exception occurred while flushing email queue: Connection could not be established with host smtp.******.ru
When i am sending mail it shows that mail was sent i.e. queued as follows:-
[<-] 220 mail.monstorm.com ESMTP Postfix (Ubuntu)
[->] HELO monstorm.com
[<-] 250 mail.monstorm.com
[->] MAIL FROM:[email protected]
[<-] 250 2.1.0 Ok
[->] RCPT TO:[email protected]
[<-] 250 2.1.5 Ok
[->] DATA
[<-] 354 End data with .
[->] Received: by monstorm.com (sSMTP sendmail emulation); Tue, 16 Jun 2015 14:09:44 +0000
[->] Date: Tue, 16 Jun 2015 14:09:44 +0000
[->] From:[email protected]
[->] To:[email protected]
[->] Subject:Test Dev V
[->]
[->] Hi All,
[->] Release will start on DEV and NCDEV server in next 15 min.
[->] Please Commit your files in next 10 min.
[->] .
[<-] 250 2.0.0 Ok: queued as F21133DA3
[->] QUIT
[<-] 221 2.0.0 Bye
But i am not able to receive mail in inbox nor in my spam. Please give me any suggestions it's really urgent.
You don't want to trash your mail queue when you rebuild your container.
Maybe this can be treated by documentation alone.
The ports are not exposed properly when starting the container through docker-compose.
When I send mail using ssmtp server and postfix in docker as a mailhub then I got an error like relay access denied.
My /etc/postfix/main.cf file is as follows:-
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
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
myhostname = mail.monstorm.com
mydomain = monstorm.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 10.13.15.0/24 10.13.10.0/24 [::]/128 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = subnet
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination
Hi
How can i set multiple domain?
Thanks
I want to have multiple smtp user, how to achive this?
Hi,
I am getting the below error when i try to build the container
suv@Suvankars-MacBook-Pro[6:12:13]:~/thermeon/docker-postfix$ docker run -it -e MailDomain=gmail.com -e [email protected]:abcd --name=suv_pfx postfix
2020-05-25 12:42:16,500 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-05-25 12:42:16,500 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2020-05-25 12:42:16,506 INFO RPC interface 'supervisor' initialized
2020-05-25 12:42:16,506 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-05-25 12:42:16,506 INFO supervisord started with pid 18
2020-05-25 12:42:17,511 INFO spawned: 'postfix' with pid 20
2020-05-25 12:42:17,512 INFO spawnerr: can't find command '/usr/sbin/rsyslogd'
2020-05-25 12:42:17,785 INFO exited: postfix (exit status 1; not expected)
2020-05-25 12:42:18,790 INFO spawned: 'postfix' with pid 137
2020-05-25 12:42:18,792 INFO spawnerr: can't find command '/usr/sbin/rsyslogd'
2020-05-25 12:42:18,832 INFO exited: postfix (exit status 1; not expected)
2020-05-25 12:42:20,848 INFO spawned: 'postfix' with pid 152
2020-05-25 12:42:20,850 INFO spawnerr: can't find command '/usr/sbin/rsyslogd'
2020-05-25 12:42:20,893 INFO exited: postfix (exit status 1; not expected)
2020-05-25 12:42:23,909 INFO spawned: 'postfix' with pid 167
2020-05-25 12:42:23,911 INFO spawnerr: can't find command '/usr/sbin/rsyslogd'
2020-05-25 12:42:23,912 INFO gave up: rsyslog entered FATAL state, too many start retries too quickly
2020-05-25 12:42:23,951 INFO exited: postfix (exit status 1; not expected)
2020-05-25 12:42:24,954 INFO gave up: postfix entered FATAL state, too many start retries too quickly
Then i had to add RUN apt-get -y install rsyslog
in Docker file and got introduced to a new error
suv@Suvankars-MacBook-Pro[2:57:21]:~/thermeon/docker-postfix$ docker run -it -e MailDomain=gmail.com -e [email protected]:abcd --name=spfx pfx
2020-05-29 09:27:25,602 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-05-29 09:27:25,603 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2020-05-29 09:27:25,606 INFO RPC interface 'supervisor' initialized
2020-05-29 09:27:25,606 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-05-29 09:27:25,607 INFO supervisord started with pid 18
2020-05-29 09:27:26,612 INFO spawned: 'postfix' with pid 20
2020-05-29 09:27:26,617 INFO spawned: 'rsyslog' with pid 21
2020-05-29 09:27:26,627 INFO exited: rsyslog (exit status 1; not expected)
2020-05-29 09:27:26,874 INFO exited: postfix (exit status 1; not expected)
2020-05-29 09:27:27,882 INFO spawned: 'postfix' with pid 138
2020-05-29 09:27:27,886 INFO spawned: 'rsyslog' with pid 139
2020-05-29 09:27:27,896 INFO exited: rsyslog (exit status 1; not expected)
2020-05-29 09:27:27,926 INFO exited: postfix (exit status 1; not expected)
2020-05-29 09:27:29,938 INFO spawned: 'postfix' with pid 154
2020-05-29 09:27:29,947 INFO spawned: 'rsyslog' with pid 155
2020-05-29 09:27:29,955 INFO exited: rsyslog (exit status 1; not expected)
2020-05-29 09:27:29,981 INFO exited: postfix (exit status 1; not expected)
2020-05-29 09:27:33,001 INFO spawned: 'postfix' with pid 170
2020-05-29 09:27:33,006 INFO spawned: 'rsyslog' with pid 171
2020-05-29 09:27:33,016 INFO exited: rsyslog (exit status 1; not expected)
2020-05-29 09:27:33,016 INFO gave up: rsyslog entered FATAL state, too many start retries too quickly
2020-05-29 09:27:33,044 INFO exited: postfix (exit status 1; not expected)
2020-05-29 09:27:34,048 INFO gave up: postfix entered FATAL state, too many start retries too quickly
Kindly help.
Thanks,
Suvankar
See below, have not looked in-depth at the fault yet:
root@d98a694771b8:/etc/postfix# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /bin/sh -c /opt/install.sh;/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
28 ? S 0:46 /usr/bin/python /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
32 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
33 ? Sl 0:00 /usr/sbin/rsyslogd -n -c3
43 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
44 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
45 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
46 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
361 ? Ss 0:00 bash
913 ? S 0:00 /bin/bash /opt/postfix.sh
970 ? Ss 0:00 /usr/lib/postfix/master
971 ? S 0:00 tail -f /var/log/mail.log
972 ? S 0:00 pickup -l -t unix -u
973 ? S 0:00 qmgr -l -t unix -u
974 ? R+ 0:00 ps ax
root@d98a694771b8:/etc/postfix# supervisorctl stop postfix
postfix: stopped
root@d98a694771b8:/etc/postfix# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /bin/sh -c /opt/install.sh;/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
28 ? S 0:46 /usr/bin/python /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
32 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
33 ? Sl 0:00 /usr/sbin/rsyslogd -n -c3
43 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
44 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
45 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
46 ? S 0:00 /usr/sbin/saslauthd -a ldap -d -c -r -m /var/run/saslauthd
361 ? Ss 0:00 bash
970 ? Ss 0:00 /usr/lib/postfix/master
971 ? S 0:00 tail -f /var/log/mail.log
972 ? S 0:00 pickup -l -t unix -u
973 ? S 0:00 qmgr -l -t unix -u
976 ? R+ 0:00 ps ax
root@d98a694771b8:/etc/postfix# supervisorctl status
postfix STOPPED Jul 25 01:23 PM
rsyslog RUNNING pid 33, uptime 3 days, 2:00:23
saslauthd RUNNING pid 32, uptime 3 days, 2:00:23
I was wondering if anyone has noticed timeout errors in /var/log/mail.log
when sending mail:
Mar 23 11:21:31 886377d1c5cf postfix/smtp[143]: connect to pb-mx13.pobox.com[64.147.108.54]:25: Connection timed out
Mar 23 11:22:01 886377d1c5cf postfix/smtp[143]: connect to pb-mx9.pobox.com[64.147.108.50]:25: Connection timed out
Mar 23 11:22:31 886377d1c5cf postfix/smtp[143]: connect to pb-mx14.pobox.com[64.147.108.55]:25: Connection timed out
Mar 23 11:23:01 886377d1c5cf postfix/smtp[143]: connect to pb-mx12.pobox.com[64.147.108.53]:25: Connection timed out
Mar 23 11:23:31 886377d1c5cf postfix/smtp[143]: connect to pb-mx10.pobox.com[64.147.108.51]:25: Connection timed out
Mar 23 11:23:31 886377d1c5cf postfix/smtp[143]: BB48359B: to=<[email protected]>, relay=none, delay=151, delays=0.03/0.01/150/0, dsn=4.4.1, status=deferred (connect to pb-mx10.pobox.com[64.147.108.51]:25: Connection timed out)
I see the same thing when sending to gmail addresses.
I'm running with docker-compose:
mail:
restart: always
image: catatnight/postfix
environment:
- "maildomain=localhost"
- "smtp_user=test:testpass"
On docker hub this image hasn't been updated in years. At minimum I'd recommend a 30 day curl call to rebuild to handle security updates.
hello, i started the container with command docker run -it --rm -p 25:25 -e maildomain=xjplus.xyz -e smtp_user=test123:test123 --name tmpp catatnight/postfix
,
then test it with telnet
as below and i got authentication failure, what's wrong with that?
isn't sasl used at auth login
? look for help, 3q..
[C:\~]$ telnet xjplus.xyz 25
Host 'xjplus.xyz' resolved to 106.12.80.76.
Connecting to 106.12.80.76:25...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
220 xjplus.xyz ESMTP Postfix (Ubuntu)
helo xjplus.xyz
250 xjplus.xyz
auth login
334 VXNlcm5hbWU6
test123
535 5.7.8 Error: authentication failed: another step is needed in authentication
auth login
334 VXNlcm5hbWU6
test
334 UGFzc3dvcmQ6
test
535 5.7.8 Error: authentication failed: authentication failure
quit221 2.0.0 Bye
Connection closing...Socket close.
Connection closed by foreign host.
If i send any mail through port 25, postfix required a TLS certificate, is possible disable the TLS authentication?
Just wanted to give you a heads up that emailing something that is hosted at office365 will fail with:
454 4.7.0 Failed to establish appropriate TLS channel: Access Denied (in reply to RCPT TO command))
I was able to fix this by adding the following to main.cf:
smtp_tls_security_level = may
I'm trying to find a smtp server to send verification emails for my homework at college. I don't know if I come to the right place. I've built the image and have it run. I wonder if I need extra steps to have it send mails, for example DNS (actually I've tried this, still not work)?
I am using flask-mail to test. The message returned shows that authentication has been passed and that the mail has been queued, but, I still cannot receive the email. Here's the message, although by flask-mail, hopefully it can help:
send: 'ehlo [172.17.0.11]\r\n'
reply: '250-leggyleggy.com\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 10240000\r\n'
reply: '250-VRFY\r\n'
reply: '250-ETRN\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM\r\n'
reply: '250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250-8BITMIME\r\n'
reply: '250 DSN\r\n'
reply: retcode (250); Msg: leggyleggy.com
PIPELINING
SIZE 10240000
VRFY
ETRN
STARTTLS
AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
ENHANCEDSTATUSCODES
8BITMIME
DSN
send: 'AUTH CRAM-MD5\r\n'
reply: '334 PDMxMTc5Njk5MjYuNzUyODYzM0BsZWdneWxlZ2d5LmNvbT4=\r\n'
reply: retcode (334); Msg: PDMxMTc5Njk5MjYuNzUyODYzM0BsZWdneWxlZ2d5LmNvbT4=
send: 'bm8tcmVwbHkgM2Q4MGQ3OGMwMWZhOWJjZDYxM2M2YjBhYjRjZjUzOTI=\r\n'
reply: '235 2.7.0 Authentication successful\r\n'
reply: retcode (235); Msg: 2.7.0 Authentication successful
send: u'mail FROM:[email protected] size=251\r\n'
reply: '250 2.1.0 Ok\r\n'
reply: retcode (250); Msg: 2.1.0 Ok
send: u'rcpt TO:[email protected]\r\n'
reply: '250 2.1.5 Ok\r\n'
reply: retcode (250); Msg: 2.1.5 Ok
send: 'data\r\n'
reply: '354 End data with .\r\n'
reply: retcode (354); Msg: End data with .
data: (354, 'End data with .')
send: 'Content-Type: text/plain; charset="utf-8"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 7bit\r\nSubject: hello\r\nFrom: [email protected]\r\nTo: [email protected]\r\nDate: Mon, 24 Nov 2014 07:38:13 +0000\r\nMessage-ID: 20141124073807.18.73370@e5924df9bbf8\r\n\r\n.\r\n'
reply: '250 2.0.0 Ok: queued as 0B292585\r\n'
reply: retcode (250); Msg: 2.0.0 Ok: queued as 0B292585
data: (250, '2.0.0 Ok: queued as 0B292585')
send: 'quit\r\n'
reply: '221 2.0.0 Bye\r\n'
reply: retcode (221); Msg: 2.0.0 Bye
Thank you very much if you can help.
The default timezone is UTC and my tz is America/Sao_Paulo, how about to select timezone when creating the docker?
Referring to your first example:
sudo docker run -p 25:25 \
-e maildomain=mail.example.com -e smtp_user=user:pwd \
--name postfix -d catatnight/postfix
If I run that it fails with this in docker logs:
docker logs deployment_postfix_1
find: `/etc/postfix/certs': No such file or directory
find: `/etc/opendkim/domainkeys': No such file or directory
Error: The directory named as part of the path /var/log/supervisor/supervisord.log does not exist.
For help, use /usr/bin/supervisord -h
Note I actually run it using this fig configuration:
postfix:
image: catatnight/postfix
hostname: postfix
environment:
# You could change this to something more suitable
- maildomain=kartoza.com
- smtp_user=noreply:docker
volumes:
- ./logs:/var/log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.