[rrd-developers] Question regarding -s option of rrdcached

Alex Bennee kernel-hacker at bennee.com
Tue Jul 13 18:21:01 CEST 2010


On 10 July 2010 03:02, Bernard Li <bernard at vanhpc.org> wrote:
> Hi all:
>
> I understand that the new '-s' option for rrdcached will change the
> group ownership of the socket specified by -l following the -s
> argument, eg:
>
> # rrdcached -s rrdcached -l unix:/tmp/rrdcached.socket
>
> would change the group ownership of the socket to group 'rrdcached'.
>
> However, if I specify -s without -l, I would expect the default socket
> created by rrdcached would have the ownership changed, like:
>
> # rrdcached -s rrdcached
>
> The default socket created is still owned by user 'root'.
>
> Is this considered a bug?

Sounds like it should be, as you say it behaves non-obviously.

> Also, if you run the following as root:
>
> # rrdcached -s root -l unix:/tmp/rrdcached.socket
>
> the following block of code from rrd_daemon.c gets executed:
>
> 2544      if (sock->socket_group != (gid_t)-1)
> 2545      {
> 2546        if ( (chown(path, getuid(), sock->socket_group) != 0) ||
> 2547             (chmod(path, (S_IRUSR|S_IWUSR|S_IXUSR | S_IRGRP|S_IWGRP)) != 0) )
> 2548        {
> 2549          fprintf(stderr, "rrdcached: failed to set socket group
> permissions (%s)\n", strerror(errno));
> 2550        }
> 2551      }
>
> So I believe there is some issue with the comparison.

What error is reported?

> Finally, would people object to having a new option where you can
> change the user ownership of the socket?

I have no objection (but I can't speak for the developers) however
what is your usage case?

I added the group permission flag as it's quite likely to have
multiple processes with different uid's needing to access the socket.
It would seem a bit clunky to force disparate processes (e.g. a web
server and a data collector) to run with the same user permissions.

-- 
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk



More information about the rrd-developers mailing list