[pfx] Block based on subject and rcpt to

2023-08-14 Thread SysAdmin EM via Postfix-users
Hi, Is it possible to discard an email based on the Subject and the
destination email address?

I try this and not work:

/^Subject:.*Test email subject .*To:.*m...@me.com/ DISCARD

Any helps?
___
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

2023-04-17 Thread SysAdmin EM via Postfix-users
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

2023-04-14 Thread SysAdmin EM via Postfix-users
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] header_checks not work with regexp

2023-04-14 Thread SysAdmin EM via Postfix-users
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

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

in the configuration see support for regexp:

postconf -m
btree
cidr
environ
fail
hash
internal
memcache
nis
proxy
regexp
sdbm
static
tcp
texthash
unix

postconf mail_version
mail_version = 2.9.6

Is there something wrong with my rule?
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org


[pfx] Re: Sender Caninical Condition

2023-03-10 Thread SysAdmin EM via Postfix-users
I’ve created the next rule but I don’t know if it’s works.

!if !/^(.*)@(domainclient1.com|domainclient2.com|domainclient3.com)$/
nore...@mydomain.com
endif

At the moment there are only domains that have our spf, as there are many
domains that do not have our spf, I want to create a rule to rewrite the
from of all emails but with some exclusions.

Any helps??


On Fri, Mar 10, 2023 at 9:17 AM SysAdmin EM  wrote:

> Good days, request help, is it possible to use conditions in the
> sender_canonical file? we are migrating an entire system and some customers
> do not have our SPF added.
>
> I would like to add a condition for you to rewrite the from when it does
> not match a condition.
>
> Example,
>
> If the from is not domain1.com and domain2.com do a rewrite of the from
> by no-re...@mydomain.com.
>
> Any helps¿??
>
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org


[pfx] Sender Caninical Condition

2023-03-10 Thread SysAdmin EM via Postfix-users
Good days, request help, is it possible to use conditions in the
sender_canonical file? we are migrating an entire system and some customers
do not have our SPF added.

I would like to add a condition for you to rewrite the from when it does
not match a condition.

Example,

If the from is not domain1.com and domain2.com do a rewrite of the from by
no-re...@mydomain.com.

Any helps¿??
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org


[P-U] Correct way to disable sender_canonical

2023-03-08 Thread SysAdmin EM via Postfix-users
I am administering a Postfix that uses sender_canonicals to do a rewrite of
the header from but I need to disable that option.

I have commented the sender_canonical file but when reloading the
configuration I try to send an email and the service fails.

#sender_canonical_maps = regexp:/etc/postfix/sender_canonical
#local_header_rewrite_clients = static:all

I see this:


220 email.domaintest.com ESMTP Postfix
250- email.domaintest.com
250-PIPELINING
250-SIZE 15360
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with .
451 4.7.1 Service unavailable - try again later
221 2.0.0 Bye

this is my config:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 5h
config_directory = /etc/postfix
header_checks = regexp:/etc/postfix/header_checks
inet_interfaces = all
inet_protocols = ipv4
local_header_rewrite_clients = static:all
mailbox_size_limit = 0
maximal_backoff_time = 3h
maximal_queue_lifetime = 5h
message_size_limit = 15360
milter_default_action = accept
milter_protocol = 2
minimal_backoff_time = 15m
mydestination = mail.domaintest.com, localhost.olleros, , localhost
myhostname = email.domaintest.com
mynetworks = 127.0.0.0/8 [:::127.0.0.0]/104 [::1]/128 10.10.0.0/16
192.168.22.0/24 10.1.27.0/24 10.1.120.0/24 10.1.20.0/24 10.1.24
.0/24 172.31.32.0/20 10.54.175.0/24 172.16.0.0/24 10.54.0.0/16
172.31.3.98/32
myorigin = /etc/mailname
non_smtpd_milters = inet:localhost:12345,inet:localhost:54321
queue_run_delay = 300s
readme_directory = no
recipient_delimiter = +
relayhost =
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_milters = inet:localhost:12345,inet:localhost:54321
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_exclude_ciphers = "aNULL"
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_mandatory_ciphers = medium, high
smtpd_tls_mandatory_protocols = TLSv1
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport

The idea is not to rewrite more headers, any help in disabling this?

Regards,
___
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org