Fix highstate returner to allow smtp return with authentication and TLS #68286
jsansone-pw
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
We are using the highstate returner with smtp options to send notifications when a system runs its highstate, with html formatting for easy readability. Recently we have been asked to move to an authenticated SMTP server using TLS and username/password auth (Office365 HVE to be specific).
I discovered that while the standard smtp returner could be configured with username, password, and TLS protocol, the smtp configuration for the highstate returner does not allow any of these options to be passed and expects an unsecured smtp server with no authentication requirement and no TLS. It seems odd the smtp returner is configured properly but the highstate was neglected, especially given the prevalence of TLS and SMTP authentication in most modern SMTP providers.
I've already corrected the highstate_return.py file to take advantage of these options and it works fine (I will create a PR and attach it to this FR).
Workaround is to add the following attributes to the _get_options function:
"smtp_tls": "smtp_tls", "smtp_port": "smtp_port", "smtp_username": "smtp_username", "smtp_password": "smtp_password",
and modify the _produce_output function as follows:
`
smtp_tls = setup.get("smtp_tls", False)
user = setup.get("smtp_username", "")
passwd = setup.get("smtp_password", "")
host = setup.get("smtp_server", "")
port = setup.get("smtp_port", "25")
Josiah
Beta Was this translation helpful? Give feedback.
All reactions