david rankin wrote:
From: "Per Jessen"
The second point I'm missing is "why can't I just use the existing recepient_check file and put "support@ reject" in there?"
Because postfix lookup tables don't work like that :-)
Can't I do something similar with hash?? I don't have a clue about perl. Assembler, Fortran, C, C++ maybe, but definately not perl.....
I'm none too fond of perl myself - but fortunately you don't need to know anything about perl to write PCREs. Are you any good with regular expressions in general?
Uhh... I'm a little hesitant to answer, because I'm not sure what "regular" means in this case. I'm mean, I can hande "regular" anything as long as I have a man page that tells me what the syntax is : - ). I will give your suggestions a try and take it on faith that regular, in the PCREs case, means the /^ ... @ ...$/ as in:
Regular expressions are an absolute must for adminstrators. You will encounter these pattern matching expressions in most scripting and programming languages.
Create a file called /etc/postfix/recipient_check.pcre :
/^support@[domain1|domain2|domain3....]$/ REJECT
The square brackets don't work on my system with either pcre or regexp. I use round brackets instead. Have you tried it, Per? What you have here is a pattern set between the to slashes: / pattern start ^ the beginning of the line, pattern can not start in the middle support@ just text. (^-^) (val1|val2...) the pattern can have one of the mentioned values within the brackets. | OR $ the end of the line / pattern end hash: support@example.com REJECT pcre: /^support@example\.com$/ REJECT The backslash is escaping the ".", otherwise it would have a special meaning and would match any single character. A literal $ would have to be escaped as \$ to avoid the use as expression matching denominator. The big advantage of pattern versus hashes is that pattern can have placeholders and/or multiple values. testpcre: /^(support@(*example\.com|example2\.*))$/ REJECT internal address $1 rejected! This will hit every the following patterns: support@*example.com support@example2.* Additionally it will use the content in the round brackets as $1, $2 (content of first found expression in brackets, second found... postmap -q "support@testsystem.example.com" pcre:testpcre REJECT internal address support@testsystem.example.com rejected! Take a while to get accustomed to regular expressions. As Per already said, it takes some time and lots of own tests to build up experience and confidence with regular expressions. They will slooowly grow on you. (^-^) Sandy -- List replies only please! Please address PMs to: news-reply2 (@) japantest (.) homelinux (.) com