Remove uid/gid from wsrep_sst_rsync | Rsync 3.1.0 - rsync: setgroups failed: Operation not permitted

Bug #1261673 reported by Raghavendra D Prabhu
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
Status tracked in 5.6
5.5
Fix Released
Medium
Alex Yurchenko
5.6
Fix Released
Medium
Alex Yurchenko
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Status tracked in 5.6
5.5
Fix Released
Undecided
Unassigned
5.6
Fix Released
Undecided
Unassigned

Bug Description

This breaks rsync 3.1.0 otherwise and serves no purpose (in this case) otherwise.

Tags: rsync sst
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

a) As per

ftp://ftp.ulakbim.gov.tr/pub/rsync/nightly/rsyncd.conf.html

" The default for a non-super-user is to not try to change the user."

" The default for a non-super-user is to not change any group attributes (and indeed, your OS may not allow a non-super-user to try to change their group settings)."

Since mysqld (and hence wsrep-sst-rsync and rsync) run as non-super users, there shouldn't be a problem here.

b)
I also tested with rsync 3.1.0 and older, without uid/gid
specified, it indeed runs as uid/gid of mysqld user.

c)
I also tested with rsync 3.1.0 with uid and gid added.

and it failed as:

Dec 17 14:55:08 Archie rsyncd[36948]: rsyncd version 3.1.0 starting, listening on port 5001
Dec 17 14:55:08 Archie rsyncd[36991]: connect from localhost.localdomain (127.0.0.1)
Dec 17 14:55:08 Archie rsyncd[36991]: rsync: setgroups failed: Operation not permitted (1)

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

Following is what happens:

  if (setgroups(gid_count, gid_list)) {
   rsyserr(FLOG, errno, "setgroups failed");
   io_printf(f_out, "@ERROR: setgroups failed\n");
   return -1;
  }

and from setgroups(2)

"
setgroups() sets the supplementary group IDs for the calling process. Appropriate privileges (Linux: the CAP_SETGID capability) are required.
"

Either CAP_SETGID is required on rsync binary or only the admin (root) user can do this, which explains why it fails for mysqld.

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

As for setuid/setguid done by mysqld (as root to setuid as --user
user)in set_user, it is invoked before SST is done, so uid and euid for
wsrep-sst-rsync are essentially that of mysqld (they are inherited), so
wsrep-sst-rsync also runs with euid = uid = mysqld user.

summary: - Remove uid/gid from wsrep-sst-rsync
+ Remove uid/gid from wsrep_sst_rsync | Rsync 3.1.0 - rsync: setgroups
+ failed: Operation not permitted
tags: added: rsync sst
Revision history for this message
Alex Yurchenko (ayurchen) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1555

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.