Bug 2335508 - dnf-automatic fails to send e-mail via SMTP to sendmail ≥ 8.18.1: libcurl error while sending e-mail: Weird server reply
Summary: dnf-automatic fails to send e-mail via SMTP to sendmail ≥ 8.18.1: libcurl err...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Petr Pisar
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-01-03 23:38 UTC by Frank Crawford
Modified: 2025-02-19 02:01 UTC (History)
6 users (show)

Fixed In Version: dnf5-5.2.8.1-4.fc42 dnf5-5.2.8.1-3.fc41 dnf5-5.2.10.0-2.fc41
Clone Of:
Environment:
Last Closed: 2025-02-19 02:01:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github curl curl issues 15942 0 None open LF in an e-mail body is rejected by sendmail 8.18.1 2025-01-08 13:50:57 UTC
Github rpm-software-management dnf5 pull 1992 0 None open automatic: Fix end-of-lines in messages sent by email emitter 2025-01-08 13:50:57 UTC
Github rpm-software-management dnf5 pull 2010 0 None open automatic: Translate end-of-lines in email emitter by DNF 2025-01-14 17:15:35 UTC

Description Frank Crawford 2025-01-03 23:38:49 UTC
dnf-automatic can be configured to send email, but fails on delivery to sendmail with the message "libcurl error while sending e-mail: Weird server reply" and reviewing the SMTP server logs it reports "info=Bare linefeed (LF) not allowed, where=body, status=tempfail"

Reproducible: Always

Steps to Reproduce:
1.Install and configure dnf-automatic package
2.Configure with "emit_via = email" and set up "[email]" variables
3.With for updates and review logs
Actual Results:  
No email is delivered and the messages listed above are generated.

Expected Results:  
Email should be delivered.

Note, emitter "command_email" should work in place if an email program is installed.

Comment 1 Petr Pisar 2025-01-06 14:32:21 UTC
I cannot reproduce it with a default postfix configuration.

We need more details: A content of your /etc/dnf/automatic.conf, what SMTP server you use, what text is dnf-automatic is trying to send (preferably provide a network dump, or at least output of dnf-automatic if confifgured with emit_via=stdio).

Comment 2 Petr Pisar 2025-01-06 14:39:26 UTC
And please tell us your dnf5-plugin-automatic and libcurl versions.

Comment 3 Frank Crawford 2025-01-08 08:06:21 UTC
The versions are:
libcurl-8.9.1-2.fc41.x86_64
dnf5-plugin-automatic-5.2.8.1-2.fc41.x86_64

and the mail server is sendmail (sendmail-8.18.1-1.fc40.x86_64)

/etc/dnf/automatic.conf was (now using command_email):

[commands]
apply_updates = yes
reboot = when-needed

[emitters]
emit_via = email,motd

[email]
email_from = root.id.au
email_host = smtp.crawford.emu.id.au

And sorry, I can't say what it was trying to send, as it is both a week ago, and that has been replaced by more recent update.

Comment 4 Petr Pisar 2025-01-08 09:17:01 UTC
The error message is a news in sendmail 8.18.1:

                - Accept only CRLF . CRLF as end of an SMTP message
                as required by the RFCs, which can disabled by the
                new srv_features option 'O'.
                - Do not accept a CR or LF except in the combination
                CRLF (as required by the RFCs).  These checks can
                be disabled by the new srv_features options
                'U' and 'G', respectively.  In this case it is
                suggested to use 'u2' and 'g2' instead so the server
                replaces offending bare CR or bare LF with a space.
                It is recommended to only turn these protections off
                for trusted networks due to the potential for abuse.

So either there is a bug either in dnf5 or curl.

Comment 5 Petr Pisar 2025-01-08 10:08:05 UTC
I dumped an arbitrary e-mail sent by dnf-automatic and I confirm it only separates lines in the body with "\n". Which is probably what sendmail complains now. It seems that curl library does no escaping when reading the e-mail body from an application.

Comment 6 Petr Pisar 2025-01-08 11:02:17 UTC
I can reproduce it in Fedora 42 with a developmental DNF5 when an update is available and DNF5 wants to dowload it:

sendmail-8.18.1-4.fc41.x86_64
libcurl-8.11.1-2.fc42.x86_64
dnf5-plugin-automatic-5.2.8.1-20250108010401.26.g47070ab7.fc42.x86_64

Comment 7 Frank Crawford 2025-01-08 11:07:30 UTC
I don't know what you would set in libcurl, but I see that for curl there is a specific option --crlf to convert line feeds to carriage return plus line feed in upload.

Comment 8 Petr Pisar 2025-01-08 12:18:25 UTC
Thanks for the hint. Indeed curl library has an option for converting the end-of-lines/ I also checked how curl handles a standalone dot in the message body and that one is escaped correctly. I will write a patch for DNF5 to use that option. I will also open a question for curl whether it is a bug.

Comment 9 Petr Pisar 2025-01-09 09:49:33 UTC
Fix merged upstream.

Comment 10 Fedora Update System 2025-01-09 12:46:55 UTC
FEDORA-2025-f3bc917e71 (dnf5-5.2.8.1-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-f3bc917e71

Comment 11 Fedora Update System 2025-01-10 03:12:09 UTC
FEDORA-2025-f3bc917e71 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-f3bc917e71`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-f3bc917e71

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2025-01-11 01:42:45 UTC
FEDORA-2025-f3bc917e71 (dnf5-5.2.8.1-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Frank Crawford 2025-01-14 04:37:14 UTC
Unfortunately the problem looks to still exist.  I've installed dnf5-plugin-automatic-5.2.8.1-3.fc41.x86_64 and it still fails to send emails during the update, with the same complaint on the sendmail server.

Comment 14 Petr Pisar 2025-01-14 12:12:47 UTC
I bet successfully tested before building it package. But now it indeed fails. But the failure is different:

sendmail[9078]: 50EC3pMO009078: collect: relay=localhost, from=<root@localhost>, info=Bare carriage return (CR) not allowed, where=header, status=tempfail

The previous issue was about CR in e-mail body. Now it complains about e-mail headers.

Comment 15 Petr Pisar 2025-01-14 12:44:29 UTC
It works in Fedora 42 with:

dnf5-5.2.8.1-4.fc42.x86_64
libcurl-8.11.1-2.fc42.x86_64
sendmail-8.18.1-5.fc42.x86_64

but fails in Fedora 41 with:

dnf5-5.2.8.1-3.fc41.x86_64
libcurl-8.9.1-3.fc41.x86_64
sendmail-8.18.1-4.fc41.x86_64

sendmail and dnf5 packages have identical sources. Probably something with curl.

Comment 16 Petr Pisar 2025-01-14 12:51:30 UTC
Network dump confirms that in Fedora 41 e-mail header lines are wrongly ended with "\r\r\n" and e-mail body correctly with "\r\n". While in Fedora 42 both are fine.

Comment 17 Petr Pisar 2025-02-04 13:40:06 UTC
A fix for the header lines was now accepted upstream. It will be delivered in dnf5-5.2.9.0 soon.

Comment 18 Fedora Update System 2025-02-18 11:59:21 UTC
FEDORA-2025-665751b0e4 (dnf5-5.2.10.0-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-665751b0e4

Comment 19 Fedora Update System 2025-02-19 02:01:18 UTC
FEDORA-2025-665751b0e4 (dnf5-5.2.10.0-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.