+
+ # CHUNKING: exact sizes depend on hostnames in headers
+ s/(=>.* K (?:DKIM=\S+ )?C="250- \d)\d+ (byte chunk, total \d)\d+/$1nn $2nn/;
+
+ # OpenSSL version variances
+ s/(TLS error on connection [^:]*: error:)[0-9A-F]{8}(:system library):(?:fopen|func\(4095\)|):(No such file or directory)$/$1xxxxxxxx$2:fopen:$3/;
+ next if /TLS error \(SSL_read\): .*error:0A000126:SSL routines::unexpected eof while reading$/ ;
+ s/EVDATA: \K\(SSL_accept\): error:0A000126:SSL routines::unexpected eof while reading/SSL_accept: TCP connection closed by peer/;
+ s/(DANE attempt failed.*error:)[0-9A-F]{8}(:SSL routines:)(?:(?i)ssl3_get_server_certificate|tls_process_server_certificate|CONNECT_CR_CERT|)(?=:certificate verify failed$)/$1xxxxxxxx$2ssl3_get_server_certificate/;
+ s/(DKIM: validation error: )error:[0-9A-F]{8}:rsa routines:(?:(?i)int_rsa_verify|CRYPTO_internal):(?:bad signature|algorithm mismatch)$/$1Public key signature verification has failed./;
+ s/ARC: AMS signing: privkey PEM-block import: error:\K[0-9A-F]{8}:(PEM routines):get_name:(no start line)/0906D06C:$1:PEM_read_bio:$2/;
+
+ # GnuTLS version variances
+ if (/TLS error on connection \(recv\): .* (Decode error|peer did not send any certificate)/)
+ {
+ my $prev = $_;
+ $_ = <IN>;
+ if (/error on first read/)
+ {
+ s/TLS session: \Kerror on first read:/(gnutls_handshake): A TLS fatal alert has been received.:/;
+ goto RESET_AFTER_EXTRA_LINE_READ;
+ }
+ else
+ { $_ = $prev; }
+ }
+ # translate GnuTLS error into the OpenSSL one
+ s/ARC: AMS signing: privkey PEM-block import: \KThe requested data were not available.$/error:0906D06C:PEM routines:PEM_read_bio:no start line/;
+ # and then both into the OpenSSL 3.x one
+ s/ARC: AMS signing: privkey PEM-block import: error:\K[0-9A-F]{8}:PEM routines:PEM_read_bio:no start line$/1E08010C:DECODER routines::unsupported/;
+
+ # DKIM timestamps
+ if ( /(DKIM: d=.*) t=([0-9]*) x=([0-9]*) \[/ )
+ {
+ my ($prefix, $t_diff) = ($1, $3 - $2);
+ s/DKIM: d=.* t=[0-9]* x=[0-9]* /${prefix} t=T x=T+${t_diff} /;
+ }
+ else
+ { s/DKIM: d=.* \Kt=[0-9]* \[/t=T [/; }
+ # GnuTLS reports a different keysize vs. OpenSSL, for ed25519 keys
+ s/signer: [^ ]* bits:\K 256/ 253/;
+ s/public key too short:\K 256 bits/ 253 bits/;
+
+ # with GnuTLS we cannot log single bad ALPN. So ignore the with-OpenSSL log line.
+ # next if /TLS ALPN (http) rejected$/;
+
+ # port numbers
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_d/PORT_D/;
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_d2/PORT_D2/;
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_d3/PORT_D3/;
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_d4/PORT_D4/;
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_s/PORT_S/;
+ s/(?:\[[^\]]*\]:|port )\K$parm_port_n/PORT_N/;
+ s/I=\[[^\]]*\]:\K\d+/ppppp/;
+
+ # Platform differences for errno values (eg. Hurd). Leave 0 and negative numbers alone.
+ s/R=\w+ T=\w+ defer\K \([1-9]\d*\): / (EEE): /;
+
+ # Platform differences in errno strings
+ s/Arg list too long/Argument list too long/;
+
+ # OpenSSL vs. GnuTLS
+ s/session: \K\((SSL_connect|gnutls_handshake)\): timed out/(tls lib connect fn): timed out/;
+ s/TLS error on connection from .*\K\((SSL_accept|gnutls_handshake)\): timed out/(tls lib accept fn): timed out/;
+ s/TLS error on connection from .*\K(SSL_accept: TCP connection closed by peer|\(gnutls_handshake\): The TLS connection was non-properly terminated.)/(tls lib accept fn): TCP connection closed by peer/;
+ s/TLS session: \K\(gnutls_handshake\): rxd alert: No supported application protocol could be negotiated/(SSL_connect): error: <<detail omitted>>/;
+ s/\(gnutls_handshake\): No common application protocol could be negotiated./(SSL_accept): error: <<detail omitted>>/;
+
+ # Not all buildfarm animals have ipv6
+ next if /<dns:fail> <DNS_(?:NOMATCH|AGAIN):.*:AAAA>$/ ;
+ }
+
+ # ======== mail ========
+
+ elsif ($is_mail)
+ {
+ # DKIM timestamps, and signatures depending thereon
+ if ( /^(\s+)t=([0-9]*); x=([0-9]*); b=[A-Za-z0-9+\/]+$/ )
+ {
+ my ($indent, $t_diff) = ($1, $3 - $2);
+ s/.*/${indent}t=T; x=T+${t_diff}; b=bbbb;/;
+ <IN>;
+ <IN>;
+ }
+ elsif ( /^(\s+)t=([0-9]*); b=[A-Za-z0-9+\/]+$/ )
+ {
+ my $indent = $1;
+ s/.*/${indent}t=T; b=bbbb;/;
+ <IN>;
+ <IN>;
+ }
+
+ # Not all builds include EXPERIMENTAL_DSN_INFO (2 of 2)
+ if (/^X-Exim-Diagnostic:/)
+ {
+ while (<IN>) {
+ last if (/^$/ || !/^\s/);
+ }
+ goto RESET_AFTER_EXTRA_LINE_READ;
+ }