Update single.sh - Added MTA auth processing #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello.
We have faced with case when we need to use MTA authentication.
According to Greenbone docs - https://greenbone.github.io/docs/latest/22.4/container/workflows.html#id22 - they are using gvmd with msmtp client as MTA. And something like this should be used (if using Docker):
- MTA_HOST=smtp.gmail.com
- MTA_PORT=587
- MTA_TLS=on
- MTA_STARTTLS=on
- MTA_AUTH=on
- MTA_USER=
- MTA_PASSWORD=<some_password>
- [email protected]
As far as I understand you have reworked this part and used Postfix with only two parameters - RELAYHOST and SMTPPORT.
I have made some refactoring of single.sh script to make MTA authentication be available. Considering that:
MTA_HOST and MTA_PORT = RELAYHOST and SMTP_PORT (from your script parameter)
MTA_TLS and MTA_STARTTLS are already set up by default and due to "#Make postfix more secureish thanks @rkoosaar" in your code
MTA_AUTH, MTA_USER and MTA_PASSWORD are not processed and can be configured in /etc/postfix/main.cf as:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
where /etc/postfix/sasl_passwd contents is :
${RELAYHOST}:${SMTPPORT} ${MTA_USER}:${MTA_PASSWORD}
and secured with "chmod 600 /etc/postfix/sasl_passwd && postmap /etc/postfix/sasl_passwd"
So, minor additions to your single.sh script allows to use MTA authentication.
Please, review and, if possible, accept pull request.
With best regards, Bogdan