Code Monkey home page Code Monkey logo

Comments (29)

bastidest avatar bastidest commented on May 20, 2024

Same behavior for me. I tried sending a email to the website to check if an alias was created automatically, but without success.

How can I check if the postfix container receives mails?

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

@alex-phillips @bastidest,

Like I said in the README, this image is a draft for the moment. Not yet tested myself. I'll let you know when I have time to test this image completely.

from docker.

bastidest avatar bastidest commented on May 20, 2024

The following patch makes me receive the confirmation mail. The 'anonaddy' docker container was missing a postfix service to deliver the locally queued verification mails.

index f6495f6..82fd49d 100644
--- a/rootfs/etc/cont-init.d/04-svc-main.sh
+++ b/rootfs/etc/cont-init.d/04-svc-main.sh
@@ -7,6 +7,8 @@ if [ "$SIDECAR_CRON" = "1" ] || [ "$SIDECAR_POSTFIX" = "1" ]; then
   exit 0
 fi
 
+postfix start
+
 # Migrate
 su-exec anonaddy:anonaddy php artisan migrate --no-interaction --force
 su-exec anonaddy:anonaddy php artisan cache:clear --no-interaction

Did not have any luck with receiving emails yet tho.

from docker.

bastidest avatar bastidest commented on May 20, 2024

@alex-phillips With the patch from my previous message and this patch i got it working. I will make a PR with both.

A sendmail to the configured domain showed that the connection with the smtp server was refused. In the example docker-compose configuration, the smtp port is 2500. I set it to 25 and it was working without problems.

index 606af1e..b225298 100644
--- a/examples/compose/docker-compose.yml
+++ b/examples/compose/docker-compose.yml
@@ -47,7 +47,7 @@ services:
       - anonaddy
     ports:
       - target: 2500
-        published: 2500
+        published: 25
         protocol: tcp
     volumes:
       - "./data:/data"

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@bastidest So the port change to 25 fixes receiving email, but I'm still unable to send email (specifically the confirmation email). I see now with the postfix start addition that it is actually attempting now, but the postfix logs don't seem right:

In the logs below, my recipient email was added ([email protected]), but it looks unusual in the log lines. Not sure if this is correct or not?

Mar 26 20:39:24 MYDOMAIN postfix/pipe[483]: 751BF34899B: to=<[email protected]>, relay=anonaddy, delay=0.53, delays=0.01/0/0/0.52, dsn=2.0.0, status=sent (delivered via anonaddy service)

from docker.

bastidest avatar bastidest commented on May 20, 2024

@alex-phillips
My theory is that the postfix server in the anonaddy_postfix container is able to receive and redirect mail. The only thing the postfix in the anonaddy container does is to send the confirmation mail.

My (successful) mail delivery looks like that:

postfix_1   | Mar 27 07:36:30 MY_DOMAIN postfix/smtpd[929]: connect from outgoing-mailserver[A.A.A.A]
postfix_1   | Mar 27 07:36:30 MY_DOMAIN postfix/smtpd[929]: D852BDB31F: client=outgoing-mailserver[A.A.A.A]
postfix_1   | Mar 27 07:36:30 MY_DOMAIN postfix/cleanup[932]: D852BDB31F: message-id=<[email protected]>
postfix_1   | Mar 27 07:36:30 MY_DOMAIN postfix/qmgr[388]: D852BDB31F: from=<[email protected]>, size=1203, nrcpt=1 (queue active)
postfix_1   | Mar 27 07:36:30 MY_DOMAIN postfix/smtpd[929]: disconnect from outgoing-mailserver[A.A.A.A] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
redis_1     | 1:M 27 Mar 06:36:31.370 * 1 changes in 3600 seconds. Saving...
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/pickup[895]: 66609DB324: uid=1000 from=<bounces@MY_DOMAIN.com>
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/cleanup[932]: 66609DB324: message-id=<0f5f51a7823f65998e3548cc2054cef9@MY_DOMAIN.com>
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/qmgr[388]: 66609DB324: from=<bounces@MY_DOMAIN.com>, size=1145, nrcpt=1 (queue active)
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/pipe[933]: D852BDB31F: to=<foobar@MY_DOMAIN.com>, relay=anonaddy, delay=0.57, delays=0.08/0.01/0/0.48, dsn=2.0.0, status=sent (delivered via anonaddy service)
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/qmgr[388]: D852BDB31F: removed
redis_1     | 1:M 27 Mar 06:36:31.371 * Background saving started by pid 15
redis_1     | 15:C 27 Mar 06:36:31.373 * DB saved on disk
redis_1     | 15:C 27 Mar 06:36:31.374 * RDB: 0 MB of memory used by copy-on-write
redis_1     | 1:M 27 Mar 06:36:31.472 * Background saving terminated with success
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/smtp[943]: 66609DB324: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.140.27]:25, delay=0.51, delays=0.01/0.01/0.08/0.41, dsn=2.0.0, status=sent (250 2.0.0 OK DMARC:Quarantine 1585290991 m1si4818407wml.218 - gsmtp)
postfix_1   | Mar 27 07:36:31 MY_DOMAIN postfix/qmgr[388]: 66609DB324: removed
cron_1      | crond: USER anonaddy pid 6234 cmd cd /var/www/anonaddy && php artisan schedule:run --no-ansi --no-interaction --quiet

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@bastidest Right, so if you look at my postfix logs, this specifically: to=<[email protected]> That doesn't look right at all. I'm wondering if this is now a config issue on my part.

Can you glance over my files above or perhaps post yours?

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

Hi @bastidest,

The following patch makes me receive the confirmation mail. The 'anonaddy' docker container was missing a postfix service to deliver the locally queued verification mails.
postfix start

It is not good practice to start a service this way (see https://github.com/just-containers/s6-overlay/). Also the sidecar postfix container already do this job.

A sendmail to the configured domain showed that the connection with the smtp server was refused. In the example docker-compose configuration, the smtp port is 2500. I set it to 25 and it was working without problems.

Default smtp port (25) should be ok for you but some distrib do not allow binding to unprivileged ports. But in our case we have to bind to port 25 like you said because there is no way to tell a sending server what port you're listening on using MX.

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@crazy-max Is it possible that these containers need to share the same network then? Is the anonaddy container attempting to send to postfix, but since its technically running in another container, it's not working properly?

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

@alex-phillips

Is it possible that these containers need to share the same network then?

If you use the compose file in the examples folder, they are intrinsically part of the same network.

Is the anonaddy container attempting to send to postfix, but since its technically running in another container, it's not working properly?

I don't know if anonaddy is communicating directly with postfix. If it does, I don't see anything to configure the postfix server address on anonaddy. Any idea @willbrowningme?

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@crazy-max yes they are on the same network, but if you use network_mode: service:anonaddy on the postfix container, then they will 'share' the same port 25. Not sure if that would help.

from docker.

bastidest avatar bastidest commented on May 20, 2024

@crazy-max

I don't know if anonaddy is communicating directly with postfix. If it does, I don't see anything to configure the postfix server address on anonaddy. Any idea @willbrowningme?

It appears to me that anonaddy is using Laravel as web framework. The current configuration tells Laravel to use the sendmail mail driver, which executes the local sendmail executable in the anonaddy container.
https://github.com/crazy-max/docker-anonaddy/blob/8475ef76624a1c1c191a8dd668713d31f3620d3d/rootfs/etc/cont-init.d/03-config.sh#L174-L176

Maybe set the driver to SMTP and use the existing anonaddy_postfix container to send mails. Laravel Mail Documentation.

Default smtp port (25) should be ok for you but some distrib do not allow binding to unprivileged ports. But in our case we have to bind to port 25 like you said because there is no way to tell a sending server what port you're listening on using MX.

I don't get your point. AFAIK mail servers need to be reachable under their well-known port.

from docker.

willbrowningme avatar willbrowningme commented on May 20, 2024

@alex-phillips
I don't know if anonaddy is communicating directly with postfix. If it does, I don't see anything to configure the postfix server address on anonaddy. Any idea @willbrowningme?

When an email arrives at the server it is handled by Postfix. Postfix then pipes the received email through to the Laravel application (the lines in /etc/postfix/master.cf do this).

The Laravel application then determines where to forward the email onto by consulting the database, it sends the email using sendmail (set in config/mail.php - 'sendmail' => '/usr/sbin/sendmail -t -XV',).

@alex-phillips The reason you can see [email protected] is probably because of the variable envelope return path (VERP) being set.

I'm hoping to release the full detailed instructions for manually setting up the server soon which should help greatly with this Docker image.

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

Maybe set the driver to SMTP and use the existing anonaddy_postfix container to send mails. Laravel Mail Documentation.

@bastidest Yes that should do it.

I'm hoping to release the full detailed instructions for manually setting up the server soon which should help greatly with this Docker image.

@willbrowningme I think I'll have time next week to test the documentation you sent me.

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

@alex-phillips @bastidest Should be fixed with latest image

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@crazy-max I'm now getting a 500 now when attempting to send the confirmation email. I'm trying to add in an error_log directive to the nginx config, but every time I restart the container it reverts my changes. Are you logging errors anywhere so I can see what exactly the 500 is?

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@crazy-max Looks like this is the error:

[2020-03-31 23:56:19] production.ERROR: Connection could not be established with host postfix :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name does not resolve {"userId":"18e2e368-2f81-4f98-b1b1-4b0edbddf38f","e
xception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host postfix :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name does not resolve at /var/www/anonaddy/vendor/swiftma
iler/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:269)

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

You can disregard that 500 error - I had the wrong hostname set for MAIL_HOST. That's returning successfully now, postfix outputs the following, which looks normal:

Apr 01 12:07:27 mydomain postfix/smtpd[402]: connect from anonaddy.htpc_default[172.18.0.31]
Apr 01 12:07:27 mydomain postfix/smtpd[402]: 899161A18C7: client=anonaddy.htpc_default[172.18.0.31]
Apr 01 12:07:27 mydomain postfix/cleanup[405]: 899161A18C7: message-id=<[email protected]>
Apr 01 12:07:27 mydomain postfix/qmgr[389]: 899161A18C7: from=<[email protected]>, size=14674, nrcpt=1 (queue active)
Apr 01 12:07:27 mydomain postfix/smtpd[402]: disconnect from anonaddy.htpc_default[172.18.0.31] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 01 12:07:27 mydomain postfix/pipe[406]: 899161A18C7: to=<[email protected]>, relay=anonaddy, delay=0.38, delays=0.05/0/0/0.33, dsn=2.0.0, status=sent (delivered via anonaddy service)
Apr 01 12:07:27 mydomain postfix/qmgr[389]: 899161A18C7: removed

But still not getting the confirmation email at the destination.

from docker.

bastidest avatar bastidest commented on May 20, 2024

I am unable to do the initial login now. http://<host>:8000/login provides me with the error message

These credentials do not match our records.

when logging in with anonaddy/anonaddy.

What I did:

  • docker-compose down
  • docker system prune
  • docker volume prune
  • docker-compose pull (new image was pulled)
  • rm -rf data db
  • docker-compose up

I set ANONADDY_ADMIN_USERNAME=anonaddy in the anonaddy.env file.

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

@bastidest Did you run the seed command? docker-compose exec --user anonaddy anonaddy php artisan db:seed --force

from docker.

bastidest avatar bastidest commented on May 20, 2024

@alex-phillips thank you that worked
Now I don't get an confirmation mail either. These are my postfix logs:

postfix_1   | Apr 02 20:49:02 <hostname> postfix/smtpd[419]: connect from anonaddy.anonaddy_default[172.26.0.4]
postfix_1   | Apr 02 20:49:02 <hostname> postfix/smtpd[419]: CFDE21FE54: client=anonaddy.anonaddy_default[172.26.0.4]
postfix_1   | Apr 02 20:49:02 <hostname> postfix/cleanup[421]: CFDE21FE54: message-id=<[email protected]>
postfix_1   | Apr 02 20:49:02 <hostname> postfix/qmgr[417]: CFDE21FE54: from=<anonaddy@<hostname>.com>, size=14723, nrcpt=1 (queue active)
postfix_1   | Apr 02 20:49:02 <hostname> postfix/smtpd[419]: disconnect from anonaddy.anonaddy_default[172.26.0.4] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
postfix_1   | Apr 02 20:49:03 <hostname> postfix/pipe[422]: CFDE21FE54: to=<[email protected]>, relay=anonaddy, delay=0.35, delays=0.01/0.01/0/0.32, dsn=2.0.0, status=sent (delivered via anonaddy service)
postfix_1   | Apr 02 20:49:03 <hostname> postfix/qmgr[417]: CFDE21FE54: removed

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

Anyone have any luck getting this working?

from docker.

brincowale avatar brincowale commented on May 20, 2024

Same problem, but I don't need to send emails yet. So I modified the database to approve the domains whithout to receive the confirmation email

docker-compose exec db mysql
sql> use anonaddy;
sql> select * from recipients;
update recipients set email_verified_at = '2020-05-10 14:19:12';

But still not working. This is the error when postfix receive an email sent from Gmail.

postfix/smtpd[411]: NOQUEUE: reject: RCPT from mail-oi1-f181.google.com[209.85.167.181]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-oi1-f181.google.com>

I'll see how this thread goes

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

I'll start the tests on the Docker image and I'll get back to you on that issue.

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

Ok I was able to reproduce this issue on a VPS. Keep you in touch.

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

@bastidest @alex-phillips @brincowale I've made some changes to this image and now everything seems to work. See CHANGELOG and the new compose example.

from docker.

alex-phillips avatar alex-phillips commented on May 20, 2024

Great! I look forward to giving this a try. Thanks!

from docker.

Coderdude112 avatar Coderdude112 commented on May 20, 2024

Hello @alex-phillips,

I am having a very similar issue happen. I can access the web interface, create a user but the verification email won't send. I'm woundering if this has something to do with the most recent version of anonaddy (0.8.0) what version were you able to get this running with?

Thanks in advance

from docker.

crazy-max avatar crazy-max commented on May 20, 2024

@Coderdude112 #69

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.