anonaddy / docker

AnonAddy Docker image
MIT License
519 stars 56 forks source link

AccessPolicy.php Fails to connect to DB after updating docker from 0.14.1 to v1+ #300

Open siimpliidiip opened 2 months ago

siimpliidiip commented 2 months ago

Support guidelines

I've found a bug and checked that ...

Description

I've recently been migrating my Self-Hosted to Docker but when going from v 0.14.1 to v1, I'm encountering some issues with connecting to the MariaDB. This coincides with the change to use AccessPolicy.php.

Expected behaviour

Seemless connection to the DB.

Actual behaviour

Incoming mail is getting rejected

mail postfix/smtpd[1164]: warning: problem talking to server private/policy: Application error

NOQUEUE: reject: RCPT from mail-qt1-f181.google.com[209.85.160.181]: 451 4.3.5 <xxxxx@xxxx.xxxx.xxx>: Recipient address rejected: Server configuration problem; from=<xxxxxx@gmail.com> to=<xxxxx@xxxx.xxxx.xxx> proto=ESMTP helo=<mail-qt1-f181.google.com>

Postfix Php Logs

SQLSTATE[HY000] [1045] Access denied for user 'anonaddy'@'192.168.112.3' (using password: NO) (Connection: default, SQL: select exists(selectidfromaliaseswhereemail= xxxxx@xxxx.xxxx.xxx) asexists`)

Steps to reproduce

Start with a docker container older than 0.14.1 and migrate to a container newer than 1.0.0

Docker info

lient:
Version:    26.1.5
Context:    default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version:  v0.14.0
Path:     /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version:  v2.27.0
Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: 8
Running: 8
Paused: 0
Stopped: 0
Images: 10
Server Version: 26.1.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 3a4de459a68952ffb703bbe7f2290861a75b6b67
runc version: 51d5e94601ceffbbd85688df1c928ecccbfa4685
init version:
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.43-0-lts
Operating System: Alpine Linux v3.20
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 963.2MiB
Name: XXXXXX
ID: 7514abbe-c66a-4103-baa4-9d5ea261469f
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

Docker Compose config

No response

Logs

as above

Additional info

No response

siimpliidiip commented 2 months ago

While troubleshooting, I noticed that if you replace the $_ENV['DB_PASSWORD"] with the actual password. It works perfectly. The clue was the PHP Logs showing that login was "(using password: NO)". Other parts of the Application accurately retrieve the value from the ENV variables. Another aspect of it is that my password starts with the '#' character. I'm not well versed enough in PHP / Laravel and with phpdotenv to know how the variable is resolved and if it could be that my password is getting commented out (?)