Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 621660 - sys-apps/openrc should limit usage of basic utilities and provide restriction for filesystem access
Summary: sys-apps/openrc should limit usage of basic utilities and provide restriction...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-13 09:44 UTC by Sergey S. Starikoff
Modified: 2017-06-25 19:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey S. Starikoff 2017-06-13 09:44:51 UTC
Some time ago I was wondered finding empty '/$' directory in the root of filesystem.
Debugging showed, that it was created by openrc (for now =sys-apps/openrc-0.24.2), starting a buggy custom init script.
According to FHS, ordinar users should not be able to create/modify files outside /home/${user}, /var and /tmp (root also can edit configs in /etc). All other files in /usr, /lib and other system directories must be handled with package menagement system (i.e. sys-apps/portage).
For a years ago sys-apps/portage switched from direct invocation of mkdir and other core utilities to usage built-in functions (dodir and others).
Probably, openrc should follow ebuild tool, providing safe built-ins for all necessary functions (allowing filesystem write only for creation pid files into /var/run, empty log files into /var/log for services, configured for file logging, creation file and writing its own log and, possibly some dynamic mount points somewhere in /tmp) and at least warning, when init script uses direct invocation of core utilities.

P.S. Bug #438964 describes similiar issue, possibly valid exception.
Comment 1 William Hubbs gentoo-dev 2017-06-25 19:32:32 UTC
I understand your concern; however, I do not see it as something OpenRC
can fix for several reasons.

- OpenRC doesn't have a way of knowing where a service needs write
  access.

  - Most of the "basic utilities" you are referring to are not part of
	OpenRC, so I think they would all have to be updated to respect any
	scheme that does this.

	To give you a short answer, I do not see a clean way this could be
	done internally to OpenRC.

	Patches, however, are definitely welcome, so if you can come up with
	an implementation let me know.

	Thanks,

	William