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

Re: virtual-regex problem

Expand Messages
  • Alex
    Apparently I do not understand what you mean by 1-1 mapping. My intentions is to have any email going to: somename(....any character)@somedomain.com to be
    Message 1 of 23 , Feb 14, 2013
      Apparently I do not understand what you mean by 1-1 mapping. My
      intentions is to have any email going to:

      somename(....any character)@... to be forwarded to somename@...

      all other email to be sent to a local user.

      Again thank you for your help.
    • /dev/rob0
      ... All hail JWZ! [1] I d anchor this expression on the beginning, and escape the + : /^somename +.*@example .com$/ some...@gmail.com ... I ll toss out
      Message 2 of 23 , Feb 14, 2013
        On Thu, Feb 14, 2013 at 12:26:34PM -0600, Noel Jones wrote:
        > On 2/14/2013 11:16 AM, Alex wrote:
        > > I am having an issue with setting up virtual-regex email
        > > redirection. It appears that my wild card redirection is
        > > overriding an entry with less specific criteria.
        > >
        > > Here is what I have in my /etc/postfix/virtual-regex
        > >
        > > /somename+.*@.../ <http://somedomain.com/> some...@...
        > > /.*@.*/ somelocaluser
        > >
        > >
        > > Line one is being ignored
        >
        > Line 1 is not ignored, the problem is that wildcards are evil and
        > should be avoided.
        >
        > Virtual alias lookups are recursive, so you'll need a 1-1 mapping
        > to stop the recursion. Also be careful with your expressions so
        > you don't get unintended matches. Something like:
        >
        >
        > /somename+.*@example\.com$/ some...@...

        All hail JWZ! [1] I'd anchor this expression on the beginning, and
        escape the "+":

        /^somename\+.*@example\.com$/ some...@...

        > /^some...@gmail\.com$/ some...@...
        >
        > IF /@example\.com$/
        > /./ somelocaluser@...
        > ENDIF

        I'll toss out another idea, of which JWZ would approve: a hash: map
        followed by a static: map:

        main.cf :

        mydestination = localhost.localdomain[, ...]
        # unset virtual_alias_domains to avoid all domains being included
        # therein by the default setting $virtual_alias_maps
        virtual_alias_domains =
        virtual_alias_maps =
        hash:/path/to/virtual_alias_maps,
        static:somelocaluser@...

        /path/to/virtual_alias_maps :

        somelocaluser@... somelocaluser@...
        some...@... some...@...


        [1] http://en.wikiquote.org/wiki/Jamie_Zawinski#Attributed
        --
        http://rob0.nodns4.us/ -- system administration and consulting
        Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
      • Noel Jones
        ... 1 /^somename.*@example .com$/ somename@yahoo.com 2 /^somename@yahoo .com$/ somename@yahoo.com 3 /./ somelocaluser@localhost.localdomain Line 1 -
        Message 3 of 23 , Feb 14, 2013
          On 2/14/2013 2:23 PM, Alex wrote:
          > Apparently I do not understand what you mean by 1-1 mapping. My
          > intentions is to have any email going to:
          >
          > somename(....any character)@... to be forwarded to somename@...
          >
          > all other email to be sent to a local user.
          >
          > Again thank you for your help.
          >


          1 /^somename.*@example\.com$/ somename@...
          2 /^somename@yahoo\.com$/ somename@...
          3 /./ somelocaluser@...


          Line 1 - redirect secret name to yahoo account
          line 2 - 1-1 mapping to stop recursion, input equals output
          line 3 - wildcard catchall


          Good luck.


          -- Noel Jones
        • Alex
          Hi Noel, ... Wildcard line still catching all emails. Any other information I can provide? Thanks
          Message 4 of 23 , Feb 14, 2013
            Hi Noel,

            After implementing changes below:

            > 1 /^somename.*@example\.com$/ somename@...
            > 2 /^somename@yahoo\.com$/ somename@...
            > 3 /./ somelocaluser@...

            Wildcard line still catching all emails. Any other information I can provide?

            Thanks
          • Noel Jones
            ... The above example works for me. Did you issue postfix reload after editing the regexp file? -- Noel Jones
            Message 5 of 23 , Feb 14, 2013
              On 2/14/2013 4:15 PM, Alex wrote:
              > Hi Noel,
              >
              > After implementing changes below:
              >
              >> 1 /^somename.*@example\.com$/ somename@...
              >> 2 /^somename@yahoo\.com$/ somename@...
              >> 3 /./ somelocaluser@...
              >
              > Wildcard line still catching all emails. Any other information I can provide?
              >
              > Thanks
              >


              The above example works for me. Did you issue "postfix reload"
              after editing the regexp file?



              -- Noel Jones
            • Alex
              ... Yes, I am doing postfix reload, I have verified that adding and removing willdcard has effect. Could aliases file have adverse effect?
              Message 6 of 23 , Feb 14, 2013
                >
                > The above example works for me. Did you issue "postfix reload"
                > after editing the regexp file?


                Yes, I am doing postfix reload, I have verified that adding and
                removing willdcard has effect. Could aliases file have adverse effect?
              • Noel Jones
                ... Lots of things could have adverse effect, but no one knows what you ve done. The sample regexp file provided works for me. -- Noel Jones
                Message 7 of 23 , Feb 14, 2013
                  On 2/14/2013 5:11 PM, Alex wrote:
                  >>
                  >> The above example works for me. Did you issue "postfix reload"
                  >> after editing the regexp file?
                  >
                  >
                  > Yes, I am doing postfix reload, I have verified that adding and
                  > removing willdcard has effect. Could aliases file have adverse effect?
                  >


                  Lots of things could have adverse effect, but no one knows what
                  you've done.

                  The sample regexp file provided works for me.



                  -- Noel Jones
                • Alex
                  I have checked my syntax and added another email matching string. It works only if wild card match is not present. As soon as wildcard is added other matches
                  Message 8 of 23 , Feb 15, 2013

                    I have checked my syntax and added another email matching string. It works only if wild card match is not present. As soon as wildcard is added other matches stop working.  I can see in the maillog that initially regex is happening and then wildcard takes over. Is there anything else I can look at it? Thank you

                  • Noel Jones
                    ... As documented, virtual_alias_maps lookups are recursive, meaning the map is searched repeatedly until either there is no result, or the result is the same
                    Message 9 of 23 , Feb 15, 2013
                      On 2/15/2013 10:34 AM, Alex wrote:
                      > I have checked my syntax and added another email matching string. It
                      > works only if wild card match is not present. As soon as wildcard is
                      > added other matches stop working. I can see in the maillog that
                      > initially regex is happening and then wildcard takes over. Is there
                      > anything else I can look at it? Thank you
                      >

                      As documented, virtual_alias_maps lookups are recursive, meaning the
                      map is searched repeatedly until either there is no result, or the
                      result is the same as the lookup key.

                      To keep the wildcard from grabbing everything (wildcards are evil),
                      your map must have extra entries to "protect" the addresses you
                      don't want grabbed by the wildcard. This is called a 1-1 mapping entry.

                      Your map must be structured similar to:

                      A -> B # rewrite A to B
                      B -> B # 1-1 mapping to protect B from wildcard
                      wildcard # wildcard matches everything

                      Your map is missing the 1-1 mapping entry, so the wildcard matches
                      everything.




                      -- Noel Jones
                    • Alex
                      It seems that regex is indeed working, but something is forcing email into local host instead of outside. This only happens with wildcard in place. Here is an
                      Message 10 of 23 , Feb 15, 2013
                        It seems that regex is indeed working, but something is forcing email
                        into local host instead of outside. This only happens with wildcard in
                        place.

                        Here is an extract from maillog:

                        Feb 15 14:30:54 qa6 postfix/error[9898]: A6EC61F88989:
                        to=<somename@...>, orig_to=<somename@...>, relay=none,
                        delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (User
                        unknown in virtual alias table)
                      • Noel Jones
                        ... Postfix is documented here: http://www.postfix.org/documentation.html -- Noel Jones
                        Message 11 of 23 , Feb 15, 2013
                          On 2/15/2013 4:35 PM, Alex wrote:
                          > It seems that regex is indeed working, but something is forcing email
                          > into local host instead of outside. This only happens with wildcard in
                          > place.
                          >
                          > Here is an extract from maillog:
                          >
                          > Feb 15 14:30:54 qa6 postfix/error[9898]: A6EC61F88989:
                          > to=<somename@...>, orig_to=<somename@...>, relay=none,
                          > delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (User
                          > unknown in virtual alias table)
                          >


                          Postfix is documented here:
                          http://www.postfix.org/documentation.html


                          -- Noel Jones
                        • Alex
                          Hi Noel, Furthermore wildcard seems to have an effect only on email addresses for the parent domain of the postfix host. If I send email to @yahoo and regex
                          Message 12 of 23 , Feb 15, 2013
                            Hi Noel,

                            Furthermore wildcard seems to have an effect only on email addresses
                            for the parent domain of the postfix host.
                            If I send email to @yahoo and regex changes it to @..., this works fine.
                            If I send email to @mydomain regex changes it to wildcard.

                            Does it make sense?
                          • Noel Jones
                            ... I m sure postfix is doing exactly what you ve told it to do. Postfix is documented here: http://www.postfix.org/documentation.html -- Noel Jones
                            Message 13 of 23 , Feb 15, 2013
                              On 2/15/2013 5:25 PM, Alex wrote:
                              > Hi Noel,
                              >
                              > Furthermore wildcard seems to have an effect only on email addresses
                              > for the parent domain of the postfix host.
                              > If I send email to @yahoo and regex changes it to @..., this works fine.
                              > If I send email to @mydomain regex changes it to wildcard.
                              >
                              > Does it make sense?
                              >


                              I'm sure postfix is doing exactly what you've told it to do.

                              Postfix is documented here:
                              http://www.postfix.org/documentation.html



                              -- Noel Jones
                            • Alex
                              No doubt about it. I just wish I can understand how to change it. :) Any ideas?
                              Message 14 of 23 , Feb 15, 2013
                                No doubt about it. I just wish I can understand how to change it. :)
                                Any ideas?
                              • /dev/rob0
                                ... Did you see my post yesterday? Pay close attention to the setting (unsetting, actually) of virtual_alias_domains.
                                Message 15 of 23 , Feb 15, 2013
                                  On Fri, Feb 15, 2013 at 02:35:31PM -0800, Alex wrote:
                                  > It seems that regex is indeed working, but something is forcing
                                  > email into local host instead of outside. This only happens with
                                  > wildcard in place.
                                  >
                                  > Here is an extract from maillog:
                                  >
                                  > Feb 15 14:30:54 qa6 postfix/error[9898]: A6EC61F88989:
                                  > to=<somename@...>, orig_to=<somename@...>, relay=none,
                                  > delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (User
                                  > unknown in virtual alias table)

                                  Did you see my post yesterday? Pay close attention to the setting
                                  (unsetting, actually) of virtual_alias_domains.

                                  http://www.postfix.org/ADDRESS_CLASS_README.html#virtual_alias_class
                                  http://www.postfix.org/VIRTUAL_README.html#virtual_alias
                                  http://www.postfix.org/postconf.5.html#virtual_alias_domains
                                  http://www.postfix.org/postconf.5.html#virtual_alias_maps
                                  --
                                  http://rob0.nodns4.us/ -- system administration and consulting
                                  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
                                • Alex
                                  Solved. One typo. I guess I was staring at the file to long.
                                  Message 16 of 23 , Feb 15, 2013
                                    Solved. One typo. I guess I was staring at the file to long.
                                  Your message has been successfully submitted and would be delivered to recipients shortly.