Amavis - Wie kann man mit Regex aus einer externen Datei eine schwarze Liste setzen?

1504
CaptSaltyJack

Ich habe derzeit diese Zeile in meiner amavis-Benutzerkonfigurationsdatei:

# BLACKLIST read_hash(\%blacklist_sender, '/etc/amavis/blacklist'); 

Es funktioniert gut mit Einträgen wie:

.baddomain.net .spam-galore.net 

Aber ich frage mich, wie man reguläre Ausdrücke in dieser Datei verwendet. Ich habe folgendes versucht:

qr(\.domain[0-9]\.net) qr'\.domain[0-9]\.net' 

Und keiner hat funktioniert.

1

1 Antwort auf die Frage

0
tschodt

Addresses are converted from quoted form into internal (raw) form

Beim Lesen von
read_hash () werden keine regulären Ausdrücke berücksichtigt.

There is a subroutine read_hash() available for use in amavisd.conf. It can read keys from a plain text file, and load them into a Perl hash. Format of the text file: one address per line, anything from '#' to the end of line is treated as a comment, but '#' within correctly quoted rfc2821 addresses is not treated as a comment (e.g. a hash sign within "strange # \"foo\" address"@example.com is valid). Leading and trailing whitespace is discarded, empty lines (containing only whitespace and comment) are ignored. Addresses are converted from quoted form into internal (raw) form and inserted as keys into a given hash, with a value of 1 (true). Each address can have an associated optional value (also known as the 'righthand side' or RHS) separated from the address by whitespace. An absence of a value implies 1 (true). The $hashref argument is returned for convenience, so that one can say for example: $per_recip_whitelist_sender_lookup_tables = { '.my1.example.com' => read_hash({},'/var/amavis/my1-example-com.wl'), '.my2.example.com' => read_hash({},'/var/amavis/my2-example-com.wl') }

Quelle: http://www.amavis.org/README.lookups.txt

Ich denke, Sie könnten den Code von read_hash () ändern - es ist Perl.

Eigentlich wäre das wahrscheinlich schlecht,
stattdessen auf einen neuen Namen zu klonen, um nichts zu brechen.