Description of problem: I have configured sendmail to send email from my VPS. I don't run a SMTP daemon on my host or on the private network.
Version-Release number of selected component (if applicable):
Version : 1.1.3
Release : 1.fc23
How reproducible: Everytime
Steps to Reproduce:
1. emit_via = email
2. fails to send since it cannot open a socket
Actual results: Fails to send email
Expected results: Sends email via sendmail
You have to setup SMTP server, otherwise the program itself cannot detect IP address of machine that provides mail services that mean to listen on certain port for emails and redistribute them.
Why don't you just use the system's /usr/bin/sendmail? You've made dnf-automatic really hard to setup if you want email copies of upgrades. :(
I agree emails should be sent by invoking sendmail locally rather than via connecting to local SMTP daemon (i.e. depending on running sendmail/postfix in daemon mode).
Example of using local sendmail is
Here is some complementary information :
With the following configuration in /etc/dnf/automatic.conf
emit_via = email,stdio
email_from = root
email_to = root
email_host = localhost
dnf-automatic is failing with the following result :
Les paquets téléchargés ont été enregistrés dans le cache jusqu'à la prochaine transaction réussie.
Vous pouvez supprimer les paquets en cache en exécutant « dnf clean packages ».
Traceback (most recent call last):
File "/usr/bin/dnf-automatic", line 32, in <module>
File "/usr/lib/python3.4/site-packages/dnf/automatic/main.py", line 163, in main
File "/usr/lib/python3.4/site-packages/dnf/util.py", line 331, in fn
return list(map(call_what, self))
File "/usr/lib/python3.4/site-packages/dnf/util.py", line 330, in call_what
return method(*args, **kwargs)
File "/usr/lib/python3.4/site-packages/dnf/automatic/emitter.py", line 99, in commit
smtp = smtplib.SMTP(self._conf.email_host)
File "/usr/lib64/python3.4/smtplib.py", line 242, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib64/python3.4/smtplib.py", line 321, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib64/python3.4/smtplib.py", line 292, in _get_socket
File "/usr/lib64/python3.4/socket.py", line 512, in create_connection
File "/usr/lib64/python3.4/socket.py", line 503, in create_connection
ConnectionRefusedError: [Errno 111] Connection refused
I am using ssmtp as mta and it is working fine for instance with fail2ban.
Jaroslav Mracek said "You have to setup SMTP server, otherwise the program itself cannot detect IP address of machine that provides mail services that mean to listen on certain port for emails and redistribute them."
However ssmtp has no running service, so IT IS A BUG, as dnf-automatic should be using /usr/bin/sendmail and not trying to connect to a smtp server.
Nevertheless, it should be noted that emails can be sent with the following configuration, bypassing ssmtp, and connecting directly to an external smtp server :
emit_via = email,stdio
email_from = firstname.lastname@example.org
email_to = email@example.com
email_host = smtp.yyy.fr
However, in this case, it is not possible to configure smtp server using starttls, or at least it is not explained in the documentation. That means that encrypted updates sensible data are sent, which is definitely a security issue.
Many thanks for your help.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
I thought I would try out the automatic functionality and was also hit by this issue. I use esmtp to send mail to gmail for email notifications of services - which as mentioned in comment 4 works that methodology works fine with fail2ban. So +1 this is a bug and should be fixed. That said, I continue to be impressed and grateful for the work the DNF team is doing. Changing the version of this to F24.
> emit email assumes smtp service
Yes exactly. This is how "emit_via = email" works.
"emit_via = email" use only if you want to sent message throught SMTP
If you want to sent email by command then use "emit_via = command_email".
I found problems during testig "emit_via = command_email".
But this is another story.
(In reply to Jaroslav Rohel from comment #7)
> > emit email assumes smtp service
> Yes exactly. This is how "emit_via = email" works.
> "emit_via = email" use only if you want to sent message throught SMTP
> If you want to sent email by command then use "emit_via = command_email".
> I found problems during testig "emit_via = command_email".
> But this is another story.
Could you please explain how to configure the command_email ?
What other parameters should be valued by what ?
On my box (fedore 29) I have set up "linux mail" to work, i.e. the command "mail"on the command line works, is that sufficient ?
Came across this via searching for mail emit dnf automatic.
The configuration file comments, and man page for dnf-automatic only lists three options for the emit:
list, default: email, stdio, motd
List of emitters to report the results through. Available emitters are stdio to print the result to standard output,
command to send the result to a custom command, command_email to send an email using a command, and email to send the
report via email and motd sends the result to /etc/motd file.
The options for emit_via are buried in there, and at a cursory glance folks are going to think: email, stdio, motd are the options (not reading and seeing command, command_email are also valid options).
Not sure if this needs to be fixed/corrected or clarified, but the ambiguity is real.