OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Postfix Archives: PATCH: skip_5xx_greeting (was: selecting MX r

PATCH: skip_5xx_greeting (was: selecting MX record)


Subject: PATCH: skip_5xx_greeting (was: selecting MX record)
From: Wietse Venema (wietseporcupine.org)
Date: Tue Jan 04 2000 - 09:34:53 CST


So, if the primary MX host rejects the connection with 5xx, Sendmail
simply ignores it and skip to the next one? How bizarre.

Well, Postfix already has a switch to ignore 4xx greetings, so it
is not too difficult to copy that code and change 4 into 5.

I'll add this and the skip-4xx switch to the sendmail compatibility
entries in the FAQ.

Not that I would recommend turning it on, but you never know.

        Wietse

*** ./global/mail_params.h- Mon Dec 27 14:17:32 1999
--- ./global/mail_params.h Tue Jan 4 10:26:11 2000
***************
*** 576,581 ****
--- 576,585 ----
  #define DEF_SMTP_SKIP_4XX 0
  extern bool var_smtp_skip_4xx_greeting;
  
+ #define VAR_SMTP_SKIP_5XX "smtp_skip_5xx_greeting"
+ #define DEF_SMTP_SKIP_5XX 0
+ extern bool var_smtp_skip_5xx_greeting;
+
  #define VAR_IGN_MX_LOOKUP_ERR "ignore_mx_lookup_error"
  #define DEF_IGN_MX_LOOKUP_ERR 0
  extern bool var_ign_mx_lookup_err;
*** ./smtp/smtp_connect.c- Thu Nov 18 21:52:57 1999
--- ./smtp/smtp_connect.c Tue Jan 4 10:24:55 2000
***************
*** 227,232 ****
--- 227,243 ----
          vstream_fclose(stream);
          return (0);
      }
+
+ /*
+ * Skip this host if it sends a 5xx greeting.
+ */
+ if (ch == '5' && var_smtp_skip_5xx_greeting) {
+ vstring_sprintf(why, "connect to %s[%s]: server refused mail service",
+ addr->name, inet_ntoa(sin.sin_addr));
+ smtp_errno = SMTP_RETRY;
+ vstream_fclose(stream);
+ return (0);
+ }
      vstream_ungetc(stream, ch);
      return (smtp_session_alloc(stream, addr->name, inet_ntoa(sin.sin_addr)));
  }
*** ./smtp/smtp.c- Sat Sep 4 17:41:53 1999
--- ./smtp/smtp.c Tue Jan 4 10:25:30 2000
***************
*** 87,92 ****
--- 87,94 ----
  /* postmaster with transcripts of SMTP sessions with protocol errors.
  /* .IP \fBsmtp_skip_4xx_greeting\fR
  /* Skip servers that greet us with a 4xx status code.
+ /* .IP \fBsmtp_skip_5xx_greeting\fR
+ /* Skip servers that greet us with a 5xx status code.
  /* .IP \fBsmtp_skip_quit_response\fR
  /* Do not wait for the server response after sending QUIT.
  /* .SH "Resource controls"
***************
*** 199,204 ****
--- 201,207 ----
  int var_debug_peer_level;
  char *var_notify_classes;
  int var_smtp_skip_4xx_greeting;
+ int var_smtp_skip_5xx_greeting;
  int var_ign_mx_lookup_err;
  int var_skip_quit_resp;
  char *var_fallback_relay;
***************
*** 350,355 ****
--- 353,359 ----
      };
      static CONFIG_BOOL_TABLE bool_table[] = {
          VAR_SMTP_SKIP_4XX, DEF_SMTP_SKIP_4XX, &var_smtp_skip_4xx_greeting,
+ VAR_SMTP_SKIP_5XX, DEF_SMTP_SKIP_5XX, &var_smtp_skip_5xx_greeting,
          VAR_IGN_MX_LOOKUP_ERR, DEF_IGN_MX_LOOKUP_ERR, &var_ign_mx_lookup_err,
          VAR_SKIP_QUIT_RESP, DEF_SKIP_QUIT_RESP, &var_skip_quit_resp,
          0,

Geoff Gibbs:
> I have a problem where Postfix appears to be behaving differently from
> sendmail, in that it appears to select a different MX record to use.
>
> I think Postfix is behaving correctly, but sendmail is actually delivering
> the mail !
>
> On our site, sendmail is still handling ordinary e-mail, while Postfix
> is being used to send out to our mailing lists. In syslog I can see
> two entries to the same address, one succeeds and one fails :-
>
> Jan 4 14:04:20 mercury sendmail[25848]: OAA25843: to=FB7A070nw01.rrz.uni-hamburg.de.filtered, ctladdr=ggibbshgmp.mrc.ac.uk (5042/5000), delay=00:02:48,
> xdelay=00:02:48, mailer=esmtp, relay=rzaixsrv2.rrz.uni-hamburg.de. [134.100.32.12], stat=Sent (PAA40118 Message accepted for delivery)
> Jan 4 14:04:21 mercury postfix/smtp[23478]: BE78717A63: to=<FB7A070nw01.rrz.uni-hamburg.de>, relay=nw01.rrz.uni-hamburg.de[134.100.1.50], delay=124,
> status=bounced (host nw01.rrz.uni-hamburg.de[134.100.1.50] refused to talk to me: 520 Connection not authorised from this address.)
>
> The difference that I can see is the different "relay=" entry. So I looked
> at the DNS entries :-
>
> Non-authoritative answer:
> nw01.rrz.uni-hamburg.de preference = 10, mail exchanger = rzdspc1.informatik.uni-hamburg.de
> nw01.rrz.uni-hamburg.de preference = 5, mail exchanger = rzaixsrv2.rrz.uni-hamburg.de
> nw01.rrz.uni-hamburg.de preference = 0, mail exchanger = nw01.rrz.uni-hamburg.de
> nw01.rrz.uni-hamburg.de preference = 100, mail exchanger = ws-ham1.win-ip.dfn.de
>
> It appears that Postfix is using the "0" preference, while sendmail is
> using the "5" preference. My current problem is that the "0" preference
> does not appear to want to talk to us, but I don't think I can blame
> Postfix for that ;-) Although if anyone can solve that I would be most
> grateful.
>
> (The ".filtered" part of the address is because sendmail pipes messages
> through procmail)
>
> All the best
>
> Geoff Gibbs
>
> UK-Human Genome Mapping Project-Resource Centre,
> Hinxton, Cambridge, CB10 1SB, UK
> Tel: +44 1223 494530 Fax: +44 1223 494512 E-mail: G.Gibbshgmp.mrc.ac.uk
>
>
>
>



This archive was generated by hypermail 2b27 : Tue Jan 04 2000 - 10:10:18 CST