Catch-All, please

Help
sburina
2011-02-22
2013-04-24
  • sburina
    sburina
    2011-02-22

    Hello!

    Please excuse my potential ignorance, but I was unable to help myself..

    I'd like to migrate several mail servers with Cyrus virtual domains from RTcyrus v2 to v3. Could you please tell me how to configure a catch-all entry for a virtual domain?

    In v2 I have an entry in mailertable for each domain like this:

    mrs_cyrus_mailertable:local:ca_domain.com

    .. and then, in aliases file:

    ca_domain.com:    catchall@domain.com (or anything else on user's request)

    Thank you!

     
  • Andrzej Filip
    Andrzej Filip
    2011-02-22

    Do you want it for
    a) all cyrus virtual domains
    b) some cyrus vrtual domains

    P.S. Why do you need it? I specifically designed RTCyrus3 to reject messages to non existing mailboxes in SMTP session.

     
  • sburina
    sburina
    2011-02-22

    Hello anfi, and thanks for being here often. :)

    I need it for b) some cyrus virtual domains.

    Catch-all is a well known feature in our environment, configured by default for every newly created domain, although some customers want it off after some time. However, majority wants to "take a peek" from time to time, just to make sure they haven't missed something important.

    So, I simple can't afford not having the ability to offier catch-all acocunts.

    Thank you!

     
  • Andrzej Filip
    Andrzej Filip
    2011-02-23

    OK - I hope I will do it over weekend.
    As I understand you would like to turn on/off per domain catch-all without restarting sendmail daemon, would not you?

    P.S. It would be very simple but keeping it simple is very complicated :-)

     
  • sburina
    sburina
    2011-02-23

    Hello!

    It would be great if sendmail daemon wouldn't requre a restart for that purpose. But, at least in my case, it's much more important to have a complete rtcyrysv3-based solution which allows the system administrator (me) to happily continue bragging around about the lack of impossible things to achieve on the server (even if this requires several sendmail restarts per virtual domain). :)

    Yes, I understand, the fool-proof simplicity is the most complicated thing to provide. :)

    I wish you a joyful weekend! :-)

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-01

    I have added the change to CVS.
    Vesion 1.2 of  feature anfi/vcyrus adds support for VCYRUS_LUSER_RELAY - relay for emails in cyrus virtual domains without cyrus mailboxes.
    Feature anfi/mrs_vcyrus_lr adds lookups for user@ and @domain in cyruslr map and treats replies as mailertable replies.

    It should allow you to add per cyrus virtual domain "luser relay" and special relays missing postmaster and abuse.

    Usage:
    *.mc file:
    define(`VCYRUS_LUSER_RELAY',`mrs_vcyrus_lr)dnl
    FEATURE(`anfi/mrs_vcyrus_lr')dnl
    FEATURE(`anfi/vcyrus')dnl

    cyruslr file:
    postmaster@   local:postmaster
    abuse@ local:abuse
    @example.net  local:example-net-catch-all

    P.S. I have found some time to create initial version but I had no time to test it.
    (I no longer use cyrus-imap and rtcyrus myself).

     
  • sburina
    sburina
    2011-03-02

    Thank you, anfi, I'll give it a try immediately! :)

     
  • sburina
    sburina
    2011-03-02

    You have missed one apostrophe in the following line:
            define(`VCYRUS_LUSER_RELAY',`mrs_vcyrus_lr)dnl

    It should read:
            define(`VCYRUS_LUSER_RELAY',`mrs_vcyrus_lr')dnl

    Just a note for other readers, to avoid m4 errors.. :)

    Unfortunately, cyruslr doesn't work (yet) here. Maybe I'm missing sometghing. Here's my addition to sendmail.mc:

    LOCAL_CONFIG
    F{VCyrusDomains}/etc/mail/cyrus-domains
    divert(-1)dnl
    define(`SMMAP_SOCKET',`/var/lib/imap/socket/smmapd')dnl
    define(`CYRUS_LMTP_SOCKET',`/var/lib/imap/socket/lmtp')dnl
    define(`VCYRUS_LUSER_RELAY',`mrs_vcyrus_lr')dnl
    FEATURE(`anfi/mrs')dnl
    FEATURE(`anfi/mrs_vcyrus_lr')dnl
    FEATURE(`anfi/vcyrus')dnl
    MAILER(anfi/cyrusv3)dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl

    (I had to add standard mailers after FEATUREs).

    /etc/mail/cyrus-domains:
    test.com

    /etc/mail/cyruslr (hashed into cyruslr.db):
    @test.com local:root

    There's one cyrus mailbox (virtual domains on): six@test.com

    And here we go:

    # sendmail -bv six@test.com
    six@test.com… deliverable: mailer cyrusv3d, user six@test.com
    # sendmail -bv test@test.com
    test@test.com… User unknown.

    Any idea?

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-02

    I have fallen into "deceptive simplicity" trap myself (again).
    There was missing ":" in the line below:

    define(`VCYRUS_LUSER_RELAY',`mrs_vcyrus_lr:')dnl

    You can use the command below for initial tests:
    echo '5 six@test.com' | sendmail  -C sendmail-test.cf -bt -d21.12 -d60.5

    Hope that helps.

     
  • sburina
    sburina
    2011-03-02

    It works with an existing mailbox, but not for non-existant ones:

    # echo '5 test@test.com' | sendmail -C sendmail.cf -bt -d21.12 -d60.5
    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > localaddr          input: test @ test . com
    ---trying rule: $+
    ---rule matches: $: $1 $| $> "Local_localaddr" $1
    Local_localaddr    input: test @ test . com
    ---trying rule: $+ @ $={VCyrusDomains}
    ---rule matches: $: $1 @ $2 $| $( cyrus $1 @ $2 $: $)
    map_lookup(cyrus, test@test.com, %0=test@test.com) => NOT FOUND (68)
    rewritten as: test @ test . com $|
    ---trying rule: $+ @ $+ $| $* < TMPF >
    --- rule fails
    ---trying rule: $+ @ $+ $| $+
    --- rule fails
    ---trying rule: $+ @ + $| $*
    --- rule fails
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    Local_localaddr  returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: test @ test . com $| $# error $@ 5 . 1 . 1 $: "550 User unknown."
    ---trying rule: $+ $| $# ok
    --- rule fails
    ---trying rule: $+ $| $# $*
    ---rule matches: $# $2
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    localaddr        returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-02

    I have commited version 1.3 of feature/anfi/vcyrus

     
  • sburina
    sburina
    2011-03-02

    Drooling at it already.. :)

     
  • sburina
    sburina
    2011-03-02

    Got a bit more lines of output, but the same final result:

    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > localaddr          input: test @ test . com
    ---trying rule: $+
    ---rule matches: $: $1 $| $> "Local_localaddr" $1
    Local_localaddr    input: test @ test . com
    ---trying rule: $+ @ $={VCyrusDomains}
    ---rule matches: $: $1 @ $2 $| $( cyrus $1 @ $2 $: $)
    map_lookup(cyrus, test@test.com, %0=test@test.com) => NOT FOUND (68)
    rewritten as: test @ test . com $|
    ---trying rule: $+ @ $+ $| $* < TMPF >
    --- rule fails
    ---trying rule: $+ @ $+ $| $+
    --- rule fails
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $: $1 @ $2 $| $> MailerToTriple < mrs_vcyrus_lr > $1 < $2 >
    MailerToTriple     input: < mrs_vcyrus_lr > test < test . com >
    ---trying rule: < > $*
    --- rule fails
    ---trying rule: < error : $- . $- . $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $+ > $*
    --- rule fails
    ---trying rule: < local : $* > $*
    --- rule fails
    ---trying rule: < $~[ : $+ @ $+ > $* < $* > $*
    --- rule fails
    ---trying rule: < $~[ : $+ > $*
    --- rule fails
    ---trying rule: < $=w > $*
    --- rule fails
    ---trying rule: < $+ > $*
    ---rule matches: $# relay $@ $1 $: $2
    rewritten as: $# relay $@ mrs_vcyrus_lr $: test < test . com >
    MailerToTriple   returns: $# relay $@ mrs_vcyrus_lr $: test < test . com >
    rewritten as: test @ test . com $| $# relay $@ mrs_vcyrus_lr $: test < test . com >
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    Local_localaddr  returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: test @ test . com $| $# error $@ 5 . 1 . 1 $: "550 User unknown."
    ---trying rule: $+ $| $# ok
    --- rule fails
    ---trying rule: $+ $| $# $*
    ---rule matches: $# $2
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    localaddr        returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."

    Can I provide you with testing environment? I've set up a virtual machine just for this purpose in my LAN, so please just let me know if you can make any use of it.

     
  • sburina
    sburina
    2011-03-02

    I also tried with ":" as you suggested earlier, with the same result.

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-02

    FEATURE(anfi/mrs) requires patching cf/m4/proto.m4 file (no need to recompile sendmail binaries).
    You have not applied mrs-relay.patch, have you?

     
  • sburina
    sburina
    2011-03-02

    You are right, I've applied just local-domain-routing.patch (as stated in INSTALL.rtcyrus3 file).
    Did it now. Regenerated sendmail.cf, but I still get "user unknown", with juast slightly different output:

    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > localaddr          input: test @ test . com
    ---trying rule: $+
    ---rule matches: $: $1 $| $> "Local_localaddr" $1
    Local_localaddr    input: test @ test . com
    ---trying rule: $+ @ $={VCyrusDomains}
    ---rule matches: $: $1 @ $2 $| $( cyrus $1 @ $2 $: $)
    map_lookup(cyrus, test@test.com, %0=test@test.com) => NOT FOUND (68)
    rewritten as: test @ test . com $|
    ---trying rule: $+ @ $+ $| $* < TMPF >
    --- rule fails
    ---trying rule: $+ @ $+ $| $+
    --- rule fails
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $: $1 @ $2 $| $> MailerToTriple < mrs_vcyrus_lr : > $1 < $2 >
    MailerToTriple     input: < mrs_vcyrus_lr : > test < test . com >
    ---trying rule: < > $*
    --- rule fails
    ---trying rule: < error : $- . $- . $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $+ > $*
    --- rule fails
    ---trying rule: < local : $* > $*
    --- rule fails
    ---trying rule: < $={MRS} : $* > $*
    ---rule matches: $@ $> $1 < $2 > $3
    mrs_vcyrus_lr      input: < > test < test . com >
    ---trying rule: < $* > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $+ > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $+ > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $+ < @ $+ >
    --- rule fails
    mrs_vcyrus_lr    returns: < > test < test . com >
    rewritten as: < > test < test . com >
    MailerToTriple   returns: < > test < test . com >
    rewritten as: test @ test . com $| < > test < test . com >
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    Local_localaddr  returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: test @ test . com $| $# error $@ 5 . 1 . 1 $: "550 User unknown."
    ---trying rule: $+ $| $# ok
    --- rule fails
    ---trying rule: $+ $| $# $*
    ---rule matches: $# $2
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    localaddr        returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-02

    I have committed next version of anfi/vcyrus

     
  • sburina
    sburina
    2011-03-02

    Looking forward to the next one! :)

    # echo '5 test@test.com' | sendmail -C sendmail.cf -bt -d21.12 -d60.5
    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > localaddr          input: test @ test . com
    ---trying rule: $+
    ---rule matches: $: $1 $| $> "Local_localaddr" $1
    Local_localaddr    input: test @ test . com
    ---trying rule: $+ @ $={VCyrusDomains}
    ---rule matches: $: $1 @ $2 $| $( cyrus $1 @ $2 $: $)
    map_lookup(cyrus, test@test.com, %0=test@test.com) => NOT FOUND (68)
    rewritten as: test @ test . com $|
    ---trying rule: $+ @ $+ $| $* < TMPF >
    --- rule fails
    ---trying rule: $+ @ $+ $| $+
    --- rule fails
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $: $1 @ $2 $| $> MailerToTriple < mrs_vcyrus_lr : > $1 < @ $2 >
    MailerToTriple     input: < mrs_vcyrus_lr : > test < @ test . com >
    ---trying rule: < > $*
    --- rule fails
    ---trying rule: < error : $- . $- . $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $+ > $*
    --- rule fails
    ---trying rule: < local : $* > $*
    --- rule fails
    ---trying rule: < $={MRS} : $* > $*
    ---rule matches: $@ $> $1 < $2 > $3
    mrs_vcyrus_lr      input: < > test < @ test . com >
    ---trying rule: < $* > $+ < @ $+ >
    ---rule matches: $: < $( cyruslr $2 @ $: $) > $2 < @ $3 >
    hash map "cyruslr": missing map file /etc/mail/smarttable.db: No such file or directory
    map_lookup(cyruslr, test@, %0=test@) => NOT FOUND (75)
    map_lookup(cyruslr, test@) tempfail: errno=0
    rewritten as: < > test < @ test . com >
    ---trying rule: < $+ > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $+ < @ $+ >
    ---rule matches: $: < $( cyruslr @ $3 $: $) > $2 < @ $3 >
    map_lookup(cyruslr, @test.com, %0=@test.com) => NOT FOUND (75)
    map_lookup(cyruslr, @test.com) tempfail: errno=0
    rewritten as: < > test < @ test . com >
    ---trying rule: < $+ > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $+ < @ $+ >
    ---rule matches: $: $2 < @ $3 >
    rewritten as: test < @ test . com >
    mrs_vcyrus_lr    returns: test < @ test . com >
    rewritten as: test < @ test . com >
    MailerToTriple   returns: test < @ test . com >
    rewritten as: test @ test . com $| test < @ test . com >
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    Local_localaddr  returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: test @ test . com $| $# error $@ 5 . 1 . 1 $: "550 User unknown."
    ---trying rule: $+ $| $# ok
    --- rule fails
    ---trying rule: $+ $| $# $*
    ---rule matches: $# $2
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    localaddr        returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    == Ruleset 5 (5) status 75

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-03

    I have committed next version of mrs_vcyrus_lr

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-03

    Extra info regarding previous post:
    I have fixed wrong name of map file in mrs_vcyrus_lr
    but cyruslr (text) file requires compilation with makemap anyway.

     
  • sburina
    sburina
    2011-03-04

    Hello, anfi!

    Somehing is going on, but we're not quite there yet:

    # echo '5 test@test.com' | sendmail -C sendmail.cf -bt -d21.12 -d60.5
    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > localaddr          input: test @ test . com
    ---trying rule: $+
    ---rule matches: $: $1 $| $> "Local_localaddr" $1
    Local_localaddr    input: test @ test . com
    ---trying rule: $+ @ $={VCyrusDomains}
    ---rule matches: $: $1 @ $2 $| $( cyrus $1 @ $2 $: $)
    map_lookup(cyrus, test@test.com, %0=test@test.com) => NOT FOUND (68)
    rewritten as: test @ test . com $|
    ---trying rule: $+ @ $+ $| $* < TMPF >
    --- rule fails
    ---trying rule: $+ @ $+ $| $+
    --- rule fails
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $: $1 @ $2 $| $> MailerToTriple < mrs_vcyrus_lr : > $1 < @ $2 >
    MailerToTriple     input: < mrs_vcyrus_lr : > test < @ test . com >
    ---trying rule: < > $*
    --- rule fails
    ---trying rule: < error : $- . $- . $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $+ > $*
    --- rule fails
    ---trying rule: < local : $* > $*
    --- rule fails
    ---trying rule: < $={MRS} : $* > $*
    ---rule matches: $@ $> $1 < $2 > $3
    mrs_vcyrus_lr      input: < > test < @ test . com >
    ---trying rule: < $* > $+ < @ $+ >
    ---rule matches: $: < $( cyruslr $2 @ $: $) > $2 < @ $3 >
    map_lookup(cyruslr, test@, %0=test@) => NOT FOUND (0)
    rewritten as: < > test < @ test . com >
    ---trying rule: < $+ > $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $+ < @ $+ >
    ---rule matches: $: < $( cyruslr @ $3 $: $) > $2 < @ $3 >
    map_lookup(cyruslr, @test.com, %0=@test.com) => local:root (0)
    rewritten as: < local : root > test < @ test . com >
    ---trying rule: < $+ > $+ < @ $+ >
    ---rule matches: $@ $> MailerToTriple < $1 > $2 < $3 >
    MailerToTriple     input: < local : root > test < test . com >
    ---trying rule: < > $*
    --- rule fails
    ---trying rule: < error : $- . $- . $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $- : $+ > $*
    --- rule fails
    ---trying rule: < error : $+ > $*
    --- rule fails
    ---trying rule: < local : $* > $*
    ---rule matches: $> CanonLocal < $1 > $2
    CanonLocal         input: < root > test < test . com >
    ---trying rule: < $* > < @ $+ > : $+
    --- rule fails
    ---trying rule: < $* > $+ $=O $+ < @ $+ >
    --- rule fails
    ---trying rule: < $* > $* < @ $* . >
    --- rule fails
    ---trying rule: < > $* < @ $* > $*
    --- rule fails
    ---trying rule: < > $+
    --- rule fails
    ---trying rule: < $+ @ $+ > $* < @ $* >
    --- rule fails
    ---trying rule: < $+ > $* < @ $* > $*
    --- rule fails
    ---trying rule: < $+ > $*
    ---rule matches: $# local $@ $2 $: $1
    rewritten as: $# local $@ test < test . com > $: root
    CanonLocal       returns: $# local $@ test < test . com > $: root
    rewritten as: $# local $@ test < test . com > $: root
    MailerToTriple   returns: $# local $@ test < test . com > $: root
    rewritten as: $# local $@ test < test . com > $: root
    mrs_vcyrus_lr    returns: $# local $@ test < test . com > $: root
    rewritten as: $# local $@ test < test . com > $: root
    MailerToTriple   returns: $# local $@ test < test . com > $: root
    rewritten as: test @ test . com $| $# local $@ test < test . com > $: root
    ---trying rule: $+ @ $+ $| $*
    ---rule matches: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    Local_localaddr  returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    rewritten as: test @ test . com $| $# error $@ 5 . 1 . 1 $: "550 User unknown."
    ---trying rule: $+ $| $# ok
    --- rule fails
    ---trying rule: $+ $| $# $*
    ---rule matches: $# $2
    rewritten as: $# error $@ 5 . 1 . 1 $: "550 User unknown."
    localaddr        returns: $# error $@ 5 . 1 . 1 $: "550 User unknown."

     
  • Andrzej Filip
    Andrzej Filip
    2011-03-04

    I have committed next version of vcyrus.
    I hope it is going to be the last bug fix :-)

     
  • sburina
    sburina
    2011-03-04

    Yes! Successfully delivered! :)

    Just for the record - cyruslr entry can have the full email address (virtual mailbox name) in RHS:

    /etc/mail/cyruslr:
    @test.com       local:six@test.com

    A note regarding automatic mailbox and sieve scripts creation:

    imapd.conf option "createonpost" can't be implemented directly in this scenario, since smmap lookup will return "User unknown" and the message will be rejected.
    The mailbox in question could be created manually, but unfortunately this disables all "autocreate*" options for folders and sieve scripts. If implementation of "autocreate*" options is needed, one should not manually create the mailbox, but rather perform an initial POP3/IMAP login immediately after adding user credentials in preferred authentication mechanism. First successful login will trigger automatic creation of the mailbox/scripts, allowing the mail delivery.

    Thank you very much for this, anfi! :)