[9fans] $smtp dns failure - Plan9

This is a discussion on [9fans] $smtp dns failure - Plan9 ; Moin, is there any change in the behavior of /mail/lib/rewrite? I use ([^!]*)!(.*) "/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'" to send email over the local gateway but got crn Jan 15 16:38:27 dns: dns failure (net!$smtp) There is a smtp gateway specified ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: [9fans] $smtp dns failure

  1. [9fans] $smtp dns failure

    Moin,

    is there any change in the behavior of /mail/lib/rewrite? I use

    ([^!]*)!(.*) "/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"

    to send email over the local gateway but got

    crn Jan 15 16:38:27 dns: dns failure (net!$smtp)

    There is a smtp gateway specified in /lib/ndb/local. Do I need to put
    the gateway in rewrite?

    Matthias

  2. Re: [9fans] $smtp dns failure

    hola,

    I have "smtp=smpt.gmail.com" on my profile.

    On 1/15/07, Matthias Teege wrote:
    > Moin,
    >
    > is there any change in the behavior of /mail/lib/rewrite? I use
    >
    > ([^!]*)!(.*) "/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"
    >
    > to send email over the local gateway but got
    >
    > crn Jan 15 16:38:27 dns: dns failure (net!$smtp)
    >
    > There is a smtp gateway specified in /lib/ndb/local. Do I need to put
    > the gateway in rewrite?
    >
    > Matthias
    >



    --
    Federico G. Benavento

  3. Re: [9fans] $smtp dns failure

    What does

    ndb/csquery net!$smtp!smtp

    print?


  4. Re: [9fans] $smtp dns failure

    > I have "smtp=smpt.gmail.com" on my profile.

    Unfortunately, in the context of dial strings,
    there is a difference between the environment
    variable smtp and the network variable smtp.

    Setting the environment variable in your profile
    should not affect /mail/lib/rewrite at all. It is the
    network variable smtp that is named by
    the rewrite rule. For that to work you need to
    have set smtp= in the /lib/ndb entry for your
    host or in the entry for a network containing it.

    > What does
    >
    > ndb/csquery net!$smtp!smtp
    >
    > print?


    For the same reason, you actually want to run
    ndb/csquery 'net!$smtp!smtp'
    (with quotes), so that the shell does not substitute
    the environment variable.

    Russ

  5. Re: [9fans] $smtp dns failure

    On 1/15/07, geoff@plan9.bell-labs.com wrote:
    > ndb/csquery net!$smtp!smtp


    > net!$smtp!smtp

    /net/tcp/clone 192.168.0.22!25

    which looks good for me. I also tried to put the ip in "rewrite" but
    it doesn't help:

    crn Jan 15 19:48:59 dns: dns failure (net!$smtp)
    crn Jan 15 19:48:59 dns: dns failure (net!192.168.0.22)
    crn Jan 15 19:48:59 dns: dns failure (tcp!192.168.0.22)
    crn Jan 15 19:48:59 dns: dns failure (192.168.0.22)
    crn Jan 15 19:48:59 dns: dns failure (net!192.168.0.22!smtp)

    here the csquery output

    > tcp!192.168.0.22!smtp

    /net/tcp/clone 192.168.0.22!25
    > net!192.168.0.22!smtp

    /net/tcp/clone 192.168.0.22!25
    > 192.168.0.22!smtp

    /net/192.168.0.22/clone smtp

    Matthias

  6. Re: [9fans] $smtp dns failure

    re smtp dns problems:

    Hi,

    Debugging smtp: check the exact way upas/smtp is being envoked.
    Look at the end of /sys/mail/runq, here is an example from mine:

    felix Jan 12 19:33:36 steve/C.095795: execing '/mail/lib/remotemail' 'smtp' 'steve' 'net!$smtp' '9fans@cse.psu.edu'

    Then you can try running the remotemail script with rc -x to see
    what it is doing, in my example:

    rc -x '/mail/lib/remotemail' 'smtp' 'steve' 'net!$smtp' '9fans@cse.psu.edu'
    ...
    exec /bin/upas/smtp -g 'net!$smtp' -h quintile.net 'net!$smtp' steve 9fans@cse.psu.edu

    Finally you can exec smtp with the -d option (debug) to see the SMTP conversation,
    and perhaps more importantly the DNS lookups (and failures) that occur.

    ----------------------

    I used to put this in my /mail/lib/remotemail:

    exec /bin/upas/smtp -h $fd $addr $sender $*

    But due to a weird bug in the DNS cache (that I couldn't find even after
    several attempts) mail would fail, so I changed (at Russ's advice) to

    exec /bin/upas/smtp -g $addr -h $fd $addr $sender $*

    and email has worked fine since.

    -Steve

  7. Re: [9fans] $smtp dns failure

    On 1/16/07, Steve Simon wrote:

    > Finally you can exec smtp with the -d option (debug) to see the SMTP conversation,
    > and perhaps more importantly the DNS lookups (and failures) that occur.


    Yes, and it looks like smtp look for an mx record of the smtpserver

    exec /bin/upas/smtp -d -h crn.mteege.de 'net!$smtp' mtg mteege@gmail.com
    expanding /net!$smtp
    sending /net/dns '192.168.0.22 mx'
    dns: dns: dns failure

    There is no mx record for 192.168.0.22. If I use 'mteege.de', which
    has a mx record (192.168.0.22), sending mail works.

    I'm not sure if the behavior of upas/smtp is correct.

    Matthias

  8. Re: [9fans] $smtp dns failure

    > exec /bin/upas/smtp -d -h crn.mteege.de 'net!$smtp' mtg mteege@gmail.com
    > expanding /net!$smtp
    > sending /net/dns '192.168.0.22 mx'
    > dns: dns: dns failure


    > There is no mx record for 192.168.0.22. If I use 'mteege.de', which
    > has a mx record (192.168.0.22), sending mail works.


    Strange, where does it get this IP address from?
    do you have smtp=192.168.0.22 in /lib/ndb/local?

    The smtp= should point to a FQDN rather than an IP address
    to allow upas/smtp to look up the MX and then A RRs.

    I get this:

    exec /bin/upas/smtp -d -g 'net!$smtp' -h quintile.net 'net!$smtp' steve steve.simon@mywork.com
    expanding /net!$smtp
    sending /net/dns 'smtp.myisp.com mx'
    dns: dns: resource does not exist
    mxdial trying /net/net!smtp.myisp.com!smtp
    220 ESMTP server ready

    -Steve

  9. Re: [9fans] $smtp dns failure

    there is an interesting case with mxlookup1() in mxdial.c.
    if a dns /failure/ is reported for the mx lookup, then mxdial doesn't
    try a/cname records. i've had trouble in the past with mx failures when the
    a record looks up just fine. i'm not sure if the standard says one must quit
    on dns failure.

    - erik

    On Tue Jan 16 13:25:49 EST 2007, steve@quintile.net wrote:
    > > exec /bin/upas/smtp -d -h crn.mteege.de 'net!$smtp' mtg mteege@gmail.com
    > > expanding /net!$smtp
    > > sending /net/dns '192.168.0.22 mx'
    > > dns: dns: dns failure

    >
    > > There is no mx record for 192.168.0.22. If I use 'mteege.de', which
    > > has a mx record (192.168.0.22), sending mail works.

    >
    > Strange, where does it get this IP address from?
    > do you have smtp=192.168.0.22 in /lib/ndb/local?
    >
    > The smtp= should point to a FQDN rather than an IP address
    > to allow upas/smtp to look up the MX and then A RRs.
    >
    > I get this:
    >
    > exec /bin/upas/smtp -d -g 'net!$smtp' -h quintile.net 'net!$smtp' steve steve.simon@mywork.com
    > expanding /net!$smtp
    > sending /net/dns 'smtp.myisp.com mx'
    > dns: dns: resource does not exist
    > mxdial trying /net/net!smtp.myisp.com!smtp
    > 220 ESMTP server ready
    >
    > -Steve


  10. Re: [9fans] $smtp dns failure

    > there is an interesting case with mxlookup1() in mxdial.c.
    > if a dns /failure/ is reported for the mx lookup, then mxdial doesn't
    > try a/cname records. i've had trouble in the past with mx failures when the
    > a record looks up just fine. i'm not sure if the standard says one must quit
    > on dns failure.


    if there is a dns failure, the logic there is that since the
    mx could not be determined due to some transient dns error,
    we are not going to blindly try the underlying host name,
    because that is likely to be wrong. i am sure that i put this
    in because of actual problems.

    the real problem is that smtp is doing a dns lookup on 192.168.0.22,
    which ndb/dns interprets as a request for a reverse lookup
    (that is, it looks up 22.0.168.192.in-addr.arpa), which fails.
    mxlookup should probably check whether ds->host is a
    valid ip address all by itself, and then return 0 if so, rather
    than ask dns anything at all. unfortunately i don't think there
    is a library routine that will tell us whether a string is a valid
    ip address. parseip doesn't.

    russ

  11. Re: [9fans] $smtp dns failure

    §5 of rfc 2821 spells out how to do the lookup. smtpd should do that.
    if there are any huristics to apply while running the lookup, it
    would make sense to me to do as sendmail/postifix/qmail do.
    smtp is an interface to the world. being different isn't a virtue
    in this case.

    - erik

    On Tue Jan 16 13:46:09 EST 2007, rsc@swtch.com wrote:
    > > there is an interesting case with mxlookup1() in mxdial.c.
    > > if a dns /failure/ is reported for the mx lookup, then mxdial doesn't
    > > try a/cname records. i've had trouble in the past with mx failures when the
    > > a record looks up just fine. i'm not sure if the standard says one must quit
    > > on dns failure.

    >
    > if there is a dns failure, the logic there is that since the
    > mx could not be determined due to some transient dns error,
    > we are not going to blindly try the underlying host name,
    > because that is likely to be wrong. i am sure that i put this
    > in because of actual problems.
    >
    > the real problem is that smtp is doing a dns lookup on 192.168.0.22,
    > which ndb/dns interprets as a request for a reverse lookup
    > (that is, it looks up 22.0.168.192.in-addr.arpa), which fails.
    > mxlookup should probably check whether ds->host is a
    > valid ip address all by itself, and then return 0 if so, rather
    > than ask dns anything at all. unfortunately i don't think there
    > is a library routine that will tell us whether a string is a valid
    > ip address. parseip doesn't.
    >
    > russ


  12. Re: [9fans] $smtp dns failure


  13. Re: [9fans] $smtp dns failure

    > 5 of rfc 2821 spells out how to do the lookup. smtpd should do that.
    > if there are any huristics to apply while running the lookup, it
    > would make sense to me to do as sendmail/postifix/qmail do.
    > smtp is an interface to the world. being different isn't a virtue
    > in this case.


    Until you explain precisely which part of rfc 2821 you claim that
    smtp.c does not follow and which part of smtp.c is not following it,
    I don't see a point to continuing this conversation.

    The particular case that I was talking about is when dns returns
    "dns: dns failure", meaning that looking up the MX record produced
    an error (like maybe the DNS server choked on the request),
    not that the lookup returned "there are no MX records".
    My reading of the RFC is that it does not cover this case.

    Russ

+ Reply to Thread