[pfx] Re: Resolve sender domains in file before resorting to database
On Wed, Feb 28, 2024 at 12:17:27PM -0600, Joshua Flanagan via Postfix-users wrote: > Anyone else have suggestions on how to make sure postfix queries a file > table _by domain_ while still having a remote database lookup table as a > backup/last resort? To restrict database lookups to a subset of domains use the "domain = " table property. IIRC you may be able to negate the condition to exclude all but a given set of domains, or do that with 'if !/pattern/' in regex tables. domain = !hash:/some/table domain = !inline:{ {example.org = skip}, ... } domain = pcre:{ { if !/^example\.org$/ }, { /^/ use }, { endif } } -- Viktor. ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org
[pfx] Re: Resolve sender domains in file before resorting to database
If I understand correctly, you simply changed which part of the regular expression was captured. That does not solve my problem, as it still will cause all requests to hit the database, even when the domain exists in the hash file. Desired flow when the sender's domain DOES exist in the hash file: lookup us...@example2.com in the hash file. FAIL lookup us...@exampe5.com in the regex. FAIL - skip checking postgres lookup @example2.com in the has file. PASS Desired flow when the sender's domain DOES NOT exist in the hash file: lookup us...@example5.com in the hash file. FAIL lookup us...@example5.com in the regex. FAIL - skip checking postgres lookup @example5.com in the hash file. FAIL lookup @example5.com in the regex. PASS lookup @example5.com in postgres With your solution, the regex will pass during the first pass, so there will never be an attempt to lookup just the domain in the hash file. > > The nouser file contains one pattern: > > /^(@.*)/ ${1} > > /(@[^"@]+)$/ ${1} > > Or, perhaps: > > /@([^"@]+)$/ ${1} > > With no leading "@" in the Postgresql data. > > -- > Viktor. > ___ > Postfix-users mailing list -- postfix-users@postfix.org > To unsubscribe send an email to postfix-users-le...@postfix.org > ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org