Hi there,

I have a cron job that is supposed to email me at a backup email account if my 
ISP ever changes my IP address.  It doesn't happen very often, but it happened 
again this morning, and I was disappointed to find that the script that does 
the notification failed.

Sending e-mail in this way requires SSL connection to my ISP's mail server 
(smtp.bigpond.com) and authentication, and I was pleased to discover, a while 
back, that curl can handle both of those details, as well as sending email.  So 
I use this script (edited to elide passwords and addresses):
email-myself.sh:
#!/bin/sh
/usr/local/bin/curl -v -T- --ssl-reqd smtps://smtp.bigpond.com --mail-from 
[email protected] --mail-rcpt [email protected] --mail-auth 
[email protected] --user [email protected]:password <<END
From: Andrew Reilly <[email protected]>
To: Andrew Reilly <[email protected]>
Subject: $1
Date: $(date -R)

$2
END

As I said, previously that has worked perfectly, but today I'm getting the 
following in my logs (thanks to having verbose output turned on):

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0* 
  Trying 203.36.137.240:465...
* Connected to smtp.bigpond.com (203.36.137.240) port 465 (#0)
* successfully set certificate verify locations:
*   CAfile: /usr/local/share/certs/ca-root-nss.crt
  CApath: none
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [91 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4836 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
*  subject: C=AU; ST=Victoria; L=Melbourne; O=Telstra Corporation Limited; 
OU=Technology Product Ownership CH10; CN=mail.bigpond.com
*  start date: Jan 23 03:57:06 2020 GMT
*  expire date: Jan 23 04:07:00 2022 GMT
*  subjectAltName: host "smtp.bigpond.com" matched cert's "smtp.bigpond.com"
*  issuer: C=BM; O=QuoVadis Limited; CN=QuoVadis Global SSL ICA G2
*  SSL certificate verify ok.
{ [5 bytes data]
< 220 smtp.telstra.com ESMTP Service ready
} [5 bytes data]
> EHLO Zen
{ [5 bytes data]
< 250-smtp.telstra.com
< 250-8BITMIME
< 250-PIPELINING
< 250-HELP
< 250-AUTH=LOGIN
< 250-AUTH LOGIN PLAIN
< 250-DELIVERBY 300
< 250 SIZE 30000000
} [5 bytes data]
> AUTH PLAIN
{ [5 bytes data]
< 334 ?
} [5 bytes data]
> AGFyZWlsbHlAYmlncG9uZC5uZXQuYXUARnJhaGFuMHc=
{ [5 bytes data]
< 235 PLAIN authentication successful
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
} [5 bytes data]
> QUIT
{ [5 bytes data]
< 221 smtp.telstra.com QUIT
* Closing connection 0
} [5 bytes data]
* TLSv1.2 (OUT), TLS alert, close notify (256):
} [2 bytes data]
curl: (27) Out of memory

That looks to me as though the SSL setup worked fine, then the AUTH fine, then 
the message transfer all fine, and quitting too.  So everything was fine, but 
then curl crashed with error 27 "out of memory", and I haven't received any 
messages.

The web thinks that the two most likely ways for an out-of-date shared library 
linkage or a not-thread-safe programming bug.  So I used portmaster -f to 
rebuild curl and all its dependencies, and it still crashes exactly as shown.

The computer in question is running: (uname -a)
FreeBSD Zen.local 12.1-STABLE FreeBSD 12.1-STABLE r359760 GENERIC  amd64

and has 32G of RAM and eight two-thread AMD 1700 cores.

Any suggestions?

Andrew Reilly
M: 0409-824-272
[email protected]



_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[email protected]"

Reply via email to