Question

I need to set the permissions of a file in rpm as a named pipe.

We deploy configuration files with some fancy rpm magic (%postun, %triggerin and %triggerun are used to mpve aside old config files and restore the m if needed). As part of the configuration for an Icinga distributed setup, I want to change the permissions of a file as part of the rpm installation, but I cant find the value I need to provide to the ''%attr'' macro.

The flie is:

ll /var/spool/icinga/cmd/icinga.cmd
prw-rw-rw- 1 icinga icingacmd 84 Apr 28 13:40 /var/spool/icinga/cmd/icinga.cmd

EDIT:

The actual issue is I have icinga.cmd with permissions prw-rw---, but I need it to be prw-rw-rw-. The actual file is created by the icinga process with the above permissions. I tried to automate the chmod including a loop that checks if the mode and permissions of the FIFO are good, but there are a series of complications I did not foresee and I will drop the idea here

Was it helpful?

Solution

You cannot change permissions of a file created/delete at runtime using a package. Therefore the group sticky (g+s 2755) bit was set, allowing the daemon to inherit the group of the parent directory. That way the command pipe is writable (0660) by the icingacmd group. If your application user (which normally is either icinga or apache for web applications) is in that group, you'll have no issues. For icinga and apache users, the rpms already take care (classic ui requires that for instance). The nsca package afaik runs as user nagios, which must be put into the icingacmd group (or you'll consider changing the user nsca running as, to icinga, or a different new one, which is in the icingacmd group).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top