Implementing fully immutable files
Implementing fully immutable files
Posted Apr 20, 2019 2:44 UTC (Sat) by epa (subscriber, #39769)In reply to: Implementing fully immutable files by wahern
Parent article: Implementing fully immutable files
(You can compare the different meanings of ‘const’ or ‘readonly’ in languages like C++, Java and C# for another example of how an object can be read-only for you, or have a positive guarantee that it won’t be mutated while you hold a reference to it. Locking in database systems is another place where you have to separate the two meanings.)
You may be right that in practice it makes little difference. Immutable files are a specialized feature. But if you’re going to have them at all, surely they should be implemented properly. A guarantee of immutability isn’t worth much unless it holds all of the time.
Posted Apr 20, 2019 5:59 UTC (Sat)
by lkundrak (subscriber, #43452)
[Link] (7 responses)
Unless you, of course, turn off the immutable bit.
I'm quite honestly having trouble finding it hard to understand the use case where the immutable files provide any sort of useful guarantee.
Posted Apr 20, 2019 12:21 UTC (Sat)
by mikemol (guest, #83507)
[Link]
I could easily construct a high-confidence system that relied on the audit framework to tell me when someone is playing with the immutable bit without the overhead of logging on every write attempt to the file in question, for example. Then, I can rely on the immutable bit (with some restrictions) as I make an assertion that a file does not, shall not change.
I can see use cases in antivirus frameworks, configuration management frameworks, logging and auditing frameworks, and so on. Effectively, any system where demonstrable, positive control over a system accessible to untrusted individuals.
It's not a magic bullet, but a useful armor layer.
Posted Apr 20, 2019 13:01 UTC (Sat)
by epa (subscriber, #39769)
[Link] (3 responses)
Posted Apr 22, 2019 16:39 UTC (Mon)
by wahern (subscriber, #37304)
[Link] (2 responses)
I'm sure some people would find the proposed behavior of revoking mmap access useful, too. But the additional complexity is *tremendous* and, IMO, not worth the marginal benefit, even if there are a handful of organizations that *must* have the feature. I mean, if they really need such behavior they can always just terminate all processes with open file handles after making a file immutable. Messy, but at least the mess doesn't become a long-term maintenance burden for everybody else. It's a dubious guarantee, anyhow, considering how easy it will be to accidentally break the invariant.
Posted Apr 22, 2019 19:44 UTC (Mon)
by wahern (subscriber, #37304)
[Link]
Posted Apr 22, 2019 20:15 UTC (Mon)
by rweikusat2 (subscriber, #117920)
[Link]
"no data can be written to the file"
someone apparently noted that this wasn't accurate and corrected to documentation to
"the file can not be opened in write mode."
I seriously doubt that there's any organisation on this planet which suddenly "must" have this feature. Methinks this is more something like a bored Oracle guy making undirected changes to a codebase (possibly "a sufficiently well-connected, bored Oracle guy that such undirected changes actually get accepted instead of being stonewalled").
Posted Apr 21, 2019 0:30 UTC (Sun)
by mm7323 (subscriber, #87386)
[Link]
As for security guarantees, wouldn't something like SElinux be more appropriate, fine grained and auditable than this mechanism? That said, I have no idea if SElinux or similar behave sanely if policy is changed while files are already opened or memory mapped...
Posted Apr 22, 2019 15:15 UTC (Mon)
by janfrode (subscriber, #244)
[Link]
https://www.ibm.com/developerworks/community/wikis/home?l...
Implementing fully immutable files
Implementing fully immutable files
Implementing fully immutable files
Implementing fully immutable files
Implementing fully immutable files
Implementing fully immutable files
(Debian 7 man page)
(http://man7.org/linux/man-pages/man1/chattr.1.html)
Implementing fully immutable files
Implementing fully immutable files