Spam notification
Hi all, I'm facing a stupid situation and I'm looking for advises. I'm using a postfix relay to filter viruses and spams. All is working well except with spam that use the same declared address for both sender and recipient. What happened in this particular situation is described as follow: * The spam is detected, * A notification is sent (with the original message as an attachment), * The targeted recipient in my domain receives that notification. Conclusion: the spam is passed! I could stop sending notifications but I think my employer would not like it... I'm sure some of you have already faced and solved this kind of situation. I'm looking for your help :-) Thanks in advance, Antoine.
Re: Spam notification
Le 18/06/2010 11:15, Michael Weissenbacher a écrit : Conclusion: the spam is passed! I could stop sending notifications but I think my employer would not like it... Short answer: You should NEVER notify anyone about detected spam! This will effectively make yourself a spam source. It's even worse when you attach the original message. hth, Michael I agree with that... but what about false positives?
Re: Spam notification
Le 18/06/2010 11:28, Mark Goodge a écrit : On 18/06/2010 10:17, Antoine Nguyen wrote: Le 18/06/2010 11:15, Michael Weissenbacher a écrit : Conclusion: the spam is passed! I could stop sending notifications but I think my employer would not like it... Short answer: You should NEVER notify anyone about detected spam! This will effectively make yourself a spam source. It's even worse when you attach the original message. hth, Michael I agree with that... but what about false positives? There are three main options: 1. Just discard spam. 2. Quarantine spam, and allow the user to check their quarantine folder and release it if necessary. 3. Don't intercept spam, just tag it and leave the actual filtering to the recipient's own system. I'm not a great fan of quarantining, although it works fairly well for webmail systems where the quarantine can be accessed through the same interface as the inbox (eg, Gmail and Hotmail). It's less helpful where mail is delivered to a POP3 or IMAP box as users have to go to a separate interface to check the quarantine. Personally, I prefer to have an approach that's split between discarding and tagging - discard anything that's a definite spam, and tag the rest. That way, you minimise the worst effects of spam while not blocking anything that might generate a false positive. Mark . That's a good approach. I'm already discarding true spams and tagging the rest (amavisd-new tag2 and kill levels). I think I'm going to deactivate notifications and wait for eventual complaints from my users about emails not arriving :-) Many thanks for those quick answers. Antoine.
Re: Spam notification
Le 18/06/2010 11:42, Erik Logtenberg a écrit : Michael Weissenbacher wrote: Conclusion: the spam is passed! I could stop sending notifications but I think my employer would not like it... Short answer: You should NEVER notify anyone about detected spam! This will effectively make yourself a spam source. It's even worse when you attach the original message. He sends the notification not to the apparent (probably forged) sender, but to the intended receipient. This way he won't really be a spam source, but on the other hand, his solution isn't helping much either ;) In general, you should definately not send notifications regarding spam detection. Yes that's what happened. The notification si sent directly to the real MX declared server that is behind the relay. I've just realized that my $final_spam_destiny was set to D_REJECT and not D_DISCARD. My bad :p So now, notifications will not be sent to anyone.
Re: Spam notification
Le 18/06/2010 11:51, Reko Turja a écrit : I'm not a great fan of quarantining, although it works fairly well for webmail systems where the quarantine can be accessed through the same interface as the inbox (eg, Gmail and Hotmail). It's less helpful where mail is delivered to a POP3 or IMAP box as users have to go to a separate interface to check the quarantine. With quarantine and IMAP, one approach is using sieve with IMAP server and forwarding the border cases automatically via sieve rules to users junk/spam folder. That way quarantine can be accessed from the regular mail client or web interface and checked by the user him/herself if important mail seems to be missing. At least Cyrus can do this pretty painlessly, and I think Dovecot does support sieve these days too. -Reko Good idea. But I think this is getting harder if you want to allow users to notify server about its errors (false positive, false negative, ...). Talking about that, I would just let the list knows that I've just released a new version of MailNG. This is a web based tool that allows the administration and use of a virtual domains hosting platform. It provides: * An admin panel to create domains/mailboxes/aliases and more, * A simple webmail, * A quarantine managment tool (Amavisd-new sql quarantine), * Automatic replies (vacation), * Graphical statistics. It works great with postfix. In fact, I've only tested it with postfix ;-) The project lives here : http://projects.koalabs.org/trac/mailng/ Antoine
MailNG: simple web solution to manage virtual domains
Hi all, I'm working on a web solution to manage virtual domains. It has been tested with Postfix and Dovecot. A MySQL backend is needed. You cand find the project here : http://projects.koalabs.org/trac/mailng/ The source code is distributed under the BSD license. Regards, Antoine Nguyen PS : I hope this place is the right place for this kind of message...
Re: Graphical stats by domain
Muzaffer Tolga Özses wrote: >Good morning everyone :) > >Do you guys know of a tool that will act like pflogsumm, only based on >domain and graphical? > >Regards, > Hi, take a look at modoboa (http://modoboa.org/). It supports per-domain graphical stats using RRDtool. Antoine
Re: Autoresponder
On 15/04/2016 20:59, David Mehler wrote: Hello, I'm looking for an autoresponder, free, and one that does not rely on postfixadmin. I saw one featured in a howtoforge article called Autoresponse 1.6.3 but that has been taken down, which is unfortunate, because how it worked, sending an email to an address sounded great for my needs. If anyone has this, or has any suggestions i'd appreciate them. I have looked on the postfix page and the autoresponders there are paid products, and the one that isn't uses an LDAP format which I am not using. Hi, you can take a look at Modoboa (http://modoboa.org/), it provides an autoresponder. Antoine Nguyen
mysql lookup table and utf8
Dear list, I'm trying to setup a postfix 3.0 with a mysql backend to host utf8 domains. The setup is almost ready but when I make some tests, utf8 domains are not found (I see "relay access denied" errors in the logs) and I get the same result using postmap: > postmap -q raté.com mysql:/etc/postfix/sql-domains.cf >
mysql lookup table and utf8
Dear list, sorry for my previous incomplete message. I'm trying to setup a postfix 3.0 with a mysql backend to host utf8 domains. The setup is almost ready but when I make some tests, utf8 domains are not found (I see "relay access denied" errors in the logs) and I get the same result using postmap: postmap -q raté.com mysql:/etc/postfix/sql-domains.cf If I try with a domain containing ascii characters only, it works just fine. What am I doing wrong ? Thanks for your help, Antoine Nguyen
Re: mysql lookup table and utf8
On 12/09/2016 12:42, Wietse Venema wrote: Antoine Nguyen: Dear list, sorry for my previous incomplete message. I'm trying to setup a postfix 3.0 with a mysql backend to host utf8 domains. The setup is almost ready but when I make some tests, utf8 domains are not found (I see "relay access denied" errors in the logs) and I get the same result using postmap: postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf And why should this return a result? Hint: do the sql query by hand. The query returns a result when I execute it manually within the mysql shell. (sorry for the previous copy/paste, my email client does not use the same encoding) MariaDB [modoboa]> SELECT name FROM admin_domain WHERE name='raté.com' and enabled=1; +---+ | name | +---+ | raté.com | +---+ 1 row in set (0.01 sec) Antoine
Re: mysql lookup table and utf8
On 12/09/2016 17:04, Wietse Venema wrote: Antoine Nguyen: On 12/09/2016 12:42, Wietse Venema wrote: Antoine Nguyen: Dear list, sorry for my previous incomplete message. I'm trying to setup a postfix 3.0 with a mysql backend to host utf8 domains. The setup is almost ready but when I make some tests, utf8 domains are not found (I see "relay access denied" errors in the logs) and I get the same result using postmap: postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf And why should this return a result? Hint: do the sql query by hand. The query returns a result when I execute it manually within the mysql shell. (sorry for the previous copy/paste, my email client does not use the same encoding) MariaDB [modoboa]> SELECT name FROM admin_domain WHERE name='rat?.com' and enabled=1; Just for test, what happens when you do: (this is what Postfix daemons use by default) LC_ALL=C postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf (this is to test what happens with an UTF-8 locale) LC_ALL=en_US.UTF-8 postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf Still no result with both command lines. I'm a bit lost... could it be a mysql collation issue ? Antoine
Re: mysql lookup table and utf8
On 12/09/2016 17:04, Wietse Venema wrote: Just for test, what happens when you do: (this is what Postfix daemons use by default) LC_ALL=C postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf (this is to test what happens with an UTF-8 locale) LC_ALL=en_US.UTF-8 postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf Just a stupid question but am I right to think the use case I'm trying to implement using Postfix 3+ and a SQL backend should work ? Thanks in advance, Antoine Nguyen
Re: mysql lookup table and utf8
On 13/09/2016 12:43, Wietse Venema wrote: Antoine Nguyen: On 12/09/2016 17:04, Wietse Venema wrote: Just for test, what happens when you do: (this is what Postfix daemons use by default) LC_ALL=C postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf (this is to test what happens with an UTF-8 locale) LC_ALL=en_US.UTF-8 postmap -q rat?.com mysql:/etc/postfix/sql-domains.cf Just a stupid question but am I right to think the use case I'm trying to implement using Postfix 3+ and a SQL backend should work ? Yes, UTF-8 queries are supposed to work with all Postfix lookup tables, so the question is where things go wrong. Fine. Do you have any hint/idea on what I could do to locate the issue ? Antoine
Re: mysql lookup table and utf8
On 13/09/2016 16:10, Admin Beckspaced wrote: hello ;) not sure if this will help? but had a similar issue with mysql queries a while back. it actually had nothing to do with postfix and sql lookup tables ... but ran into trouble with different mysql character sets ... causing queries to also fail not sure how your data made it into the mysql tables? but i had problems with latin-1 characters set ending up in a UTF-8 character set table and the whole thing got messed up ... it's called mysql character set hell ;) this link might help? https://www.blueboxcloud.com/insight/blog-article/getting-out-of-mysql-character-set-hell but again ... i'm not sure in your case. just an idea, perhaps it might help? Thank you for this link but, since it is a new setup, I have no data. I've already checked mysql configuration : default character set is utf8, default collation is utf8_general_ci and database and tables are using those values. Also, it looks like the data inserted by Modoboa (the tool I use to manage domains) is encoded using utf8. I'm still stuck with this and I don't understand why yet... Antoine
Re: mysql lookup table and utf8
On 13/09/2016 18:08, Viktor Dukhovni wrote: Make sure your shell or terminal emulator is not mangling utf-8 input or command-line arguments. * Post your map.cf file content, perhaps that map file restricts which lookup keys are passed on to the underlying database. * Place the lookup key in a file. * Ensure that the file's content is correctly utf-8 encoded. * Run: postmap -v -q - mysql:... < input-file Repeat with various values of LANG. Note that Postfix applies MySQL string quoting to input arguments, and the MySQL client confgiration must somehow decide to use UTF-8 encoding for the query string. The map.cf file content is the following : user = modoboa password = password dbname = modoboa hosts = 127.0.0.1 query = SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled=1 I've tried the different steps you proposed and unfortunately, it is not better: $ echo raté.com > test $ file test test: UTF-8 Unicode text $ postmap -v -q - mysql:/etc/postfix/sql-domains.cf < test postmap: name_mask: ipv4 postmap: inet_addr_local: configured 3 IPv4 addresses postmap: cfg_get_str: /etc/postfix/sql-domains.cf: user = modoboa postmap: cfg_get_str: /etc/postfix/sql-domains.cf: password = modoboa postmap: cfg_get_str: /etc/postfix/sql-domains.cf: dbname = modoboa postmap: cfg_get_str: /etc/postfix/sql-domains.cf: result_format = %s postmap: cfg_get_str: /etc/postfix/sql-domains.cf: option_file = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: option_group = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: tls_key_file = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: tls_cert_file = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: tls_CAfile = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: tls_CApath = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: tls_ciphers = postmap: cfg_get_bool: /etc/postfix/sql-domains.cf: tls_verify_cert = on postmap: cfg_get_int: /etc/postfix/sql-domains.cf: expansion_limit = 0 postmap: cfg_get_str: /etc/postfix/sql-domains.cf: query = SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled=1 postmap: cfg_get_str: /etc/postfix/sql-domains.cf: domain = postmap: cfg_get_str: /etc/postfix/sql-domains.cf: hosts = 127.0.0.1 postmap: dict_open: mysql:/etc/postfix/sql-domains.cf postmap: dict_mysql_get_active: attempting to connect to host 127.0.0.1 postmap: dict_mysql: successful connection to host 127.0.0.1 postmap: dict_mysql: successful query from host 127.0.0.1 postmap: dict_mysql_lookup: retrieved 0 rows The result is always the same even if I change LANG (tried C and en_US.UTF-8). Antoine
Re: mysql lookup table and utf8
On 14/09/2016 04:01, Viktor Dukhovni wrote: On Tue, Sep 13, 2016 at 09:52:16PM +0200, Antoine Nguyen wrote: query = SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled=1 What is not clear is how MySQL's quoting behaves given the input UTF-8 string. postmap: cfg_get_str: /etc/postfix/sql-domains.cf: query = SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled=1 postmap: dict_mysql: successful query from host 127.0.0.1 postmap: dict_mysql_lookup: retrieved 0 rows I was hoping to see the expanded query string, but it is not output with "-v". Perhaps there's some sort of logging you can enable in the MySQL server or client libraries. Do make sure that your tests with the sql CLI really make the same query against the same database: SELECT name FROM admin_domain WHERE name='' AND type='domain' AND enabled=1 I've enabled queries logging. Here is the result : 160914 8:24:14 57 QuerySELECT name FROM admin_domain WHERE name='gaël.com' AND type='domain' AND enabled=1 160914 8:24:31 60 Connectmodoboa@localhost as anonymous on modoboa 60 QuerySELECT name FROM admin_domain WHERE name='gaël.com' AND type='domain' AND enabled=1 60 Quit The first query was executed using mysql shell and it returns 1 row. The second query was executed by postmap and returns nothing whereas we can see they are the same... Antoine
Re: mysql lookup table and utf8
On 14/09/2016 10:27, Antoine Nguyen wrote: The first query was executed using mysql shell and it returns 1 row. The second query was executed by postmap and returns nothing whereas we can see they are the same... I've just tried with postgresql and the result is the same... Antoine
Re: mysql lookup table and utf8
On 14/09/2016 12:53, Wietse Venema wrote: Antoine Nguyen: [ Charset windows-1252 converted... ] On 14/09/2016 10:27, Antoine Nguyen wrote: The first query was executed using mysql shell and it returns 1 row. The second query was executed by postmap and returns nothing whereas we can see they are the same... I've just tried with postgresql and the result is the same... I forgot, did the same query work for a non-UTF8 domain name? Yes, it works. Antoine
Re: mysql lookup table and utf8
On 14/09/2016 14:17, Viktor Dukhovni wrote: On Wed, Sep 14, 2016 at 10:27:32AM +0200, Antoine Nguyen wrote: Do make sure that your tests with the sql CLI really make the same query against the same database: SELECT name FROM admin_domain WHERE name='' AND type='domain' AND enabled=1 I've enabled queries logging. Here is the result : 160914 8:24:14 57 QuerySELECT name FROM admin_domain WHERE name='gaël.com' AND type='domain' AND enabled=1 160914 8:24:31 60 Connectmodoboa@localhost as anonymous on modoboa 60 QuerySELECT name FROM admin_domain WHERE name='gaël.com' AND type='domain' AND enabled=1 60 Quit The first query was executed using mysql shell and it returns 1 row. The second query was executed by postmap and returns nothing whereas we can see they are the same... Do post the "Connect" string for *both* queries. Here is the missing line : 160914 8:23:5757 Connect root@localhost as anonymous on modoboa I indeed tried with root but result is the same if I use modoboa user with mysql shell: it works. Antoine
Re: mysql lookup table and utf8
On 14/09/2016 14:53, Viktor Dukhovni wrote: Please post a single message with two complete traces in which: * The Unix login users executing "postmap -q" and using the MySQL shell are the same. (That is the same unix shell spawns both "postmap -q" and the MySQL interactive session). * The target MySQL database name and database user are clearly identified in both cases. * The queries and results are reported in detail. Please look for any client-side configuration files that might be loaded by the MySQL interactive shell that may affect connection settings, such as perhaps the client character set. As I said, I made some tests with postgres and I think I found an interesting hint inside logs: LOG: statement: set client_encoding to 'LATIN1' LOG: statement: SELECT name FROM admin_domain WHERE name='raté.com' AND type='domain' AND enabled This is the result of postmap execution, it uses LATIN1 as encoding and not UTF8... (whereas server default encoding is UTF8 and my shell's current locale is en_US.UTF-8) I haven't found how to change default client encoding yet... Does postfix set it ? Antoine
Re: mysql lookup table and utf8
On 14/09/2016 16:09, Antoine Nguyen wrote: As I said, I made some tests with postgres and I think I found an interesting hint inside logs: LOG: statement: set client_encoding to 'LATIN1' LOG: statement: SELECT name FROM admin_domain WHERE name='raté.com' AND type='domain' AND enabled This is the result of postmap execution, it uses LATIN1 as encoding and not UTF8... (whereas server default encoding is UTF8 and my shell's current locale is en_US.UTF-8) I haven't found how to change default client encoding yet... Does postfix set it ? Sorry to reply to myself but looks like the answer is here: https://github.com/vdukhovni/postfix/blob/506a3e8993d1d73b397a113b89319ff997e8673b/postfix/src/global/dict_pgsql.c#L644 Antoine
Re: mysql lookup table and utf8
On 14/09/2016 17:06, Viktor Dukhovni wrote: On Wed, Sep 14, 2016 at 04:14:32PM +0200, Antoine Nguyen wrote: I haven't found how to change default client encoding yet... Does postfix set it ? Sorry to reply to myself but looks like the answer is here: https://github.com/vdukhovni/postfix/blob/506a3e8993d1d73b397a113b89319ff997e8673b/postfix/src/global/dict_pgsql.c#L644 Yes, the Postgres driver is unconditionally LATIN1 at present. And this limitation does not exist with the mysql one ? Antoine
Re: mysql lookup table and utf8
On 14/09/2016 14:53, Viktor Dukhovni wrote: Please look for any client-side configuration files that might be loaded by the MySQL interactive shell that may affect connection settings, such as perhaps the client character set. Looks like I've found the issue. Actually, the mysql connector does not read the default /etc/my.cnf file (or at least the package I installed for CentOS 7). Adding: option_file = /etc/my.cnf At the beginning map.cf file fixes the problem because I set utf8 as the default client encoding in the general mysql config. Thanks for your help ! @Viktor Do you confirm it is not currently possible to host UTF8 domains with a postgres backend ? Antoine
Re: mysql lookup table and utf8
On 15/09/2016 16:47, Viktor Dukhovni wrote: On Thu, Sep 15, 2016 at 09:51:11AM -0400, Wietse Venema wrote: Stephan Seitz: On Thu, Sep 15, 2016 at 06:49:08AM -0400, Wietse Venema wrote: FYI, Postfix uses libmysqlclient. So what's up with not reading the default config file? Can it be the usual chroot problem? Postfix normally opens tables before chroot() and before dropping root privileges. I would expect that libmysqlclient reads my.cnf during intialization, not at the time of the first query, but this can be verified by running a Postfix process under strace or equivalent (see http://www.postfix.org/DEBUG_README.html). With both LDAP and MySQL (and likely also Postgres), Postfix does not open connections at table initialization time. Connection start is delayed until the first lookup. This gets the associated latency out of the critical path (as does using proxymap). So there are no pre-jail calls into the MySQL libraries, all that happens with the first query. So chroot can be a problem, but in this case the OP had reproducible issues on the command-line with "postmap -q", no chroot there. In can confirm that, no chroot issue there. The my.cnf file is not available inside the chroot so changing the path in map files wouldn't have any effect. Could it simply be a libmysqlclient packaging issue ? Wrong compilation options ? Antoine
Re: Maildir not automaticily added with virtual users
On 20/07/2011 09:12, Erik - versatel wrote: I use virtual users and virtual domains My virtual_mailbox_base = /var/mail/vhosts My virtual_mailbox_maps = hash:/etc/postfix/vmailbox home_mailbox = Maildir/ In etc/postfix/vmailbox u...@example.comexample.com/user In this case my mail is not delivered - I get a message user is dir not file When I change this into: In etc/postfix/vmailbox u...@example.comexample.com/user/ My mail is now delivered at /var/mail/vhosts/example.com/user and not to /var/mail/vhosts/example.com/user/Maildir When i want the mail delivered to /var/mail/vhosts/example.com/user/Maildir I have to change the file vmailbox to: In etc/postfix/vmailbox u...@example.comexample.com/user/Maildir/ I expected that if you choose for a kind of Mailbox, this would also be for virtual users. I expected it to work with the first option, without the / (u...@example.com example.com/user) I should think this is logical. Is this a bug ??? I want my mail delivered at /var/mail/vhosts/example.com/user/Maildir Thanks Erik home_mailbox only applies with local users (ie. non virtual ones). I think you need to specify the "Maildir/" prefix for each virtual user you will hande: /etc/postfix/vmailbox: u...@example.comexample.com/user/Maildir/ -- Antoine Nguyen Modoboa developer http://modoboa.org
Re: Plesk or equivalent to manage Postfix ?
On 04/11/2011 15:54, Frank Bonnet wrote: On 11/04/2011 03:48 PM, /dev/rob0 wrote: On Friday 04 November 2011 08:13:59 Frank Bonnet wrote: Does anyone has ever use Plesk or another graphical interface to manage Postfix ? I'm sure they have. If yes any infos/advices welcome Don't. Such a GUI can only be as good as the GUI creator's understanding of Postfix, and IME that does not seem to be very good. If the actual problem you wish to address is to turn over control of user management to non-technical persons, there are other choices. Actual management of the MTA itself should never be turned over to non-technical persons. My problem is I MUST do this ( delegate minor tasks to a non technical person ) of course I will install/configure the server myself for the first startup. But some tasks such user's creation / destruction could be delegated through an interface that avoid mistakes ( I don't want to let them modify something by hands !!!) For domains and mailboxes management, you can take a look at http://modoboa.org/. -- Antoine Nguyen Modoboa developer http://modoboa.org