DeineAgenturUG / greenbone-gvm-openvas-for-docker

The Greenbone Vulnerability Management (GVM) and OpenVAS Scanner for Docker!
MIT License
24 stars 7 forks source link

[Bug] Postfix mail not working #19

Closed markdesilva closed 2 years ago

markdesilva commented 2 years ago

Describe the bug Mail cannot be sent from the container. The file /etc/postfix/main.cf is misconfigured

To Reproduce Steps to reproduce the behavior:

  1. Enter the container shell (docker exec -it gvm bash)
  2. Install mailutils (apt update && apt install mailutils)
  3. Send a test mail out (echo "Test"| mailx -s "test mail from container" your@email)
  4. Mail never arrives
  5. Check /var/log/mail.log and /var/log/mail.info there are errors
    ......warning: relayhost configuration problem
    .......status=deferred (Host or domain name not found. Name service error for name=smtp type=MX: Host not found, try again)

    Expected behavior Mail should be sent to the email address specified in the mailx command

In /etc/postfix/main.cf relayhost is defined as:

relayhost = smtp:25 It should be defined as:

relayhost =

Also mynetworks is defined as:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Should add the docker network 172.17.0.0/24 to this:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.17.0.0/24

Restart postfix (/etc/init.d/postfix restart)

And send the test mail again and it should work and no warning error about relayhost configuration and will see the test mail status is "sent"

Dexus commented 2 years ago

Thank you. Postfix is configured only to work as relay, to your mail server. It should not work in any different way, because we don't want to send mails directly out to the internet. This has many reasons, like SPAM prevention and more.

The Docker Network, should not be need, because it should handle only "local" mails from inside the container. Nothing from outside - your Docker network.

So it is for me not a Bug because it works as I expected it. My mails are working only with set the relayhost and allow the host IP to relay on my mail server.

If you think different I would like to know what you expect and why you are expecting this should change.

markdesilva commented 2 years ago

Thank you. Postfix is configured only to work as relay, to your mail server. It should not work in any different way, because we don't want to send mails directly out to the internet. This has many reasons, like SPAM prevention and more.

The Docker Network, should not be need, because it should handle only "local" mails from inside the container. Nothing from outside - your Docker network.

Hi @Dexus, ok noted on this.

If you think different I would like to know what you expect and why you are expecting this should change.

Oh its my mistake then, I have to set the relayhost to an actual relayhost fqdn port 25. I was just reading the wiki and realized there was a RELAYHOST variable which I needed to set. I will close this.

Thank you!