Secure-Compliance-Solutions-LLC / GVM-Docker

Greenbone Vulnerability Management Docker Image with OpenVAS
https://securecompliance.gitbook.io/projects/
MIT License
248 stars 91 forks source link

Alert e-mail is not being sent #66

Closed chris-fh closed 3 years ago

chris-fh commented 4 years ago

Describe the bug the alert e-mail is not being sent. even though the message "Testing the alert test was successful" is being shown, I did not receive the e-mail. i also cannot find any log entry in our mailserver, showing at least an attempt to send the e-mail.

To Reproduce not sure. I just set up the container entered my e-mail address in the alert as shown in the screenshot. the e-mail does not arrive in my mailbox.

Expected behavior to receive the test e-mail

fprina commented 4 years ago

Looks like the "internal postfix" use a smarthost named smtp on port 25

/etc/postfix/main.cf relayhost = smtp:25

So you need to resolve "smtp" as your smtp server

@pixelsquared It should be great have a env vars for the SMTP_SERVER and SMTP_PORT

ciscoqid commented 4 years ago

According to the original pull notes (https://github.com/Secure-Compliance-Solutions-LLC/GVM-Docker/pull/57), this should already be possible:

-e RELAYHOST="nameofmailserver.domain.tld" #Default is SMTP -e SMTPPORT="25" #Default is port 25

Regardless, I am still not seeing anything happen when I test. Maybe we need to get postfix logs enabled in the container?

pixelsquared commented 4 years ago

I will try to work on this tomorrow. Didn't have time today to look into this.

chris-fh commented 4 years ago

Thank you for your help.

I can tell you "smtp" is being resolved correctly to our mailserver. I can connect to our server via "telnet smtp 25"...

fprina commented 4 years ago

Sorry @chris-fh you right ... I talk too early without recheck our configuration (shame on me )

... at the moment we manually replaced smtp:25 with a "real one"

sed -i 's/smtp:25/smtp.mydomain.com:587/' /etc/postfix/main.cf
service postfix restart
chris-fh commented 4 years ago

I'm sorry but I cannot find a postfix directory or service in the container

root@c5d55ef7af0a:~# ls /data/
cert-data  certs  created_gvm_user  database  firstrun  gvmd  plugins  scap-data  ssh
root@c5d55ef7af0a:~# ls /etc/postfix
ls: cannot access '/etc/postfix': No such file or directory
root@c5d55ef7af0a:~# service postfix restart
postfix: unrecognized service

also the persistent part of the container is located in /data as can be seen here in the docker-compose.yml:

version: '2.0'
services:
  gvm:
   container_name: openvas
   restart: always
   image: securecompliance/gvm
   ports:
   - "443:9392"
   volumes:
   - /openvas_gvm/persistent:/data
...