-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add ability to change host value for root user to secure container #249
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
Conversation
@@ -68,6 +68,9 @@ RUN mkdir -p /var/lib/mysql /var/run/mysqld \ | |||
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime | |||
&& chmod 777 /var/run/mysqld | |||
|
|||
# default root to listen for connections from anywhere | |||
ENV MYSQL_ROOT_HOST % |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to cause issues with file_env
(-e MYSQL_ROOT_HOST_FILE=...
will lead to error: both MYSQL_ROOT_HOST and MYSQL_ROOT_HOST_FILE are set (but are exclusive)
), so needs to be specified as the default in the script instead (via the second argument to file_env
).
Updated to work properly with |
rootCreate= | ||
# default root to listen for connections from anywhere | ||
file_env 'MYSQL_ROOT_HOST' '%' | ||
if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check also look for loopback IP addresses like 127.0.0.1
or ::1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the answer: No; localhost
for mysql is just the unix socket, so IP addresses do not factor in to it.
cc @ltangvald |
Looks good. |
- `busybox`: 1.26.1 (docker-library/busybox#22) - `docker`: 1.13.0-rc5 - `mysql`: add `MYSQL_ROOT_HOST` support (docker-library/mysql#249) - `ruby`: put `xz-utils` back in non-slim (docker-library/ruby#109) - `wordpress`: add `php7.1` variants (docker-library/wordpress#193)
- `docker`: 17.04.0-ce (docker-library/docker#48) - `mariadb`: resync `mysql` entrypoint (MariaDB/mariadb-docker#102; see also docker-library/mysql#249 and docker-library/mysql#266) - `percona`: `5.7.17-13-1.jessie` - `rabbitmq`: multi-version refactoring (docker-library/rabbitmq#134)
…add `MYSQL_ROOT_HOST` support See also docker-library/mysql#336 and docker-library/mysql#249
Now you can easily remove remote MySQL root access or secure to a specific IP address (DNS name would require custom cnf to override the provided config files).
root@localhost
will always work regardless of this new value.fixes #231
Borrows heavily from mysql@6fbb227