You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We create a mysql@localhost user under MARIADB_MYSQL_LOCALHOST_USER=1
with its default USAGE privileges.
This gives access to SHOW GLOBAL STATUS/VARIABLES but no other
real access including database visibility or process visibility.
Being a @localhost this restricts access to via the unix socket.
The level of access can be increased controlled by the environment variable
MARIADB_MYSQL_LOCALHOST_GRANTS.
If you are using monitoring replication or processes addition
privileges are required, and the setting of the environment variable
is the comma separated list of grants possible. For the moment,
these are a set of global grants only.
If you share the unix socket location, /var/run/mysqld by default,
as a volume with another container, you have effectively given that
container the mysql@localhost provided they have the same uid map
or can create arbitrary users.
This can be good for things like backup. This would require the
datadir volume as well and the set of privileges
(https://mariadb.com/kb/en/mariabackup-overview/#authentication-and-privileges).
Any grants of UPDATE on mysql database will mean that the
mysql@localhost user can manipulate any other user, potentially
transparently adding unix_socket auth (in 10.4+), and the being able
to gain their privileges.
Grants of CREATE USER, or INSERT on the mysql database allow the
creation of user and privilege escalation.
For these reasons, ALL for MARIADB_MYSQL_LOCALHOST_GRANTS gains a
warning.
Many thanks to Daniel Rudolf for all the reviews and the support
to develop this feature.
-e "select 'I connect therefore I am'"|| die "I'd hoped to work around MDEV-24111"
163
+
164
+
grants="$(docker exec --user mysql -i \
165
+
$cname \
166
+
mysql \
167
+
--silent \
168
+
-e show\ grants)"
169
+
170
+
# shellcheck disable=SC2016
171
+
[ "${grants//\'/\`}"=='GRANT RELOAD, PROCESS, LOCK TABLES ON *.* TO `mysql`@`localhost` IDENTIFIED VIA unix_socket' ] || die "I wasn't granted what I was expected"
172
+
173
+
killoff
137
174
138
175
;&
139
176
mysql_random_password_is_different)
140
177
141
-
echo -e "Test: second instance of MYSQL_RANDOM_ROOT_PASSWORD has a different password\n"
178
+
echo -e "Test: second instance of MYSQL_RANDOM_ROOT_PASSWORD has a different password (and mysql@localhost can be created(\n"
othertables=$(mariadbclient -u root --skip-column-names -Be "select group_concat(SCHEMA_NAME) from information_schema.SCHEMATA where SCHEMA_NAME not in ('mysql', 'information_schema', 'performance_schema', 'sys')")
275
312
[ "${othertables}"!='NULL' ] && die "unexpected table(s) $othertables"
276
313
277
-
otherusers=$(mariadbclient -u root --skip-column-names -Be "select user,host from mysql.user where (user,host) not in (('root', 'localhost'), ('root', '%'), ('mariadb.sys', 'localhost'))")
314
+
otherusers=$(mariadbclient -u root --skip-column-names -Be "select user,host from mysql.user where (user,host) not in (('root', 'localhost'), ('root', '%'), ('mariadb.sys', 'localhost'), ('mysql','localhost'))")
278
315
[ "$otherusers"!='' ] && die "unexpected users $otherusers"
0 commit comments