Concept configuration of Postfix with Smarthosts
-
In systemd i recieve:
Mai 22 20:45:42 svgwma-kopa-02 kopano-server[2089]: Starting kopano-server version 8.6.80 (pid 2089) Mai 22 20:51:01 svgwma-kopa-02 su[2135]: Successful su for fetchmail by root Mai 22 20:51:01 svgwma-kopa-02 su[2135]: + /dev/pts/0 root:fetchmail Mai 22 20:51:01 svgwma-kopa-02 su[2135]: pam_unix(su:session): session opened for user fetchmail by kopano(uid=0) Mai 22 20:51:01 svgwma-kopa-02 su[2135]: pam_systemd(su:session): Cannot create session: Already running in a session Mai 22 20:51:06 svgwma-kopa-02 su[2135]: pam_unix(su:session): session closed for user fetchmail
I got now the following error when I use your line concerning fetchmail:
fetchmail: SMTP error: 550 5.1.1 <hispeed@localhost>: Recipient address rejected: User unknown in local recipient table fetchmail: mail from MAILER-DAEMON@svgwma-kopa-02 bounced to XXXX@email.XXXXX.com reading message webXXXX@webXXXX.login-XXXX.hoststar.ch:1 of 3 (1279 header octets) (180320 body octets) flushed fetchmail: SMTP error: 550 5.1.1 <hispeed@localhost>: Recipient address rejected: User unknown in local recipient table fetchmail: mail from MAILER-DAEMON@svgwma-kopa-02 bounced to XXXXX@email.XXXXXX.com reading message webXXXX@webXXX.login-XXX.hoststar.ch:2 of 3 (1281 header octets) (180320 body octets) flushed fetchmail: SMTP error: 550 5.1.1 <hispeed@localhost>: Recipient address rejected: User unknown in local recipient table fetchmail: mail from MAILER-DAEMON@svgwma-kopa-02 bounced to XXXX@email.XXXXcom reading message webXXX@webXXXX.ogin-XXX.hoststar.ch:3 of 3 (1268 header octets) (180258 body octets) flushed
The mails were just test mail so i don’t care. You wrote: “Local-Email here” What you mean? I have created a user which is called hispeed in Kopano. Do you mean this user or this users e-mail <- What would be e-mail of a local Kopano user?
-
@hispeed said in Concept configuration of Postfix with Smarthosts:
You wrote: “Local-Email here” What you mean? I have created a user which is called hispeed in Kopano. Do you mean this user or this users e-mail <- What would be e-mail of a local Kopano user?
Yes the mail you’ve given in your fetchmail configuration is not recognized by your postfix and therefore bounces.
I really to mean an email address, else postfix won’t be able to deliver.
The email of a Kopano user is whatever you specified as an email when you created the user. -
Now it says it’s flushed thru fetchmail but because postfix is not yet configured I don’t get into Kopano.
This is my postfix config file running the system on Synology and Zarafa4H. Can I use that? I have marked with ** two lines. There are the files which Zarafa uses for connecting the different accounts. I probably have to change that to Kopano somehow?
reject_unknown_helo_hostname smtpd_client_restrictions = permit_mynetworks smtpd_recipient_restrictions = permit_mynetworks reject_invalid_hostname reject_unauth_destination reject_unknown_recipient_domain delay_warning_time = 4h unknown_local_recipient_reject_code = 450 maximal_queue_lifetime = 7d minimal_backoff_time = 1000s maximal_backoff_time = 8000s smtpd_recipient_limit = 16 smtpd_soft_error_limit = 3 smtpd_hard_error_limit = 12 # relayhosting from provider when running dynamic IP; now we need sasl_auth #relayhost = smtp.example.com smtp_sasl_auth_enable = yes **smtp_sasl_password_maps = hash:/etc/zarafa/postfix/sasl_passwd** **sender_dependent_relayhost_maps = hash:/etc/zarafa/postfix/sender_relay** smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes smtp_use_tls = yes smtp_tls_enforce_peername = no smtpd_tls_security_level = may
-
The above Postfix configuration does not look complete. I’d rather recommend to use the distribution default and then add one of the examples from the documentation. these can be found at https://kb.kopano.io/display/WIKI/Postfix and https://documentation.kopano.io/kopanocore_administrator_manual/configure_kc_components.html#kc-postfix-integration
-
It could be that this is not the whole configuration. I really don’t get it. One of the reason I want to go away from Synology because I really don’t know how that works at the moment and I hope I understand it more if I do it on a own system.
At the moment my config I have on pastebin: https://pastebin.com/rzmybzd2
Since I have changed the postfix config I recieve that error:
Something is now wrong: fetchmail: SMTP error: 451 4.3.0 XXXX@XXXXX.ch: Temporary lookup failure -> reading message webXXXX@webXXXXX.login-12.hoststar.ch:1 of 1 (5926 header octets) not flushed | -
@hispeed said in Concept configuration of Postfix with Smarthosts:
Since I have changed the postfix config I recieve that error:
so you combined your postfix configuration with the above from synology and now get these errors? Debugging postfix problems is always easier with the full error message from the mail.log and the main.cf (or the output of
postfonf -n
) -
Yes that’s right I combined that but I’m not sure if this is the actual config from the Synology which is running. I have the Docker setup from Zarafa4H. Do you know where the config is which is actually running for the Docker setup?
Mail.log:
May 25 15:52:19 svgwma-kopa-02 postfix/postfix-script[18371]: starting the Postfix mail system May 25 15:52:19 svgwma-kopa-02 postfix/master[18373]: daemon started -- version 3.3.0, configuration /etc/postfix May 25 15:52:24 svgwma-kopa-02 postfix/smtpd[18415]: connect from localhost6.localdomain6[::1] May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: error: open database /etc/kopano/postfix/sender_relay.db: No such file or directory May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay is unavailable. open database /etc/kopano/postfix/s$ May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay lookup error for ""<>"" May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: sender_dependent_relayhost_maps lookup failure May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay is unavailable. open database /etc/kopano/postfix/s$ May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay lookup error for "XXXXX@hotmail.com" May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: sender_dependent_relayhost_maps lookup failure May 25 15:52:24 svgwma-kopa-02 postfix/smtpd[18415]: NOQUEUE: reject: RCPT from localhost6.localdomain6[::1]: 451 4.3.0 <XXXX@XXXXXX.ch>: Temporary look$ May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay is unavailable. open database /etc/kopano/postfix/s$ May 25 15:52:24 svgwma-kopa-02 postfix/trivial-rewrite[18418]: warning: hash:/etc/kopano/postfix/sender_relay lookup error for ""<>""
-
Ok I found the Synology Zarafa4h Docker main.config. Now when I send an e-mail to the adress I can fetch it via Fetchmail and it’s getting flushed. But I don’t recieve it in Kopano ^^. Config should be fine I have corrected it and I don’t recieve any errors right now.
This is the mail.log I see now after recieving with fetchmail:May 26 12:46:47 svgwma-kopa-02 postfix/smtpd[23055]: connect from localhost6.localdomain6[::1] May 26 12:46:47 svgwma-kopa-02 postfix/smtpd[23055]: 5E115320DFE: client=localhost6.localdomain6[::1] May 26 12:46:47 svgwma-kopa-02 postfix/cleanup[23058]: 5E115320DFE: message-id=<AM4PR08MB118748749C61D00DED07E089FB680@AM4PR08MB1187.eurprd08.prod.outlook.com> May 26 12:46:47 svgwma-kopa-02 postfix/qmgr[23017]: 5E115320DFE: from=<MyEMailaddress@hotmail.com>, size=7069, nrcpt=1 (queue active) May 26 12:46:47 svgwma-kopa-02 postfix/smtpd[23055]: disconnect from localhost6.localdomain6[::1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 May 26 12:46:50 svgwma-kopa-02 postfix/smtp[23059]: 5E115320DFE: to=<Emailkopanouser@domain.ch>, relay=mail.XXXX.ch[213.239.XXX.XXX]:25, delay=3, delays=0.$ May 26 12:46:50 svgwma-kopa-02 postfix/qmgr[23017]: 5E115320DFE: removed
Why is the last line:
May 26 12:46:50 svgwma-kopa-02 postfix/qmgr[23017]: 5E115320DFE: removed <— Removed! My message??? -
The mail is removed because it was delivered to mail.XXXX.ch[213.239.XX.XXX]. If this is not your Kopano server, something is wrong here. Perhaps postfix does not think it is responsible for this domain. Also, why is postfix involved here? If you use fetchmail to get mail and send that to kopano-dagent, postfix should not be involved ?!?
-
I really don’t know why postfix is now involved for recieving mails. Maybe this is a question for Felix?
Here is my actual config from postfix:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP 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 readme_directory = no # See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on # fresh installs. compatibility_level = 2 # 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:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_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. # smtpd_relay_restrictions = permit_mynetworks defer_unauth_destination myhostname = svgwma-kopa-02.mysubdomain.topleveldomain.com mydomain = mydomain.me myorigin = $mydomain alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_transport = lmtp:[localhost]:2003 # virtual_mailbox_domains = /etc/kopano/postfix/vdomains # virtual_alias_maps = hash:/etc/kopano/postfix/valiases mydestination = $myhostname, svgwma-kopa-02, localhost.localdomain, localhost # relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 smtp_host_lookup = dns, native mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all message_size_limit = 52428800 #Hinzugefuegt am 24.05.2018 von alter Zarafa Konfiguration smtpd_client_restrictions = permit_mynetworks smtpd_recipient_restrictions = permit_mynetworks reject_invalid_hostname reject_unauth_destination reject_unknown_recipient_domain delay_warning_time = 4h smtpd_helo_required = yes #unknown_local_recipient_reject_code = 450 maximal_queue_lifetime = 7d minimal_backoff_time = 1000s maximal_backoff_time = 8000s smtpd_recipient_limit = 16 smtpd_soft_error_limit = 3 smtpd_hard_error_limit = 12 smtpd_sender_restrictions = reject_unknown_address #relayhosting from provider when running dynamic IP; now we need sasl_auth # relayhost = smtp.example.com smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/kopano/postfix/sasl_passwd sender_dependent_relayhost_maps = hash:/etc/kopano/postfix/sender_relay smtp_use_tls = yes smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes smtp_tls_enforce_peername = no smtpd_tls_security_level = may smtp_helo_timeout = 120s
Here is mail fetchmail config:
#.fetchmailrc set postmaster hispeed@mydomain.ch # set no bouncemail set no softbounce # accounts poll server.login-12.hoststar.ch bad-header accept proto imap user loginuser pass password is hispeed@mydomain.ch nokeep fetchall ssl
Right now Fetchmail is showing me that the message is flushed.
I don’t recieve any mails in Kopano. In mail.log I recieve this:May 27 19:52:41 svgwma-kopa-02 postfix/smtpd[30766]: connect from localhost6.localdomain6[::1] May 27 19:52:41 svgwma-kopa-02 postfix/smtpd[30766]: 8617A320E75: client=localhost6.localdomain6[::1] May 27 19:52:41 svgwma-kopa-02 postfix/cleanup[30769]: 8617A320E75: message-id=<DB5PR08MB119103B83CE312DEB6C608DEFB6F0@DB5PR08MB1191.eurprd08.prod.outlook.com> May 27 19:52:41 svgwma-kopa-02 postfix/qmgr[30459]: 8617A320E75: from=<myemailtestsender@hotmail.com>, size=7071, nrcpt=1 (queue active) May 27 19:52:41 svgwma-kopa-02 postfix/smtpd[30766]: 9E8DF320E76: client=localhost6.localdomain6[::1] May 27 19:52:41 svgwma-kopa-02 postfix/cleanup[30769]: 9E8DF320E76: message-id=<DB5PR08MB11917FBDB3ECAEC234C9F1F3FB6F0@DB5PR08MB1191.eurprd08.prod.outlook.com> May 27 19:52:41 svgwma-kopa-02 postfix/qmgr[30459]: 9E8DF320E76: from=<myemailtestsender@hotmail.com>, size=7065, nrcpt=1 (queue active) May 27 19:52:41 svgwma-kopa-02 postfix/smtpd[30766]: disconnect from localhost6.localdomain6[::1] ehlo=1 mail=2 rcpt=2 data=2 quit=1 commands=8 May 27 19:52:45 svgwma-kopa-02 postfix/smtp[30770]: 8617A320E75: to=<mykopanolocaluser@mytopleveldomain.ch>, relay=mail.externalmailserver.ch[XXX.XXX.213.233]:25, delay=3.6, delays=$ May 27 19:52:45 svgwma-kopa-02 postfix/qmgr[30459]: 8617A320E75: removed May 27 19:52:45 svgwma-kopa-02 postfix/smtp[30771]: 9E8DF320E76: to=<mykopanolocaluser@mytopleveldomain.ch>, relay=mail.externalmailserver.ch[XX.2XXX.213.233]:25, delay=3.6, delays=$ May 27 19:52:45 svgwma-kopa-02 postfix/qmgr[30459]: 9E8DF320E76: removed
Thanks for any help.
-
I have now the configuration in Fetchmail from Gerald but unfortunately i recieve this:
1 message for USERNAME at webXXX.login-12.hoststar.ch (6689 octets). fetchmail: MDA returned nonzero status 75 reading message webXXXX@webXXX.login-12.hoststar.ch:1 of 1 (6689 octets) not flushed
My questions do I need perl for Fetchmail? Something is probably wrong in the config but which config?
I don’t get more output from Fetchmail. -
@hispeed Hej hispeed! Maybe this is something for you?
I created a distribution for ARMv7 (RaspberryPi, Odroid) serving all your wishes. Packages for x64 are going to be build after testing.
It brings all configuration files and a customized Postfixadmin (managing Kopano and Postfix simultaneously) you can create a standalone mailserver or one which is sending with smarthost (User- or Domainwide) at the same time. Fetchmail is working, too.
The installscripts create the ready and running server. All together your done in about 15 minutes.
Introduction (Zarafa based)
https://pietma.com/zarafa-packages-for-arch-linux-arm/
https://pietma.com/zarafa-and-postfix-management/KOPANO BUILD
https://pietma.com/run-and-access-zarafa/#comment-1973Current image with Kopano 8.6.1
https://repository.pietma.com/nexus/content/sites/archlinux/os/prepared-kopano/Marti
-
Thanks for your post martimcfly. Actually I have a Odroid-C1 but I use it for something different. So I will need the X64 image. But I hope I can get it running on Ubuntu but if don’t get it work I will try your image as soon as it’s available for my platform based on esxi 6.5.
-
@hispeed said in Concept configuration of Postfix with Smarthosts:
I have now the configuration in Fetchmail from Gerald but unfortunately i recieve this:
1 message for USERNAME at webXXX.login-12.hoststar.ch (6689 octets). fetchmail: MDA returned nonzero status 75 reading message webXXXX@webXXX.login-12.hoststar.ch:1 of 1 (6689 octets) not flushed
My questions do I need perl for Fetchmail? Something is probably wrong in the config but which config?
I don’t get more output from Fetchmail.If you use the way I’m using fetchmail and have suggested it above, postfix should not be involved since it will fetch the mail and directly deliver it using kopano-dagent. So it should work even if your postfix configuration is not correct (which is probably the case :-)
As fbartels has mentioned, make sure you change zarafa-dagent to kopano-dagent. My example was copy&pasted from my installation logs and it was still called zarafa at the time.
So assuming you are now using
poll pop.srv.de proto pop3 user "mylogin" pass "mypass" options ssl smtpaddress localhost forcecr mda "/usr/bin/kopano-dagent -s the-local-kopano-user-id
as your configuration, your problem is most likely with kopano-dagent since this is the MDA (mail delivery agent) and your fetchmail complains about an MDA problem. To my knowledge fetchmail does not need perl, and the error message does not in any way suggest that perl would be a problem. I suggest you first check if the executable /usr/bin/kopano-dagent specified is correct (could be in another path on other distros? I’m using ubuntu 16.04) and if this is correct you need to check the logs of kopano-dagent why it fails.
To do so, on modern systems with systemd init and current kopano configuration files you need to check the systemd log (journalctl -u kopano-dagent -f -n 20 for example). On older crappy obsolete legacy systems without systemd+journal check /var/log/kopano/ for a dagent log file. You might need to turn up the logging level if not enough can be seen in the log why it fails. This can of course be done in /etc/kopano/dagent.cfg
If you use fetchmail the way fbartels has suggested he prefers, this is of course also perfectly fine. But then your postfix server must know for which emails he is directly responsible. Your postfix log above looked like postfix sent the email on to the internet because it did not think it is responsible to locally handle it. There are many ways to configure postfix, I’m using the virtual_ directives to tell postfix for what it is responsible. But there are other ways. If you want to go this route, the options “virtual_mailbox_domains”, “virtual_mailbox_maps”, “virtual_alias_maps” and “virtual_transport” are the most impotant. You need to really learn how to configure postfix though. If you just want to fetch some mails using POP or IMAP and Postfix will alway only be used to send mail to external recipients, using fetchmail + kopano-dagent will be much easier for you.
-
@martimcfly are these scripts anywhere on github? and GPL?
Then im not inventing the wheel again, this is a thing i want in debian also.
The source code page says 404 to me :-( -
Sorry for the 404. My Gitlab (SCM) wasn’t updated for a while and I’ve made it private for security reasons. Temporaly of course.
The bash-scripts are packed in here…
/usr/share/doc/kopano/pietma
https://repository.pietma.com/nexus/service/local/repositories/archlinux/content/armv7h/pietma-kopano/kopano-core-8.6.1-1-armv7h.pkg.tar.xz/usr/share/doc/kopano-postfixadmin/pietma/
/usr/share/doc/kopano-postfixadmin/example-config/
https://repository.pietma.com/nexus/service/local/repositories/archlinux/content/armv7h/pietma-kopano/kopano-postfixadmin-0.45.3-4-any.pkg.tar.xzPlease be aware of the fact, that these script have dependencies and asume paths which are only guaranteed with that packages on Archlinux.
But you can get a good idea how all this have to be setup to be working.
-
When talking about easier user management and appliances I have to throw my “go to” solution Univention into the pot as well: https://www.univention.com/products/univention-app-center/app-catalog/kopano-core/
They also have a Fetchmail app so everything can be done from their web ui.
-
@martimcfly thank you very much for these very usefull.
@fbartels, thank for the univention link, i’ll have a look at that also.
-
Hi folks, thanks for your answer…slowly I’m getting closer to the solution.
The problem is the dagent. I can’t start it. Is there anything to do in the dagent.cfg? Everything was commented out (auskommentiert).Maybe I can find out more…
Mai 30 17:19:27 svgwma-kopa-02 kopano-dagent[17333]: Wed May 30 17:19:27 2018: [info ] Coredump status left at system default. Mai 30 17:19:27 svgwma-kopa-02 kopano-dagent[17333]: Wed May 30 17:19:27 2018: [info ] Maximum LMTP threads set to 20 Mai 30 17:19:27 svgwma-kopa-02 kopano-dagent[17333]: Wed May 30 17:19:27 2018: [info ] Listening on *:2003 for LMTP Mai 30 17:19:27 svgwma-kopa-02 kopano-dagent[17333]: Wed May 30 17:19:27 2018: [crit ] Unable to create socket(10,1,6) port 2003: Address already in use
https://forums.zarafa.com/showthread.php?12412-zarafa-7-2-2-dagent-error
Same here is there any sample for dagent.cfg?
@thctlo i’ts always comming back ;=) 2 years are over and nobody has the problem except from me and you had it? How did you fix it?/etc/kopano/server.cfg <- I have probably some configuration issues also there.
For me it looks like that this tutorial is incomplete as always:
https://www.pc-howto.com/kopano-der-neue-stern-am-groupwarehimmel-teil-1/
https://www.pc-howto.com/kopano-der-neue-stern-am-groupwarehimmel-teil-2/Maybe I’m just to stupid. @martimcfly I go thru your config files by tomorrow.
-
If you run kopano-dagent with the parameter -l, it will bind to port 2003 and wait for connections. [-l = listen mode]
If you start kopano-dagent with a receipient as parameter it will read mail from stdin and then (with proper input which it gets from fetchmail) deliver this single mail to kopano.
If your log says “Unable to create socket, address already in use”, then you already have a kopano-dagent running in listen mode and you are trying to start another one in listen mode. kopano-dagent cannot run twice in listen mode. But you can of course have it running in listen mode and on demand call it in interactive mode from fetchmail.
An empty dagent.cfg should be fine.