[pfx] Re: header_checks not work with regexp
On 17.04.23 08:54, SysAdmin EM via Postfix-users wrote: Hello everyone the problem persists. Maybe I’m doing something wrong. Step 1, I add the rule in the /etc/postfix/header_checks file /^Subject:.*You may need to add/ DISCARD TMP_BLOCK Step 2, postmap /etc/postfix/header_checks and postfix surcharge. Are these steps correct? you don't need to use postmap for regexp maps. Could the problem occur because the postfix-regexp library is not installed? which OS/distribution do you use? does running "postconf -m" show regexp as one of map types? -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Microsoft dick is soft to do no harm ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org
[pfx] Re: header_checks not work with regexp
Hello everyone the problem persists. Maybe I’m doing something wrong. Step 1, I add the rule in the /etc/postfix/header_checks file /^Subject:.*You may need to add/ DISCARD TMP_BLOCK Step 2, postmap /etc/postfix/header_checks and postfix surcharge. Are these steps correct? Could the problem occur because the postfix-regexp library is not installed? ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org
[pfx] Re: header_checks not work with regexp
On Fri, Apr 14, 2023 at 05:51:21PM -0300, SysAdmin EM via Postfix-users wrote: postmap -q "Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: '10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." regexp:/etc/postfix/header_checks On 14.04.23 18:15, Viktor Dukhovni via Postfix-users wrote: Your testing methodology is flawed or regexp rule file is malformed. The file should contain: /^Subject:.*You may need to add.*/ DISCARD BLOCK_TEMPORAL on a single line with no leading whitespace, and not have any syntax issues on any other lines. ...and drop that trailing .* at the end, it's useless there. /^Subject:.*You may need to add/ DISCARD BLOCK_TEMPORAL -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Enter any 12-digit prime number to continue. ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org
[pfx] Re: header_checks not work with regexp
On Fri, Apr 14, 2023 at 05:51:21PM -0300, SysAdmin EM via Postfix-users wrote: > postmap -q "Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: > '10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." > regexp:/etc/postfix/header_checks Works here (bash syntax): $ hdr="Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: '10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." $ rule='/^Subject:.*You may need to add.*/ DISCARD BLOCK_TEMPORAL' $ postmap -q "$hdr" regexp:<(printf "%s\n" "$rule") DISCARD BLOCK_TEMPORAL > any ideas?? Your testing methodology is flawed or regexp rule file is malformed. The file should contain: /^Subject:.*You may need to add.*/ DISCARD BLOCK_TEMPORAL on a single line with no leading whitespace, and not have any syntax issues on any other lines. -- Viktor. ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org
[pfx] Re: header_checks not work with regexp
The rule not work postmap -q "Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: ' 10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." regexp:/etc/postfix/header_checks WARN /^Subject:.*You may need to add.*/ DISCARD BLOCK_TEMPORAL any ideas?? On Fri, Apr 14, 2023 at 3:50 PM Viktor Dukhovni via Postfix-users < postfix-users@postfix.org> wrote: > On Fri, Apr 14, 2023 at 03:31:17PM -0300, SysAdmin EM via Postfix-users > wrote: > > > Sorry for such a basic question but I couldn’t find a solution on my > > part. I’m trying to block a Subject using header_checks but it’s not > > working. > > > > This is my rule: > > > > /^Subject:.*Invalid HTTP_HOST header.*/ DISCARD SUBJECTALERT > > This looks OK, and expects a "Subject:" header. > > > I used postmap to test the rule but not match. > > > > postmap -q "[KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: ' > 10.54.130.188:8020'. You may need to add u'10.54.130.188' to > ALLOWED_HOSTS." regexp:/etc/postfix/header_checks > > This is not a "Subject:" header. Perhaps you meant to type: > > postmap -q "Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST > header: '10.54.130.188:8020'. You may need to add u'10.54.130.188' to > ALLOWED_HOSTS." regexp:/etc/postfix/header_checks > > -- > 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
[pfx] Re: header_checks not work with regexp
On Fri, Apr 14, 2023 at 03:31:17PM -0300, SysAdmin EM via Postfix-users wrote: > Sorry for such a basic question but I couldn’t find a solution on my > part. I’m trying to block a Subject using header_checks but it’s not > working. > > This is my rule: > > /^Subject:.*Invalid HTTP_HOST header.*/ DISCARD SUBJECTALERT This looks OK, and expects a "Subject:" header. > I used postmap to test the rule but not match. > > postmap -q "[KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: > '10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." > regexp:/etc/postfix/header_checks This is not a "Subject:" header. Perhaps you meant to type: postmap -q "Subject: [KIS] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: '10.54.130.188:8020'. You may need to add u'10.54.130.188' to ALLOWED_HOSTS." regexp:/etc/postfix/header_checks -- Viktor. ___ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org