In PXC 5.6 and 5.7, when using xtrabackup-v2 as the SST method, the DBA must create a user with the appropriate privileges for use by Percona XtraBackup (PXB). The username and password of this backup user are specified in the wsrep_sst_auth variable.
This is a problem because this username and password was being stored in plaintext and required that the configuration file be secured.
The PXC 8.0 solution
(This feature is still under development and may change before PXC 8.0 GA)
Because the wsrep_sst_auth is only needed on the donor side to take a backup, PXC 8.0 uses an internal user (created specifically for use by PXC) with a randomly generated password. Since this user is only needed on the donor, the plaintext password is not needed on the joiner node.
This password consists of 32 characters generated at random. A new password is generated for each SST request. The plaintext of the password is never saved and never leaves the node. The username/password is sent to the SST script via unnamed pipes (stdin).
New PXC internal user accounts
The mysql.pxc.internal.session user account provides the appropriate security context to create and set up the other PXC accounts. This account has a limited set of privileges, enough needed to create the mysql.pxc.sst.user .
This account is locked and cannot be used to login (the password field will not allow login).
The mysql.pxc.sst.user is used by XtraBackup to perform the backup. This account has the full set of privileges needed by XtraBackup. This account is created for an SST and is dropped at the end of an SST and also when the PXC node is shutdown. The creation/provisioning of this user account is not written to the binlog and is not replicated to other nodes. However, this account is sent with the backup to the joiner node. So the joiner node also has to drop this user after the SST has finished.
The mysql.pxc.sst.role is the MySQL role that provides the privileges needed for XtraBackup. This allows for easy addition/removal of privileges needed for an SST.
The experimental release of PXC is based on MySQL 8.0.15, and we have not implemented the role-based support due to issues found with MySQL 8.0.15. This will be revisited in future versions of PXC 8.0.
- DONOR node receives SST request from the JOINER
- DONOR node generates a random password and creates the internal SST user
Shell123456SET SESSION sql_log_bin = OFF;DROP USER IF EXISTS 'mysql.pxc.sst.user'@localhost;CREATE USER 'mysql.pxc.sst.user'@localhost IDENTIFIED WITH 'mysql_native_password' BY 'XXXXXXXX' ACCOUNT LOCK;GRANT 'mysql.pxc.sst.role'@localhost TO 'mysql.pxc.sst.user'@localhost;SET DEFAULT ROLE 'mysql.pxc.sst.role'@localhost to 'mysql.pxc.sst.user'@localhost;ALTER USER 'mysql.pxc.sst.user'@localhost ACCOUNT UNLOCK;
The code that uses role is not being used in the current release due to issues with MySQL 8.0.15. Currently, we create the user with all the permissions needed explicitly.
- Launch the SST script (passing the username/password via stdin)
- SST uses the username/password to perform the backup
- SST script exits
- The DONOR node drops the user.
- The JOINER node receives the backup and drops the user. Note that the JOINER node also contains the internal SST user!
As a precaution, the user is also dropped when the server is shutdown.