Prev: postdrop?
Next: ssh tunnel triggered on usage?
From: Michael on 6 Jan 2010 23:56 I want to deploy a system whereby it will do an SQL lookup and depending on the result will either continue processing the message as per usual or issue a 'temporary' reject (Ie: Over quota message). This is on a relaying/gateway machine so it does not have direct access to the mail queue to do it's own calculation so would need to work it out based on information available from an SQL table.
From: Wietse Venema on 7 Jan 2010 06:50 Michael: > I want to deploy a system whereby it will do an SQL lookup and depending on > the result will either continue processing the message as per usual or issue > a 'temporary' reject (Ie: Over quota message). > > This is on a relaying/gateway machine so it does not have direct access to the > mail queue to do it's own calculation so would need to work it out based on > information available from an SQL table. Pointers: A) Use an SQL-based access table that is queried at SMTP time: http://www.postfix.org/access.5.html http://www.postfix.org/mysql_table.5.html B) Use a policy server that queries the database and does the calculation: http://www.postfix.org/SMTPD_POLICY_README.html Wietse
From: Michael on 7 Jan 2010 06:58 On Fri, 08 Jan 2010 00:50:49 Wietse Venema wrote: > Michael: > > I want to deploy a system whereby it will do an SQL lookup and depending > > on the result will either continue processing the message as per usual or > > issue a 'temporary' reject (Ie: Over quota message). > > > > This is on a relaying/gateway machine so it does not have direct access > > to the mail queue to do it's own calculation so would need to work it out > > based on information available from an SQL table. > > Pointers: > > A) Use an SQL-based access table that is queried at SMTP time: > http://www.postfix.org/access.5.html > http://www.postfix.org/mysql_table.5.html > > B) Use a policy server that queries the database and does the calculation: > http://www.postfix.org/SMTPD_POLICY_README.html Thanks Wietse. What I was thinking of doing was using check_recipient_access Will a 'NULL' result (ie: no rows returned) be treated as an OK? I can structure a query that will calculate if the user is under quota, however not all queries will return results (as some addresses are sent to other mail servers) What I want is: - check, return OK or DEFER - if no result Postfix treats as 'OK' I have already written and tested the query now I just need to integrate it. Michael
From: Michael on 7 Jan 2010 07:19 On Fri, 08 Jan 2010 00:50:49 Wietse Venema wrote: > Michael: > > I want to deploy a system whereby it will do an SQL lookup and depending > > on the result will either continue processing the message as per usual or > > issue a 'temporary' reject (Ie: Over quota message). > > > > This is on a relaying/gateway machine so it does not have direct access > > to the mail queue to do it's own calculation so would need to work it out > > based on information available from an SQL table. Is the following: access_map_defer_code = set to the same number as in the result message, minus the dots? ie: Do I set this to: access_map_defer_code = 422 for overquota user mailboxes?
From: Wietse Venema on 7 Jan 2010 09:09
Michael: > On Fri, 08 Jan 2010 00:50:49 Wietse Venema wrote: > > Michael: > > > I want to deploy a system whereby it will do an SQL lookup and depending > > > on the result will either continue processing the message as per usual or > > > issue a 'temporary' reject (Ie: Over quota message). > > > > > > This is on a relaying/gateway machine so it does not have direct access > > > to the mail queue to do it's own calculation so would need to work it out > > > based on information available from an SQL table. > > Is the following: > access_map_defer_code = > > set to the same number as in the result message, minus the dots? > > ie: Do I set this to: > access_map_defer_code = 422 > for overquota user mailboxes? You can use the access map lookup result to specify the RFC 5321 SMTP reply code (and the RFC 3463 enhanced status code). Wietse man 5 access .... REJECT ACTIONS Postfix version 2.3 and later support enhanced status codes as defined in RFC 3463. When no code is specified at the beginning of the text below, Postfix inserts a default enhanced status code of "5.7.1" in the case of reject actions, and "4.7.1" in the case of defer actions. See "ENHANCED STATUS CODES" below. 4NN text 5NN text Reject the address etc. that matches the pattern, and respond with the numerical three-digit code and text. 4NN means "try again later", while 5NN means "do not try again". The reply code "421" causes Postfix to disconnect immediately (Postfix version 2.3 and later). |