pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.81k stars 1.74k forks source link

"Access denied for user" during panel installation using database user password with special characters #3287

Closed Boy132 closed 3 years ago

Boy132 commented 3 years ago

Background (please complete the following information):

Describe the bug & To Reproduce Assuming you want to install the panel and your database user password contains special characters like %, & or #. (And assuming that the entered credentials during php artisan p:environment:database were correct.) When running php artisan migrate --seed --force you'll get this error message: image

You can resolve this error by manually editing the .env file and wrap " around the password like this: DB_PASSWORD="PASSWORD".

Expected behavior The password is automatically wrapped with ", e.g.

nathanctech commented 3 years ago

This is not a bug with Pterodactyl but rather how Laravel (what the panel is written in) handles dotenv files. If you enter the credentials with double quotes during the database step, it will work as expected. I suppose a quick note in the guide warning about this during install would be helpful.

DaneEveritt commented 3 years ago

I cannot reproduce this with the information provided. Please include an example of a password being entered that is not escaped properly when stored.

amatheo commented 1 year ago

I encountered this issue on a new installation when using the password "^cVgA3Vn8Mf5$3rfR9#*U". To resolve the issue, I changed the password to something simpler. This behavior seems strange to me.

niraami commented 10 months ago

I've encountered this just today, with the password #E+DjTrY$j2x/oHF. Changing the password to only alphanumerics also solved the issue. If I find some time, I might test out which characters cause this, but our passwords only share "#" and "$", so at least one of them is definitely the cause.

parkervcp commented 10 months ago

If you are doing the work in the terminal there is a set of special chars you can't use. Shells use the following for many things #@!/\

niraami commented 10 months ago

The database password was set as an environment variable in a Docker compose file, like this:

services:
  pterodactyl-panel:
    image: ghcr.io/pterodactyl/panel:latest
    environment:
      - APP_ENV=production
      - APP_ENVIRONMENT_ONLY=false
      - APP_THEME=pterodactyl
      - APP_TIMEZONE=UTC

      - DB_CONNECTION=mysql
      - DB_HOST=mysql-db
      - DB_PORT=3306
      - DB_DATABASE=pterodactyl_panel
      - DB_USERNAME=pterodactyl
      - DB_PASSWORD=#E+DjTrY$j2x/oHF

      - CACHE_DRIVER=redis
      - SESSION_DRIVER=redis
      - QUEUE_DRIVER=redis
      - REDIS_HOST=redis-db
    volumes:
      - var:/app/var/
      - nginx:/etc/nginx/http.d/
      - certs:/etc/letsencrypt/
      - logs:/app/storage/logs/
    networks:
      - backend
      - apps
    ports:
      - 8540:80
      - 8541:443
    links:
      - mysql-db:database
      - redis-db:cache

    restart: unless-stopped

Just to make sure docker isn't at fault, I've changed the password and re-deployed the container again, and here's the output of env | grep DB_PASSWORD from within the container: DB_PASSWORD=#E+DjTrY/oHF