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

Cannot create the attachments directory #51

Closed
tobsowo opened this issue Mar 8, 2024 · 18 comments
Closed

Cannot create the attachments directory #51

tobsowo opened this issue Mar 8, 2024 · 18 comments
Labels
question Further information is requested

Comments

@tobsowo
Copy link

tobsowo commented Mar 8, 2024

I am unable to retrieve mail and this is what I found in logs, can someone please share how I can get this resolved with docker installation?

NOTICE: PHP message: [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "Cannot create the attachments directory "/var/www/html/var/imap/attachments""

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

2024/03/08 06:22:49 [error] 14#14: *1948 FastCGI sent in stderr: "PHP message: [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "Cannot create the attachments directory "/var/www/html/var/imap/attachments""" while reading response header from upstream, client: 192.168.1.2, server: _, request: "GET /reports/checkmailnow HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "report.example.com", referrer: "https://report.example.com/" NOTICE: PHP message: [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "Cannot create the attachments directory "/var/www/html/var/imap/attachments"" [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "["TLS\/SSL failure for mail.example.com: SSL negotiation failed"]" In Imap.php line 712: ["TLS\/SSL failure for mail.bluespace.com.ng: SSL negotiation failed"] app:getreportsfrommailbox

@bundyland
Copy link

I'm not an expert in Docker, but it looks for me that there is an SSL error between your host and the mail host.
How does your docker compose file look like? It should look like this:

environment:
MAILER_HOST: my.mailhost.de
MAILER_SMTPPORT: 587
MAILER_IMAPPORT: 993
MAILER_USER: my@mailbox.de
MAILER_PASSWORD: myverystrongepassword

So maybe you should try different ports like 587 or 465 for smtp and 143 or 993 for imap. All depends on your mail host of course.

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

While troubleshooting I changed the SSL to a less secure reason for that.

This is what I have now

app:getreportsfrommailbox
  server: [CLOSED] IMAP connection broken (server response)"]                  
  ["IMAP SERVER BUG (invalid challenge): \"\"","Can not authenticate to IMAP   
In Imap.php line 712:
[critical] Error thrown while running command "app:getreportsfrommailbox". Message: "["IMAP SERVER BUG (invalid challenge): \"\"","Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (server response)"]"
                                                                               
NOTICE: PHP message: [critical] Error thrown while running command "app:getreportsfrommailbox". Message: "["IMAP SERVER BUG (invalid challenge): \"\"","Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (server response)"]"

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

This is my docker compose

name: dmarc-smtptls-reports
version: "2"
services:
  db:
    image: mariadb:latest
    environment:
      MYSQL_DATABASE: dmarcreports
      MYSQL_USER: dmarc
      MYSQL_PASSWORD: bE5^
      MYSQL_ROOT_PASSWORD: 4dhtf
      
    ports:
      - 3306
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
      interval: 10s
      timeout: 5s
      retries: 6
      
  web:
    image: antedebaas/dmarc-reports:latest
    ports:
        - 0.0.0.0:8080:8080
    environment:
      DATABASE_TYPE: mysql
      DATABASE_HOST: db
      DATABASE_PORT: 3306 
      DATABASE_NAME: dmarc
      DATABASE_USER: dmarc
      DATABASE_PASSWORD: bE5
      MAILER_HOST: mail.bl
      MAILER_SMTPPORT: 587
      MAILER_IMAPPORT: 993
      MAILER_USER: web
      MAILER_PASSWORD: PA
      DELETE_PROCESSED_MAILS: false
      ENABLE_REGISTRATION: false
      MAILCHECK_SCHEDULE: "15 * * * *"
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy

@bundyland
Copy link

bundyland commented Mar 8, 2024

Can you connect to this mailbox with a regular mail client? Could you maybe try port 143 for imap? Just to check if your mail server works with STARTTLS.

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

I did connect with Outlook Desktop and worked perfectly and I have also tried port 143 on the docker but still did not work. After the checkmail runs for like two minutes, it ends up with the attached screenshot.
image

@bundyland
Copy link

Oh, that makes it more complicated as I never have used Cloudflare for my mail host. I guess this is the problem, but let's wait if @antedebaas has more ideas.

Good luck!

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

When I disable Cloudflare, this is what I get.
IMG_20240308_123933.jpg

@antedebaas
Copy link
Owner

one of the problems with the checkmail button is that it is bound to php-max-execution time. this is 30seconds by default.
try running the command from the commandprompt instead.

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

Please what command do I run?

@antedebaas
Copy link
Owner

docker exec -t dmarc-web-1 php /var/www/html/bin/console app:getreportsfrommailbox

replace 'dmarc-web-1' with your container name

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

Thank you

@antedebaas
Copy link
Owner

let me know if this solved your issue

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

I ran into another issue

image

@antedebaas
Copy link
Owner

try the following command: php .\bin\console secit:imap:validate-connections

connection result should be success.
if not check your configuration

@antedebaas antedebaas added the question Further information is requested label Mar 8, 2024
@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

/var/www/html # php /var/www/html/bin/console secit:imap:validate-connections
+------------+------------------------------------------------------------------------------------------------+-------------------------------------------+----------------------------+
| Connection | Connect Result                                                                                 | Mailbox                                   | Username                   |
+------------+------------------------------------------------------------------------------------------------+-------------------------------------------+----------------------------+
| default    | FAILED: Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (server response) | {mail.webmail.com:993/imap/ssl}INBOX | webmaster@mail.com |
+------------+------------------------------------------------------------------------------------------------+-------------------------------------------+----------------------------+
Total connections: 1
/var/www/html # 

@tobsowo
Copy link
Author

tobsowo commented Mar 8, 2024

This is the result I get

@antedebaas
Copy link
Owner

Then the problem is on the mail server side

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

No branches or pull requests

3 participants