mailhog / MailHog

Web and API based SMTP testing
MIT License
13.79k stars 1.05k forks source link

SMTP protection #274

Open ogrosko opened 4 years ago

ogrosko commented 4 years ago

Hello, I have question regarding SMTP server protection. We run mailhog in docker container on publicly accessible IP. We protect WEB UI with MH_AUTH_FILE. Is there a possibility to protect SMTP server with username and password?

docker-compose.yml looks like:

version: "3.5"

services:
    mailhog:
        image: mailhog/mailhog
        container_name: mailhog
        volumes:
            - ./mailhog:/home/mailhog
        environment:
            MH_AUTH_FILE: /home/mailhog/auth.file
        restart: always
        ports:
            - 1025:1025 # smtp server
            - 8025:8025 # web ui

Thank you for any hint

pataquets commented 4 years ago

Looks like a duplicate of #226.

glennzw commented 2 years ago

I'd like to see this feature too. Any updates?

hearts-thaw commented 1 year ago

how do you pass auth file to docker compose?

gjadmiraal-bt commented 1 year ago

In the shared compose file, pay attention to the following:

volumes:
            - ./mailhog:/home/mailhog

Here a local mailhog directory is shared with the container. In this directory, these is a file called 'auth.file'. And MailHog is instructed to use the file with the following line:

environment:
            MH_AUTH_FILE: /home/mailhog/auth.file

You can read more on the auth file here: https://github.com/mailhog/MailHog/blob/master/docs/Auth.md, it even points to an example file that is provided.