RE: [Exim] host_reject_recipients leaking a few subnets

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Bernard Stern
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: RE: [Exim] host_reject_recipients leaking a few subnets
On Tue, 25 Sep 2001 14:50:50 -0400 (EDT) "Dave C." wrote:

Hello,

> I'm not sure if this has been discussed before or not, but, in exim 4
> will there be a way to have a file containing network specifications
> with varying bitmask legnths in it (possibly some negated), that one
> will be able to do a lookup in with a single IP address as the key?


That would be really really great. I have done something similar
using the embedded perl facilities, also including domains (possibly
wildcarded, negated). The problem I ran into was the sorting (considering
that it was too risky to put the manually edited file into the live
configuration for different reasons). What should match first?
(mmmhh... I had to match the $sender_host_address or $sender_host_name
variables against one item of such a list:

# exim filter

(...)

if ${perl{check_sender_mta}{$sender_host_address}{$sender_host_name}} is "1" then

    (...)


    if ${perl{check_quota}{SMS}{$sender_host_address}{$sender_host_name}} is "1" then


    (...)


In my implementation, I sorted the manually edited file
- network blocks before domains
- for network blocks
- most specific first (ie 1.2.3.0/24 before 1.2.0.0/16)
- for domains
- most specific first (ie foo.bar.com before bar.com)
- wildcarded after unwildcarded (ie bar.com before *.bar.com)

At least this seemed logical to me. Maybe there are other
situations in which this logic would not apply.

Mmmmhhh... let's see... I have an example file I can reproduce
here (just ignore the comments and the FAX, SMS etc stuff;
there is also an illegal network block!)
You could try to sort it by hand with your logic. The result
of my sorting is appended at the end of this mail.

# this is an example of a raw data file

KEYS = PAGER SMS FAX

# D=zz.ch
# B=mylos.ch
*.zz.ch PAGER:10:1h SMS:100:1d FAX:70:1w
*.c.zz.ch
!*.b.c.zz.ch
!c.zz.ch
b.c.zz.ch SMS:10:1d
t.c.zz.ch
*.p.c.zz.ch SMS:1:1m
a.b.c.zz.ch FAX:222:1w2d4h8s
!zz.ch
p.c.zz.ch SMS:10:1h

# D=tatat.ch
# B=mylos.ch
1.2.4.0/24 FAX:2:1m
1.2.5.0/24
1.2.5.0/24
!1.2.3.4/32
!1.2.0.0/16
!1.2.5.192/27
!1.2.5.208/27
1.2.3.12/32

(...)


Bernard Stern, SWITCH

____________S_W_I_T_CH___Swiss Academic_______________________________________
        mail: SWITCH Head Office       a          Tel: +41 1 268 1520
              Limmatquai 138           n          Fax: +41 1 268 1568
              CH-8001 Zurich           d        e-mail: stern@???
________________________________________Reseach Network_______________________



my sorting:


########################################################################
# THIS FILE AUTOMATICALLY GENERATED -- THIS FILE AUTOMATICALLY GENERATED
########################################################################

# KEYS = FAX PAGER SMS


# network blocks
#-----------------------------------------------------------------------
!1.2.3.4/32     FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
1.2.3.12/32     FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
!1.2.5.192/27   FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
1.2.4.0/24      FAX=2:60        PAGER=-1:-1     SMS=-1:-1
1.2.5.0/24      FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
1.2.5.0/24      FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
!1.2.0.0/16     FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1


# domains
#-----------------------------------------------------------------------
a.b.c.zz.ch     FAX=222:792008  PAGER=-1:-1     SMS=-1:-1
b.c.zz.ch       FAX=-1:-1       PAGER=-1:-1     SMS=10:86400
!*.b.c.zz.ch    FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
p.c.zz.ch       FAX=-1:-1       PAGER=-1:-1     SMS=10:3600
*.p.c.zz.ch     FAX=-1:-1       PAGER=-1:-1     SMS=1:60
t.c.zz.ch       FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
!c.zz.ch        FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
*.c.zz.ch       FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
!zz.ch  FAX=-1:-1       PAGER=-1:-1     SMS=-1:-1
*.zz.ch FAX=70:604800   PAGER=10:3600   SMS=100:86400