Security of MySQL default password in Docker

Werzi2001

Currently I'm playing a little with MySQL within Docker and was asking myself how to handle the (root) password. The container will not be reachable from the outside (no port forwarding to host) but just from within the Docker network (Docker Compose).

From my current perspective I can just use a default/simple password as the mysql server won't be accessible except from within Docker and anybody having access to Docker is root (at least root-like) anyway (therefore having access to the database anyway e.g. by accessing the files directly). Is this right or am I missing something?

digijay

I wouldn't rely on it! For example if you at some later point had a webserver installed using it to provide an application like e. g. phpMyAdmin, it would be easy to attack your db.

In most cases the attack vector is not the service itself but other applications using it, and thus exposing the service, phpMyAdmin being a very good example imo. Another example would be SQL injections, and if an attacker should gain access to your MySQL root account he would have access to your filesystem. In regard to this I would recommend you to have a look at the MySQL Security Guidelines. Thus you should always use a secure password, particularly for users having GRANT, FILE or PROCESS privileges.

Should you have a Debian or other Debian based OS installed, you can easily access the database on the shell by using the debian-sys-maint user like this:

# mysql --defaults-file=/etc/mysql/debian.cnf

which gives you root access without being prompted for a password.

I hope this helps, keep it secure!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

What's default password in docker container mysql-server when you don't set one?

Remove "Using default security password" on Spring Boot

how to reset my root password in mysql docker image

Docker Compose - MySQL - MYSQL_ROOT_PASSWORD

Docker Mysql container root password [mysqld listens port 0]

Apache ISIS isis-module-security default user/password

Change WooCommerce default password security level

How to change default elasticsearch password in docker-compose?

Change mysql password in Docker container

MySQL Docker Container storing password after first run

AWS RDS MySQL database username and password sufficient for commercial security

Bash script for creating default user in docker MySQL

Azerothcore - Docker .env MySQL-Password not working

Change users mysql password with a view to security -- Best Practices

Windows XP password security

Spring Security : Encrypt password

Finding pdfs with password security

Is there a security risk running XAMPP's MySQL without changing the root password?

Qbittorrent docker webui: nothing happen on default password

MySQL password security

Why is my default password for mysql not empty string

Docker mysql container not creating user with password when specified with database

Reset password mysql in docker container

Docker compose does not create users ,password and database for mysql8

What is a default Username and Password for the eventstore Docker image?

Get docker mysql root password in a variable

How to find the password of mysql on desktop docker in laravel?

Password Security

Is there a way to configure password encoder for default spring security password