baikal-docker icon indicating copy to clipboard operation
baikal-docker copied to clipboard

enable email notifications vi msmtprc

Open philippneugebauer opened this issue 4 years ago • 3 comments

open questions are how we set msmtp as default email sender and where the logfile should be located #31

philippneugebauer avatar Mar 07 '21 18:03 philippneugebauer

and maybe we should discuss the password handling http://manpages.ubuntu.com/manpages/bionic/man1/msmtp.1.html

philippneugebauer avatar Mar 07 '21 19:03 philippneugebauer

Carrying over the conversation from #31 -- I think what you have makes sense, and should theoretically work, although I haven't had time to set up a test build myself.

I have three comments:

  1. If you look at msmtp configs for various providers here, there are several attributes that this current solution does not provide access to via environmental variables -- port, tls_starttls, tls_certcheck, etc.
    Mounting the msmtprc or msmtp_php file a a volume as I mentioned in my comment on #31 would allow more flexibility at the cost of potentially overwhelming less technical end users. It also keeps potentially private information out of the plaintext dockerfile, and doesn't require adding in a script to parse docker secrets passed as environmental variables with '_FILE' appended. This is a design decision, and I don't think there's a specific right or wrong way to go about it. If you'd like help with the secret parsing script, I think I can dig up one I've used before.

  2. Regarding setting msmpt as default mail sender, the mchodled article has some manipulation to the sendmail= entry of /etc/php/8.0/fpm/php.ini. I do not see this in your solution. However, I'm not super familiar with apache, PHP, or msmtp, so it's entirely possible that your solution may work without it -- I just don't know. If needed, I wrote a potential replacement with sed in my comment #31

  3. It appears that the current implementation requires providing one's own tls/ssl cert, specifically named ca-certificates.crt and mounted in /etc/ssl/certs as detailed in the msmtprc file. The docker-compose.apache example has the certs mounted in etc/ssl/private. I think the cert path needs to be consistent, and the documentation needs to be updated regarding the cert requirement.

ahgraber avatar Mar 20 '21 00:03 ahgraber

My solution works, I am already using it. So 2. is solved. I still don't know which solution is superior, so if you have any information on that, I appreciate it.

Yeah, I tried to find a very simple solution for 1. to get it working and to see what other think about it. I am not sure if that's good or bad, but probably it's better to allow for a more sophisticated solution, maybe providing my solution as fallback.

About 3. I think the solution does not require any certificates since it's using a hosted mail server. It's about installed certificates on the server to probably verify the correct mail server. So I can't see a cert mount. But I might be wrong.

philippneugebauer avatar Mar 20 '21 01:03 philippneugebauer

Closing, msmtp has been added in PR https://github.com/ckulka/baikal-docker/pull/63

Thank you @philippneugebauer though for the PR, your work and that of the others helped a LOT to make this work!

ckulka avatar Dec 29 '23 13:12 ckulka