juanluisbaptiste / docker-postfix

Simple SMTP relay docker image.
GNU General Public License v3.0
336 stars 166 forks source link

fix: read passwords from files #70

Closed aav66 closed 2 years ago

aav66 commented 3 years ago

Creating a Pull Request

We use github actions to do automatic semantic versioning, so please use the following nomenclature for the commit message according to the type of change:

Description of the change

Checking for file or symlink is exist for SMTP_PASSWORD_FILE and SMTP_USERNAME_FILE.

Motivation and Context

Able to read password from symlinks and prevent error logging on read.

How Has This Been Tested?

at local environment

Types of Changes

Checklist:

juanluisbaptiste commented 3 years ago

Hi @aav66 could you better explain the issue you are fixing and how did you test it ? your PR description is very vague.

aav66 commented 3 years ago

Hi @aav66 could you better explain the issue you are fixing and how did you test it ? your PR description is very vague. Yes, sure. So I got issue when read SMTP_PASSWORD < ${SMTP_PASSWORD_FILE} exit with error, but SMTP_PASSWORD is defined.

$ kubectl exec -t -i mailer-testing-64f7f656f4-vgx4q -c postfix -- /bin/bash
bash-5.1# ls -lhat "${SMTP_PASSWORD_FILE}"
lrwxrwxrwx    1 root     root          24 Nov  2 14:49 /var/secrets/smtp_password.txt -> ..data/smtp_password.txt
bash-5.1# if [ -n "${SMTP_PASSWORD_FILE}" ]; then [ -f "${SMTP_PASSWORD_FILE}" ] && read SMTP_PASSWORD < ${SMTP_PASSWORD_FILE} || echo "SMTP_PASSWORD_FILE defined, but file not existing, skipping."; fi
SMTP_PASSWORD_FILE defined, but file not existing, skipping.
bash-5.1# echo $SMTP_PASSWORD
secret
juanluisbaptiste commented 2 years ago

Hi @aav66, please amend the commit message, it is missing the colons after the word "fix", it should be "fix:"