LibreTexts / metalc

LibreTexts/UCDavis bare-metal Kubernetes cluster running JupyterHub and Binder
http://jupyter.libretexts.org
MIT License
14 stars 2 forks source link

ZFS scrub not sending emails #240

Closed sandertyu closed 3 years ago

sandertyu commented 3 years ago

We have a cronjob running on gravity that is supposed to ssh into blackhole, our zfs machine, and run a zfs scrub script then email us back the report. For one reason or another, we have not received any emails about this in a while, so it is not working.

TimStewartJ commented 3 years ago

I think it's because we don't have a mail server anymore so I had to change the script to use ssmtp to send emails. This evidently didn't work for some reason, and doesn't seem that secure either. We need to find a new solution for sending automated emails from gravity.

TimStewartJ commented 3 years ago

It turns out the SSMTP is depreciated, so I tried using msmtp. However, I get the following error when trying to send emails to the jupyterteam mailing list, likely because the throwaway email account I created, jupytervoyager@gmail.com, isn't added to the list.

Your message for list 'jupyterteam' (attached below) was rejected.
You are not allowed to send this message for the following reason:

 you are not allowed to perform this action.

I've sent a request to join the list, but it is up to Richard or Jason to accept it.

moorepants commented 3 years ago

You can send emails through the ucdavis mail server. I don't think you even need credentials if the email request is from within the UCDavis network.

moorepants commented 3 years ago

Richard and I saw the request for the jupyterteam@ucdavis.edu sympa list from jupytervoyager@gmail.com. What is the purpose of this? We already have a gmail account (which you could use the gmail smtp server to send with those credentials).

moorepants commented 3 years ago

I suggest logging into gravity and try sending an email to yourself using smtp.ucdavis.edu. You can write a quick python script or bash script to do so. If that works, then you should be able to send emails with no credentials.

TimStewartJ commented 3 years ago

Ah I didn't realize we had our own smtp server, I'll readjust it to use that instead. The reason I made a new account was because sending email via script required enabling "less secure apps" and storing the password in clear text somewhere. I didn't want to do that to our existing gmail account so I made a throwaway one. It looks like with this server it won't be necessary though.

TimStewartJ commented 3 years ago

Okay, so I managed to get email sending to work via the ucdavis smtp server, but I keep running into this error when sending emails to jupyterteam@ucdavis.edu:

Your message for list 'jupyterteam' (attached below) was rejected.
You are not allowed to send this message for the following reason:

 you are not allowed to perform this action.

I've tried sending it as myself and jupyterteam@ucdavis.edu, neither working so far. I'm thinking there might be some quirk of the mailing list that I'm not aware of.

moorepants commented 3 years ago

The jupyterteam list is setup to accept emails from anyone. I don't have access to edit that anymore. Ask Richard if he can adjust the settings if needed. He can also add you as a sympa list owner.

TimStewartJ commented 3 years ago

Okay, I've finally figured it out. For it to go through to the mailing list, it needed a valid To: field in the mail body. For smtplib, the python package I was using to send the email, I was previously doing send(from_address, "jupyterteam@ucdavis.edu", "Subject: etc \n\n body text"), but the third parameter also needed "To: jupyterteam@ucdavis.edu\n\n" in it somewhere. I'll go ahead and close this issue since mail sending is functional and the script is hooked up via crontab to run every month on gravity.