Merge branch '4.next'
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 8 Dec 2019 23:36:01 +0000 (23:36 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 8 Dec 2019 23:36:01 +0000 (23:36 +0000)
25 files changed:
1  2 
doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
doc/doc-txt/experimental-spec.txt
src/src/EDITME
src/src/deliver.c
src/src/exim.c
src/src/functions.h
src/src/globals.c
src/src/globals.h
src/src/macros.h
src/src/readconf.c
src/src/smtp_in.c
src/src/tls-gnu.c
src/src/tls-openssl.c
src/src/tls.c
src/src/transports/smtp.c
src/src/verify.c
test/confs/0618
test/confs/5665
test/log/2102
test/runtest
test/stderr/5410
test/stderr/5420
test/stdout/0572

index abd15d452dbad0b940cd4a8f8666d01219e3ca1e,0e7d7655cafa69561d0af16371eb960b617a01ab..2946d70131621203ab938248b16f3617b65f034e
@@@ -15111,9 -15136,10 +15122,11 @@@ etc. are ignored. If IP literals are en
  to handle IPv6 literal addresses.
  
  
- .option dkim_verify_hashes main "string list" "sha256 : sha512 : sha1"
+ .new
+ .option dkim_verify_hashes main "string list" "sha256 : sha512"
  .cindex DKIM "selecting signature algorithms"
  This option gives a list of hash types which are acceptable in signatures,
++.wen
  and an order of processing.
  Signatures with algorithms not in the list will be ignored.
  
index 1e8a2d216ea4a3d9d1c2c476d4fd944bfcdcc5ce,9f18a20732ab2db08a0593bb7e403b4746992219..9f8775f0f89ba5cc2f33a6a4dd7c562cca6ad0c0
@@@ -3,6 -5,28 +3,28 @@@ affect Exim's operation, with an unchan
  options, and new features, see the NewStuff file next to this ChangeLog.
  
  
 -Exim version 4.next
 --------------------
++Exim version 4.94
++-----------------
+ JH/01 Avoid costly startup code when not strictly needed.  This reduces time
+       for some exim process initialisations.  It does mean that the logging
+       of TLS configuration problems is only done for the daemon startup.
+ JH/02 Early-pipelining support code is now included unless disabled in Makefile.
+ JH/03 DKIM verification defaults no long accept sha1 hashes, to conform to
+       RFC 8301.  They can still be enabled, using the dkim_verify_hashes main
+       option.
+ JH/04 Support CHUNKING from an smtp transport using a transport_filter, when
+       DKIM signing is being done.  Previously a transport_filter would always
+       disable CHUNKING, falling back to traditional DATA.
+ JH/05 Regard command-line receipients as tainted.
+ JH/06 Bug 340: Remove the daemon pid file on exit, whe due to SIGTERM.
  Exim version 4.93
  -----------------
  
index fc307a3ba52a254229f281ca30daef6140db25a3,18c3d30243f2d365e39b82a371474f45b8cc58d7..763a806a579bc37f78c436954d19245772e05ad6
@@@ -6,6 -6,18 +6,16 @@@ Before a formal release, there may be q
  test from the snapshots or the Git before the documentation is updated. Once
  the documentation is updated, this file is reduced to a short list.
  
 -Version 4.next
 ---------------
++Version 4.94
++------------
+  1. EXPERIMENTAL_SRS_NATIVE optional build feature.  See the experimental.spec
+     file.
 - 2. Variables $tls_in_ver, $tls_out_ver.
 -
 - 3. Channel-binding for authenticators is now supported under OpenSSL.
++ 2. Channel-binding for authenticators is now supported under OpenSSL.
+     Previously it was GnuTLS-only.
  Version 4.93
  ------------
  
Simple merge
diff --cc src/src/EDITME
Simple merge
Simple merge
diff --cc src/src/exim.c
Simple merge
index f4fcd1e19677f0e3bc68159178856777713581fd,da21b87795be02b3a5c761e74b33d78092eb1d8e..ea3cf257c5f6869043b38a2959b08683c4953520
@@@ -539,7 -541,7 +542,8 @@@ extern int     strcmpic(const uschar *
  extern int     strncmpic(const uschar *, const uschar *, int);
  extern uschar *strstric(uschar *, uschar *, BOOL);
  
 +extern int     test_harness_fudged_queue_time(int);
+ extern void    tcp_init(void);
  #ifdef EXIM_TFO_PROBE
  extern void    tfo_probe(void);
  #endif
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/src/tls.c
index a541a3c7a3210546aae49bc79435adb0e0623864,d47156cdc5ea555778ce3a5e4ea15378a775aa57..f9509121804ee997c1c3035cc349a4b60c3483ac
@@@ -371,38 -369,79 +369,111 @@@ return FALSE
  }
  
  
 +/* Environment cleanup: The GnuTLS library uses SSLKEYLOGFILE in the environment
 +and writes a file by that name.  Our OpenSSL code does the same, using keying
 +info from the library API.
 +The GnuTLS support only works if exim is run by root, not taking advantage of
 +the setuid bit.
 +You can use either the external environment (modulo the keep_environment config)
 +or the add_environment config option for SSLKEYLOGFILE; the latter takes
 +precedence.
 +
 +If the path is absolute, require it starts with the spooldir; otherwise delete
 +the env variable.  If relative, prefix the spooldir.
 +*/
 +void
 +tls_clean_env(void)
 +{
 +uschar * path = US getenv("SSLKEYLOGFILE");
 +if (path)
 +  if (!*path)
 +    unsetenv("SSLKEYLOGFILE");
 +  else if (*path != '/')
 +    {
 +    DEBUG(D_tls)
 +      debug_printf("prepending spooldir to  env SSLKEYLOGFILE\n");
 +    setenv("SSLKEYLOGFILE", CCS string_sprintf("%s/%s", spool_directory, path), 1);
 +    }
 +  else if (Ustrncmp(path, spool_directory, Ustrlen(spool_directory)) != 0)
 +    {
 +    DEBUG(D_tls)
 +      debug_printf("removing env SSLKEYLOGFILE=%s: not under spooldir\n", path);
 +    unsetenv("SSLKEYLOGFILE");
 +    }
 +}
+ /*************************************************
+ *       Drop privs for checking TLS config      *
+ *************************************************/
+ /* We want to validate TLS options during readconf, but do not want to be
+ root when we call into the TLS library, in case of library linkage errors
+ which cause segfaults; before this check, those were always done as the Exim
+ runtime user and it makes sense to continue with that.
+ Assumes:  tls_require_ciphers has been set, if it will be
+           exim_user has been set, if it will be
+           exim_group has been set, if it will be
+ Returns:  bool for "okay"; false will cause caller to immediately exit.
+ */
+ BOOL
+ tls_dropprivs_validate_require_cipher(BOOL nowarn)
+ {
+ const uschar *errmsg;
+ pid_t pid;
+ int rc, status;
+ void (*oldsignal)(int);
+ /* If TLS will never be used, no point checking ciphers */
+ if (  !tls_advertise_hosts
+    || !*tls_advertise_hosts
+    || Ustrcmp(tls_advertise_hosts, ":") == 0
+    )
+   return TRUE;
+ else if (!nowarn && !tls_certificate)
+   log_write(0, LOG_MAIN,
+     "Warning: No server certificate defined; will use a selfsigned one.\n"
+     " Suggested action: either install a certificate or change tls_advertise_hosts option");
+ oldsignal = signal(SIGCHLD, SIG_DFL);
+ fflush(NULL);
+ if ((pid = fork()) < 0)
+   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "fork failed for TLS check");
+ if (pid == 0)
+   {
+   /* in some modes, will have dropped privilege already */
+   if (!geteuid())
+     exim_setugid(exim_uid, exim_gid, FALSE,
+         US"calling tls_validate_require_cipher");
+   if ((errmsg = tls_validate_require_cipher()))
+     log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
+         "tls_require_ciphers invalid: %s", errmsg);
+   fflush(NULL);
+   exim_underbar_exit(0);
+   }
+ do {
+   rc = waitpid(pid, &status, 0);
+ } while (rc < 0 && errno == EINTR);
+ DEBUG(D_tls)
+   debug_printf("tls_validate_require_cipher child %d ended: status=0x%x\n",
+       (int)pid, status);
+ signal(SIGCHLD, oldsignal);
+ return status == 0;
+ }
  #endif        /*!DISABLE_TLS*/
  #endif        /*!MACRO_PREDEF*/
  
Simple merge
Simple merge
diff --cc test/confs/0618
Simple merge
diff --cc test/confs/5665
index da6e5197a9f6206cbfcb7e37b6f8bbab85cea8f7,0000000000000000000000000000000000000000..673ec66567fef9150c7b2ddf91ea25bd9764432c
mode 100644,000000..100644
--- /dev/null
@@@ -1,101 -1,0 +1,102 @@@
 +# Exim test configuration 5652
 +# OCSP stapling, server, multiple leaf-certs
 +
 +.include DIR/aux-var/tls_conf_prefix
 +
 +primary_hostname = server1.example.com
 +
 +# ----- Main settings -----
 +
 +acl_smtp_mail = check_mail
 +acl_smtp_rcpt = check_recipient
 +
 +log_selector = +tls_peerdn
 +
 +queue_only
 +queue_run_in_order
 +
 +tls_advertise_hosts = *
 +
 +CADIR = DIR/aux-fixed/exim-ca
 +DRSA = CADIR/example.com
 +DECDSA = CADIR/example_ec.com
 +
 +tls_certificate = DRSA/server1.example.com/server1.example.com.pem \
 +            : DECDSA/server1.example_ec.com/server1.example_ec.com.pem
 +tls_privatekey =  DRSA/server1.example.com/server1.example.com.unlocked.key \
 +            : DECDSA/server1.example_ec.com/server1.example_ec.com.unlocked.key
 +tls_ocsp_file =   DRSA/server1.example.com/server1.example.com.ocsp.good.resp \
 +            : DECDSA/server1.example_ec.com/server1.example_ec.com.ocsp.good.resp
 +
 +
 +.ifdef _HAVE_GNUTLS
 +tls_require_ciphers = NORMAL:!VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.0
 +.endif
 +.ifdef _OPT_OPENSSL_NO_TLSV1_3_X
 +openssl_options = +no_tlsv1_3
 +.endif
 +
 +# ------ ACL ------
 +
 +begin acl
 +
 +check_mail:
 +  accept   logwrite = acl_mail: ocsp in status: $tls_in_ocsp \
 +    (${listextract {${eval:$tls_in_ocsp+1}} \
 +              {notreq:notresp:vfynotdone:failed:verified}})
 +
 +check_recipient:
 +  accept
 +
 +
 +# ----- Routers -----
 +
 +begin routers
 +
 +client:
 +  driver = manualroute
 +  condition = ${if !eq {SERVER}{server}}
 +  route_list = * 127.0.0.1
 +  self = send
 +  transport = remote_delivery
 +  errors_to = ""
 +
 +srvr:
 +  driver = accept
 +  retry_use_local_part
 +  transport = local_delivery
 +
 +
 +# ----- Transports -----
 +
 +begin transports
 +
 +remote_delivery:
 +  driver =                    smtp
 +  port =                      PORT_D
++  hosts_try_fastopen =                :
 +  hosts_require_tls =         *
 +.ifdef _HAVE_GNUTLS
 +  tls_require_ciphers =               NONE:\
 +                              ${if eq {SELECTOR}{auth_ecdsa} \
 +                                      {+SIGN-ECDSA-SHA512:+VERS-TLS-ALL:+KX-ALL:} \
 +                                      {+SIGN-RSA-SHA256:+VERS-TLS-ALL:+ECDHE-RSA:+DHE-RSA:+RSA:}}\
 +                              +CIPHER-ALL:+MAC-ALL:+COMP-NULL:+CURVE-ALL:+CTYPE-X509
 +.endif
 +.ifdef _HAVE_OPENSSL
 +  tls_require_ciphers =               ${if eq {SELECTOR}{auth_ecdsa} {ECDSA:RSA:!COMPLEMENTOFDEFAULT} {RSA}}
 +.endif
 +  hosts_require_ocsp =                *
 +  tls_verify_certificates =   CADIR/\
 +                              ${if eq {SELECTOR}{auth_ecdsa} \
 +                                      {example_ec.com/server1.example_ec.com/ca_chain.pem}\
 +                                      {example.com/server1.example.com/ca_chain.pem}}
 +  tls_verify_cert_hostnames = :
 +
 +local_delivery:
 +  driver = appendfile
 +  file = DIR/test-mail/$local_part
 +  headers_add = TLS: cipher=$tls_cipher peerdn=$tls_peerdn
 +  user = CALLER
 +
 +# End
diff --cc test/log/2102
index dfcfc1b67ab004706cbc6c6c5889fc9cb245ba1b,bddb8e97397e839c6fae8d46e614146c78a8993e..91761cd68e3539ba775949ed048a7715ef777880
  1999-03-02 09:44:33 der_b64 MIIDuDCCAqCgAwIBAgICAMkwDQYJKoZIhvcNAQELBQAwNzEUMBIGA1UEChMLZXhhbXBsZS5jb20xHzAdBgNVBAMTFmNsaWNhIFNpZ25pbmcgQ2VydCByc2EwHhcNMTIxMTAxMTI0MDA0WhcNMzcxMjAxMTI0MDA0WjAeMRwwGgYDVQQDExNzZXJ2ZXIyLmV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA52Rfiv2Igy0NiaKN5gc0VPLbEoHngkdJWv3wEORp+iFl6skQRbsCylT8djJ2pvHstFpnzSodF3Wwjj2/EDuj3iKBzN9HeXJOvJz8j9Si1xkgCxJeUjPGgYcvKdxybaZAOpi9l3xwPCCEXN4JBq/WaQQ9+eP1PczeMNfvFtXma+VcHXG743ttPOv7eSMr0JxQl3zjQvYGOhFP/KAw6jh/N6YPqii9kV0cC/ubeVzpqJ5/+hndx5YrmAu39N5qzwWujhDPkFNSgCJUhfkEiMaQiPxFxDTbUzWnQ5jpAQ5El4WJVkGWkqxose1bOjSSNzFPJt59YtxxJC3IWN3UtGODTwIDAQABo4HmMIHjMA4GA1UdDwEB/wQEAwIE8DAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwTgYDVR0jBEcwRYANQUFidHdDeGNYZ2IwUaExpC8wLTEUMBIGA1UEChMLZXhhbXBsZS5jb20xFTATBgNVBAMTDGNsaWNhIENBIHJzYYIBQjA0BggrBgEFBQcBAQQoMCYwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vc2NwLmV4YW1wbGUuY29tLzApBgNVHREEIjAgghNzZXJ2ZXIyLmV4YW1wbGUuY29tggkqLnRlc3QuZXgwDQYJKoZIhvcNAQELBQADggEBALHOkZkvHLpNm0QSof09vmmdNFE6/+0TCIoPExeqqSOsy4NsF+Ha46WttjJRSVtbhRxF8jxEU7btPiFgQUaOcJZTwQPDhmQSOPNO8GS46oJ57aQ7U7O+X3M1sVS5Pa2IzE6vrJSh349/CNbTA8WPQdWLlxVJhJXAcZNtaEu6lCsZuDSMTpAsW5I4+snyrm3yvP5t0eD28K5LgCKePX962drkAOP6XGQ51VnbMQ7b1TSdQedtYKIpR3VKUvG5Ky/+0c+Rmwfi2aQ8oXXwekzJyS5jvovdVVsdhO68It+Rz/zursN5Pn+Gj1YuQNUs2nDrGHN+VIIFpgWUjLZO4bcJctY=
  1999-03-02 09:44:33 cipher: TLS1.x:ke-RSA-AES256-SHAnnn:xxx
  1999-03-02 09:44:33 cipher_ TLS1.x:ke_RSA_WITH_ci_mac
++<<<<<<< HEAD
 +1999-03-02 09:44:33 ver:    TLS1.x
++=======
+ 1999-03-02 09:44:33 ver:    TLSv1.x
++>>>>>>> 4.next
  1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@test.ex H=[ip4.ip4.ip4.ip4] P=smtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=yes DN="/CN=server2.example.com" S=sss
  1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
  1999-03-02 09:44:33 Our cert SN: <CN=server1.example_ec.com>
diff --cc test/runtest
index 87c78070e45dd9a2f1aac88acf912deafbc4619c,30315044fa6f62e3dd74ea4246450bab8209fce6..f53b9d72bf7c2e4beb00b3cbbc98a6582080b8f0
@@@ -3450,17 -3435,16 +3465,17 @@@ while (not ($parm_ipv4 and $parm_ipv6) 
    {
    if (/^(?:[0-9]+: )?([a-z0-9]+): /) { $ifname = $1; }
  
-   if (not $parm_ipv4 and /^\s*inet(?:\saddr)?:?\s?(\d+\.\d+\.\d+\.\d+)(?:\/\d+)?\s/i)
+   if (not $parm_ipv4 and /^\s*inet(?:\saddr(?:ess))?:?\s*(\d+\.\d+\.\d+\.\d+)(?:\/\d+)?\s/i)
      {
 -    # It would ne nice to be able to vary the /16 used for manyhome; we could take
 +    # It would be nice to be able to vary the /16 used for manyhome; we could take
      # an option to runtest used here - but we'd also have to pass it on to fakens.
      # Possibly an environment variable?
      next if $1 eq '0.0.0.0' or $1 =~ /^(?:127|10\.250)\./;
      $parm_ipv4 = $1;
      }
  
 -  if (not $parm_ipv6 and /^\s*inet6(?:\saddr(?:ess))?:?\s*([abcdef\d:]+)(?:%[^ \/]+)?(?:\/\d+)?/i)
 +  if (   (not $parm_ipv6 or $parm_ipv6 =~ /%/)
-      and /^\s*inet6(?:\saddr)?:?\s?([abcdef\d:]+)(?:%[^ \/]+)?(?:\/\d+)?/i)
++     and /^\s*inet6(?:\saddr(?:ess))?:?\s*([abcdef\d:]+)(?:%[^ \/]+)?(?:\/\d+)?/i)
      {
      next if $1 eq '::' or $1 eq '::1' or $1 =~ /^ff00/i or $1 =~ /^fe80::1/i;
      $parm_ipv6 = $1;
Simple merge
Simple merge
Simple merge