Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extended Traefik example #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Flash1232
Copy link
Contributor

@Flash1232 Flash1232 commented Apr 20, 2021

Here is a tweaked Traefik example that automatically dumps the ACME certs used by traefik for use by Postfix SMTP(D) TLS including watch & restart of AnonAddy upon renewal. It also provides a feature complete config of AnonAddy (DKIM, DMARC, PGP signing, SMTP(D) TLS) for reference. It also employs Tecnativa's Docker socket proxy for enhanced security.

@Flash1232 Flash1232 changed the title Feature tls traefik Extend Traefik example Apr 20, 2021
@Flash1232 Flash1232 marked this pull request as ready for review April 20, 2021 01:03
@Flash1232 Flash1232 marked this pull request as draft April 20, 2021 12:14
@Flash1232
Copy link
Contributor Author

Putting on hold in favor of some more testing.

@Flash1232 Flash1232 marked this pull request as ready for review April 20, 2021 13:33
@Flash1232
Copy link
Contributor Author

I'm planning on adding MTA-STSv1 and enforce SSL Cipher Suite preferences in a future PR as well.

@yfhyou
Copy link

yfhyou commented Jan 26, 2022

Was testing this version. I already used socketproxy and traefik and didn't really understand the TLS part of anonaddy so this was perfect for me. Worked great (at least until issue #104 showed up again for me).

I did have to modify a portion of the anonaddy.env file:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/key.pem

Needed to be changed to:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/mydomain.com/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/mydoamin.com/key.pem

as that is the way certdumper exported the files for me.

@Flash1232
Copy link
Contributor Author

@youngT2 Thanks for mentioning that. I can rebase and update or maybe split it up into different PRs with further additions (CrowdSec support with Traefik bouncer, watchtower config, restricted cipher suites etc.).

@yfhyou
Copy link

yfhyou commented Jan 26, 2022

I also wanted to ask what is the purpose of the ports line in the socketproxy? Is it just to obscure the port from the system basically?

    ports:
      - '30000:2375'

@yfhyou
Copy link

yfhyou commented Jan 26, 2022

Reading the certdumper documentation a bit closer. Looks like if you include the DOMAIN=mydomain.com environment variable, then it will put the .pem files in the top level /output directory. A bit annoying way to do that, but perhaps that is why you didn't notice this before.

Was testing this version. I already used socketproxy and traefik and didn't really understand the TLS part of anonaddy so this was perfect for me. Worked great (at least until issue #104 showed up again for me).

I did have to modify a portion of the anonaddy.env file:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/key.pem

Needed to be changed to:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/mydomain.com/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/mydoamin.com/key.pem

as that is the way certdumper exported the files for me.

@Flash1232
Copy link
Contributor Author

Flash1232 commented Jan 27, 2022

I also wanted to ask what is the purpose of the ports line in the socketproxy? Is it just to obscure the port from the system basically?

    ports:
      - '30000:2375'

Because I share a docker network with multiple stacks I just wanted to make sure the proxy port won't collide with any other socket proxy I might declare. So I remapped it to an arbitrary high value. You can ignore that and just map 2375:2375 fine I guess.

Reading the certdumper documentation a bit closer. Looks like if you include the DOMAIN=mydomain.com environment variable, then it will put the .pem files in the top level /output directory. A bit annoying way to do that, but perhaps that is why you didn't notice this before.

Was testing this version. I already used socketproxy and traefik and didn't really understand the TLS part of anonaddy so this was perfect for me. Worked great (at least until issue #104 showed up again for me).
I did have to modify a portion of the anonaddy.env file:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/key.pem

Needed to be changed to:

POSTFIX_SMTPD_TLS_CERT_FILE=/data/output/mydomain.com/cert.pem
POSTFIX_SMTPD_TLS_KEY_FILE=/data/output/mydoamin.com/key.pem

as that is the way certdumper exported the files for me.

Oh I didn't notice that. I'll make sure to adjust that for the updated PR. Thanks for the notice! :)

@Flash1232 Flash1232 marked this pull request as ready for review February 28, 2022 17:20
@Flash1232
Copy link
Contributor Author

Flash1232 commented Feb 28, 2022

This PR has been adjusted to the latest developments and further extended with CrowdSec for SPAM and abuse protection as well as Watchtower for automatic image updates (can be configured per container).

@crazy-max This example heavily reflects my own setup and is therefore somewhat up to debate. If you don't like some aspects of it I could remove them or alternatively split them up into further PRs or examples. Also, please let me know if there is anything I could improve. I did not bother to update and test more recent major releases of the Redis and MariaDB containers (for all examples consequently) which I could do for another PR when I get to it.

@Flash1232 Flash1232 changed the title Extend Traefik example Add extended Traefik example Mar 1, 2022
@Heziode
Copy link

Heziode commented May 3, 2022

@Flash1232

I have some question regarding your configuration:

In dynamic.yml, we saw a rspamd service, but there is no service with that name into the docker-compose file. Is it an oversight, or is it attached to the service anonaddy?

Furthermore, in my server, I already have a set of docker-compose files, including one for Traefik. Nevertheless, I wonder if the following services in your file can be generalized to others (and thus taken out of this file, with a network created outside of the file):

  • dockerproxy
  • crowdsec
  • bouncer

@Flash1232
Copy link
Contributor Author

In dynamic.yml, we saw a rspamd service, but there is no service with that name into the docker-compose file. Is it an oversight, or is it attached to the service anonaddy?

As far as I remember, it is indeed a service embedded inside the anonaddy service.

Furthermore, in my server, I already have a set of docker-compose files, including one for Traefik. Nevertheless, I wonder if the following services in your file can be generalized to others (and thus taken out of this file, with a network created outside of the file):

  • dockerproxy
  • crowdsec
  • bouncer

You can very well just define external networks elsewhere and distribute your configuration according to your existing setup by making those services take these other networks.

@sakearzoo
Copy link

how to add MTA-STSv1 and DANE record ? Can someone guide me. as by default i couldn't find the path of MTA-STSv1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants