Loading ...
Sorry, an error occurred while loading the content.

268654Re: Regexp for blocking dynamic hosts?

Expand Messages
  • pf at alt-ctrl-del.org
    Aug 31, 2010
    • 0 Attachment
      On 2010-08-31 4:45 PM, Charles Marcus wrote:
      >
      > Yep, in that it shows why I really should read all of a post before
      > asking questions about it.
      >
      > I was only looking at the one example line you included in the body - I
      > neglected the last part about the *file* to download that contained all
      > of the expressions... ;)
      >

      I don't use this... I just combined several regexp lines into two long lines
      as generic examples.
      I'm sure that it can be done more efficiently, and that using this "as is"
      may lead to false positives.

      # guess at some .cc residential connections
      /(\.|-)static(\.|-)/ DUNNO
      #
      /^.*[0-9]+(\.|-)[0-9]+(\.|-)[0-9]+(\.|-)[0-9]+(\.|-)(.?dsl|dyn(amic|-ip|ip)?|ppp(oe|ool)?|pools?|cable|dhcp|res)\..*\.[a-z][a-z]$/
      550 cc1 residential IP addresses prohibited
      #
      /^.*[0-9]+(\.|-)[0-9]+(\.|-)[0-9]+(\.|-)[0-9]+.*(\.(.?dsl|dyn(amic|-ip|ip)?|ppp(oe|ool)?|pools?|cable|dhcp|res)\.).*\.[a-z][a-z]$/
      550 cc2 residential IP addresses prohibited
      #

      Test cc1 matches
      postmap -q 200-161-108-143.dsl.telesp.net.br regexp:/etc/postfix/filename
      postmap -q 200-161-108-143.adsl.any.name.cc regexp:/etc/postfix/filename
      postmap -q 200.161.108.143.cable.any.cc regexp:/etc/postfix/filename
      postmap -q mm-200-161-108-143-dynip.any.mgts.xx regexp:/etc/postfix/filename

      Test cc2 matches
      postmap -q 200.161.108.143.spacer.labels.cable.any.cc
      regexp:/etc/postfix/filename
      postmap -q 200-161-108-143.spacer.labels.dynamic.any.cc
      regexp:/etc/postfix/filename

      Test non match
      postmap -q pools.cc regexp:/etc/postfix/filename
      postmap -q 123.dynamic.data.pools.any.cc regexp:/etc/postfix/filename

      To add more label matches, just add more | options.
      Like:
      cpe|cust|broadband|user|anything|else
    • Show all 19 messages in this topic