hortusfox-web icon indicating copy to clipboard operation
hortusfox-web copied to clipboard

Authentication issues with Mariadb 11

Open adrianbn opened this issue 1 year ago • 4 comments

Describe the bug I was having issues getting the docker compose to work due to authentication errors. The web service would never become available because it would fail to auth to the mariadb container. The mariadb container would show the following error:

Version: '11.3.2-MariaDB-1:11.3.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2024-05-07  3:50:38 3 [Warning] Access denied for user 'hortusfox'@'192.168.192.3' (using password: YES)
2024-05-07  3:50:43 4 [Warning] Access denied for user 'hortusfox'@'192.168.192.3' (using password: YES)

I found this comment in another issue https://github.com/danielbrendel/hortusfox-web/issues/101#issuecomment-1927290177 and decided to change the mariadb version from latest (currently 11) to 10 and that solved the issue.

To Reproduce This is the dockerfile I am using, just a slight modification from the one on the repo. This works as long as the mariadb image is pointed to version 10 (as in the example), and fails to authenticate if you change it to latest.

services:
  app:
    container_name: hortusfox-web
    image: ghcr.io/danielbrendel/hortusfox-web:latest
    ports:
      - "${HORTUSFOX_HTTP_PORT}:80" 
    volumes:
      - app_images:/var/www/html/public/img
      - app_logs:/var/www/html/app/logs
      - app_backup:/var/www/html/public/backup
      - app_themes:/var/www/html/public/themes
      - app_migrate:/var/www/html/app/migrations
    environment:
      APP_ADMIN_EMAIL: "${HORTUSFOX_ADMIN_EMAIL}"
      APP_ADMIN_PASSWORD: "${HORTUSFOX_ADMIN_PASSWORD}"
      DB_HOST: db
      DB_PORT: "3306"
      DB_DATABASE: hortusfox
      DB_USERNAME: "${HORTUSFOX_DB_USERNAME}"
      DB_PASSWORD: "${HORTUSFOX_DB_PASSWORD}"
      DB_CHARSET: "utf8mb4"
    depends_on:
      - db
    networks:
      - hortusfox-net

  db:
    container_name: hortusfox-db
    image: mariadb:10
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: "${HORTUSFOX_DB_ROOT_PASSWORD}"
      MYSQL_DATABASE: hortusfox
      MYSQL_USER: "${HORTUSFOX_DB_USERNAME}"
      MYSQL_PASSWORD: "${HORTUSFOX_DB_PASSWORD}"
    networks:
      - hortusfox-net
    volumes:
      - db_data:/var/lib/mysql

networks:
  hortusfox-net:

volumes:
  db_data:
  app_images:
  app_logs:
  app_backup:
  app_themes:
  app_migrate:

Steps to reproduce the behavior:

  1. Change the image: mariadb:10 line for image: mariadb.
  2. Start the compose stack w/ docker compose up...
  3. check the DB / App logs with docker logs
  4. See error

Expected behavior It should authenticate correctly with version 11 as well.

Screenshots If applicable, add screenshots to help explain your problem.

Software:

  • HortusFox version
  • PHP Version
  • MySQL version (if related to the problem)
  • Docker version if used in a docker environment
  • Changes to your docker-compose file if altered

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

adrianbn avatar May 07 '24 04:05 adrianbn

I have the same issue, but switching the MariaDB version down to 10 does not solve it for me unfortunately.

pflavio avatar May 11 '24 11:05 pflavio

Thank you for your bug report. That's kinda odd, I'll look into this issue.

@pflavio what does your docker log show?

danielbrendel avatar May 11 '24 23:05 danielbrendel

@pflavio what does your docker log show?

Hi @danielbrendel I just one of these after the other 2024-05-12 9:36:11 15439 [Warning] Access denied for user 'user'@'172.20.0.3' (using password: YES). 172.20.0.3 is the internal Docker IP of the hortusfox-web-app container. I even tried setting everything to the default values from the example docker-compose to rule out breaking any rules for length or special characters in passwords.

pflavio avatar May 12 '24 09:05 pflavio

I tried to check this in my environment, but I don't have any troubles using mariadb 11.

This is the version I was checking: 11.3.2-MariaDB-1:11.3.2+maria~ubu2204

I checked both creating from scratch or updating existing containers and both worked fine.

danielbrendel avatar May 12 '24 13:05 danielbrendel

Does the problem still persist?

danielbrendel avatar Jun 04 '24 18:06 danielbrendel

Closed due to inactivity / non-reproducible.

danielbrendel avatar Jun 11 '24 00:06 danielbrendel

I faced the same issue - Access denied for user 'hortusfox'@'......' (using password: YES), in my case I was using external network (due to Nginx proxy manager). The connections sometimes worked but mostly not - the solution was to rename the service db to something else, in my case I used hortusfox__db. The app was trying to connect to the db service but it is probably used by another stack / Docker container in the same network so I suppose that was causing the issue, now it works.

lukasheinz92 avatar Apr 19 '25 11:04 lukasheinz92