Page MenuHomePhabricator

Puppetize grants for mysql hosts that are the source of recovery (dbstore, passive misc)
Closed, ResolvedPublic

Description

The dump user should have the new grants GRANT SUPER, REPLICATION CLIENT ON *.* TO dump@localhost;, in addition to FILE, RELOAD globally and

GRANT EVENT, LOCK TABLES, SELECT, SHOW VIEW, TRIGGER ON `%wik%`.* TO 'dump'@'localhost';
GRANT EVENT, LOCK TABLES, SELECT, SHOW VIEW, TRIGGER ON `centralauth`.* TO 'dump'@'localhost';

Otherwise, bacula backups will fail:

(without replication client)

mysqldump: Couldn't execute 'SHOW ALL SLAVES STATUS': Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation (1227)
mysqldump: Couldn't execute 'SHOW ALL SLAVES STATUS': Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation (1227)

(without super)

mysqldump: Couldn't execute 'STOP SLAVE 's2' SQL_THREAD': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Couldn't execute 'START SLAVE 'm3'': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Error: Unable to start slave 'm3'
mysqldump: Couldn't execute 'START SLAVE 's1'': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Error: Unable to start slave 's1'
mysqldump: Couldn't execute 'START SLAVE 's5'': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Error: Unable to start slave 's5'
mysqldump: Couldn't execute 'START SLAVE 's6'': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Error: Unable to start slave 's6'
mysqldump: Couldn't execute 'START SLAVE 's7'': Access denied for user 'dump'@'localhost' (using password: YES) (1045)
mysqldump: Error: Unable to start slave 's7

I do not like the dump user having SUPER privileges, but it is an upstream bug: START and STOP SLAVE do not have separate privileges, and without binary log coordinates, backups are useless.

Update: bacula no longer does the backups, but the same issue is relevant.

Event Timeline

jcrespo claimed this task.
jcrespo raised the priority of this task from to Needs Triage.
jcrespo updated the task description. (Show Details)
jcrespo added projects: acl*sre-team, DBA.
jcrespo added subscribers: jcrespo, akosiaris.

This would be a super-simple task, if it wasn't because grants puppetization is very lacking, and I have to refactor it completely even for such a simple task.

jcrespo triaged this task as Medium priority.Sep 9 2015, 10:44 AM
jcrespo set Security to None.
jcrespo added a parent task: Restricted Task.Feb 20 2017, 4:39 PM
jcrespo renamed this task from Puppetize grants for mysql backups on dbstore hosts to Puppetize grants for mysql hosts that are the source of recovery (dbstore, passive misc).Mar 9 2018, 3:26 PM
jcrespo updated the task description. (Show Details)

@jcrespo could you weigh in on what is the exact work that needs to happen here?

@LSobanski

I think Manuel and/or I requested to document what grants are needed to setup a backup host. The problems is there is no good way to do so- as grants are currently only maintained/supported to document on a text file for core mediawiki hosts, and there is no way to define/document non-core/non-misc grants.

With the current system a puppet refactoring would be needed. But may be it is not worth it if we are going to work on a better account management solution?

This is one of the many issue regarding the topic we discussed several times about privilege and account management of mysql servers (on roadmap), epic blocker.

In other works this is a subtask of bigger issue T146149, specific to the backup-related hosts.

Change 657801 had a related patch set uploaded (by Jcrespo; owner: Jcrespo):
[operations/puppet@production] mariadb-backups: Document logical backups grants throughout production dbs

https://gerrit.wikimedia.org/r/657801

Change 657801 merged by Jcrespo:
[operations/puppet@production] mariadb-backups: Document logical backups grants throughout production dbs

https://gerrit.wikimedia.org/r/657801

jcrespo claimed this task.

This is technically done with the merging of the previous patch. This is not a great solution, but it is "a" solution, at least until we have a better one for grants in general. Resolving.