Hi Gary,

Is there a way to make restrictions using CIDR notation?

Yes - just replace hash with cidr, like this:

 smtpd_client_restrictions =
   permit_mynetworks
   check_client_access cidr:/etc/postfix/ok_client
   reject

More details: http://www.postfix.org/cidr_table.5.html

Best regards,
Matthias

Am 19.02.2021 21:01, schrieb Gary Aitken:
I had the impression a map could contain client addresses in CIDR
notation, but apparently not.  Is there a way to make restrictions
using CIDR notation?

Here's what I was trying to do:

smtpd_client_restrictions =
  permit_mynetworks
  check_client_access hash:/etc/postfix/ok_client
  reject

/etc/postfix/ok_client:
209.85.128.0/17   OK

$ ls -lt ok_client*
-rw-r--r-- 1 root root 12288 Feb 19 16:35 ok_client.db
-rw-r--r-- 1 root root   700 Feb 19 16:35 ok_client

mail.log:
23551  >>> START Client host RESTRICTIONS <<<
23552  generic_checks: name=permit_mynetworks
23571  check_addr_access: 209.85.217.52
23572  maps_find: hash:/etc/postfix/ok_client: 209.85.217.52: not found
23573  maps_find: hash:/etc/postfix/ok_client: 209.85.217: not found
23574  maps_find: hash:/etc/postfix/ok_client: 209.85: not found
23575  maps_find: hash:/etc/postfix/ok_client: 209: not found

$ postmap -q 209.85.217.52 hash:ok_client
$ postmap -q 209.85 hash:ok_client
$ postmap -q 209.85.128.0 hash:ok_client
$ postmap -q 209.85.128.0/17 hash:ok_client
OK

Gary

Reply via email to