1

I am running into a problem with labeling. In order to lock down access to a file /etc/avahi/avahi-daemon.conf I decided to label it as a part of the avahi_t domain.

I am working on an embedded system. When I boot up the system from a version update, the file system is relabeled with the .autorelabel flag set.

Unfortunately the file /etc/avahi/avahi-daemon.conf remains in the unlabeled_t type. Due to the label being wrong, it is unable to read the file and avahi fails to initialize properly with an avc read denied on an unlabeled_t file. I want to have the label correctly set and not modify policy to read an unlabeled file. I also want it to be protected so the configuration can not be modified.

I have properly labeled it in the .fc file with the following:
/etc/avahi/avahi-daemon.conf -- gen_context(system_u:object_r:avahi_t,s0)

When I try a restorecon on the file system it attempts to relabel the file but is blocked by SELinux with a relabelto avc violation. Similarly changing it with chcon -t fails to change it. I do not wish to open relabelto up on an embedded system as it can then be relabeled and take down the avahi initialization. If I take out the SD card, and relabel the file on a different system. And place it back into the target system it is properly labeled. And avahi operates correctly. So I am certain that the labeling is causing the problem.

In looking in the reference policy an init_daemon_domain(avahi_t,avahi_exec_t) is being performed. In looking at the documentation for init_daemon_domain() it states the following:

"The types will be made usable as a domain and file, making calls to domain_type() and files_type() redundant."

This is unusual in that if I add files_type(avahi_t) to the .te file, it properly labels after version update.

I am really wanting to know more information about this, and unfortunately my searches on the internet have been less than fruitful in this regard.

Is the documentation for SELinux wrong? Am I missing something about init_daemon_domain() in that it only works with processes and not files?

Or is the files_type(avahi_t) truly needed?

I know this comes off as a trivial issue since there is a path to where it is working. However I am hoping to get an explanation as to why files_type(avahi_t) is necessary?

Thanks

Tippy
  • 11
  • 1

0 Answers0