Feature #2902

Check for immutable files managed by Puppet

Added by Brad Fowler over 2 years ago. Updated 5 months ago.

Status:Accepted Start date:12/08/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:file
Target version:-
Affected Puppet version:0.25.1 Branch:
Keywords:
Votes: 1

Description

Puppet should be able to override files it manages that are made immutable with chattr/chflags, perhaps by updating the File resource and determining what environment it’s being run on.

History

Updated by James Turnbull over 2 years ago

  • Status changed from Unreviewed to Needs More Information

Can you elaborate on what you’re trying to do?

Updated by Brad Fowler over 2 years ago

Sure, we just want to be able to clobber immutable files with a flag or something-or-other. So for instance, people for various reasons will chattr +i files that puppet writes after they realize their changes get overwritten, not knowing there are knobs we provide that provide most functionality without having to make the files immutable.

Updated by Nigel Kersten over 2 years ago

This feature may not make a lot of sense to those of you who only use Puppet to manage servers that you have entirely under your own control.

We’re managing a lot of desktops and laptops as well, where users have root privileges and may make a bad decision to chattr/chflag a file to stop Puppet overwriting their local changes.

Updated by James Turnbull over 2 years ago

  • Status changed from Needs More Information to Accepted

Yeah I figured it’d be something like this.

Nigel et al – any suggestions/ideas on how to implement?

Updated by Nigel Kersten over 2 years ago

When we were thinking about it here we came up with three main options.

a) add another parameter to the File resource (make_mutable?) b) add this to the “force” parameter c) Inherit the File resource to a MutableFile resource

Really for upstream puppet only a) or b) make sense. I’m unsure which method makes the most sense.

afaik, the only two implementations for this are chattr and chflags, but my commercial UNIX-fu is pretty weak outside of Linux, BSDs and OS X.

Updated by James Turnbull over 2 years ago

I like b).

Updated by Nigel Kersten over 2 years ago

I think b) is the right approach too, but given it’s a major behavior change (look ma! I even spell like an American now) it’s probably something to push off to rowlf.

Updated by James Turnbull over 2 years ago

  • Target version set to 2.6.0

Agreed – the BEHAVIOUR change – suggests Rowlf – so assigned.

Updated by Andrew Pollock over 2 years ago

A variant of this: have an option to make failures to modify files that are immutable non-fatal.

Updated by Jesse Wolfe about 2 years ago

  • Target version changed from 2.6.0 to 52

Updated by James Turnbull about 1 year ago

  • Target version deleted (52)

Updated by Wolf Noble 9 months ago

Some ability to interact with “immutable” files would be nice, but I can work around it with a pair of execs if this isn’t going to be implemented.

Updated by Nigel Kersten 9 months ago

Wolf, can you elaborate more on what you’d like to be able to do with immutable files?

Do you want the force == “remove immutable bits if present” behavior? Do you want to be able to make files immutable via puppet more easily?

Updated by Wolf Noble 9 months ago

I’d like to be able to manage and work with/around files' extended attributes.. most especially mutability. if a file is immutable, and I’ve a need to update or change it, I’d like the ability to do so within a file resource. perhaps setting: mutability => true (normal: would basically be an exec chattr -i if the file is immutable) mutability => false (immutable: would set the file to immutable when changed) mutability => respect (default: whine when attempting to update/change/remove a file which is immutable with a reasonable error message)

(or something)

Updated by Federico Voges 6 months ago

I agree with Wolf there. Some people might want to use the immutable to prevent people changing the files, and other people might want to use it to prevent puppet changing a specific file (testing changes in a single server, debugging a problem in a production system, etc.).

So Puppet should be able to: – remove immutable flag – set immutable flag – ignore immutable flag (and report as pending if it can’t change the file)

Updated by Nigel Kersten 5 months ago

Is immutability the only extended attribute we want to control?

e.g. here’s the chflags options you have on a BSD/OS X.

           arch, archived
                   set the archived flag (super-user only)

           opaque  set the opaque flag (owner or super-user only).  [Directory is opaque when viewed
                   through a union mount]

           nodump  set the nodump flag (owner or super-user only)

           sappnd, sappend
                   set the system append-only flag (super-user only)

           schg, schange, simmutable
                   set the system immutable flag (super-user only)

           uappnd, uappend
                   set the user append-only flag (owner or super-user only)

           uchg, uchange, uimmutable
                   set the user immutable flag (owner or super-user only)

           hidden  set the hidden flag [Hide item from GUI]

chattr gives us relatively similar options.

Also available in: Atom PDF