-
Notifications
You must be signed in to change notification settings - Fork 189
ENT-10961, CFE-1840: Files promise can now modify immutable bit in file system attributes #5752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thank you for submitting a PR! Maybe @craigcomstock can review this? |
bdd1918
to
69b1f52
Compare
06b3676
to
578286c
Compare
MMM, the transformer attribute comes to mind.
Looking at the files promise docs I imagine that
And the And
I added them to the description. |
f82867d
to
2f16047
Compare
7b81817
to
50ad347
Compare
50ad347
to
2eec801
Compare
@cf-bottom Jenkins with exotics please :) |
Alright, I triggered a build: (with exotics) Jenkins: https://ci.cfengine.com/job/pr-pipeline/12188/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-12188/ |
b1c4763
to
0559bfe
Compare
The touch attribute of the files promise can now override the immutable bit. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <[email protected]>
Signed-off-by: Lars Erik Wik <[email protected]>
The transformer attribute of the files promise can now override the immutable bit. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <[email protected]>
When renaming a file using the OverrideImmutableRename() function, the immutable bit is temporarily removed from both the old and new (if it already exists). The immutable bit is then inherited from old to new file. Signed-off-by: Lars Erik Wik <[email protected]>
The rename attribute of the files promise can now override the immutable bit. The disabled file will inherit the immutable trait of the original file. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <[email protected]>
The perms attribute of the files promise can now override the immutable bit. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <[email protected]>
The acl attribute of the files promise can now override the immutable bit. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <[email protected]>
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: CFE-4529 Changelog: Title Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: CFE-4529 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
13f8333
to
7dc51ff
Compare
Sure, I triggered a build: (with exotics) Jenkins: https://ci.cfengine.com/job/pr-pipeline/12284/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-12284/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! A high-level question about atomicity and maybe one typo. :)
} | ||
|
||
/* We'll match the original file permissions on commit */ | ||
if (!CopyRegularFileDiskPerms(orig, copy, 0600)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should change the orig file to immutable just before this copy. Not 100% atomic but pretty close so that between this Begin() and the Commit() no one else can "easily" modify the file without also modifying the immutable bit of course.
* @return false in case of failure | ||
* @note The immutable bit is reset to it's original state | ||
*/ | ||
bool OverrideImmutableCommit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it seems that we should have something like:
OverrideImmutableBegin(struct utimbuf *times) to capture the modified/access times when we begin the "transaction"
Also, during this Begin() we should make the file immutable to attempt to restrict access as much as possible while we do "work" and before we call Commit().
And then OverrideImmutableCommit() takes that as a parameter and if the original file has changed mod/access since Begin() we should fail to commit saying that the file changed inside of the window of time of the transaction to modify the immutable file.
|
||
if (a.havefsattrs && a.fsattrs.haveimmutable && !a.fsattrs.immutable) | ||
{ | ||
/* Here we only handle the clearing of the immutable the immutable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* Here we only handle the clearing of the immutable the immutable | |
/* Here we only handle the clearing of the immutable |
|
||
/* If we encounter any promises to mutate the file and the immutable | ||
* attribute in body fsattrs is "true", we will override the immutable bit | ||
* by temporarily clearing it when ever needed. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* by temporarily clearing it when ever needed. */ | |
* by temporarily clearing it whenever needed. */ |
static const FnCallArg GET_ACLS_ARGS[] = | ||
{ | ||
{CF_ABSPATHRANGE, CF_DATA_TYPE_STRING, "Path to file or directory"}, | ||
{"default,access", CF_DATA_TYPE_OPTION, "Whether to get default or access ACL"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is our "menu" item list for an attribute right? Is this required and if not, defaulted to "default"? I will probably find out later in the review. :)
TODO:
content
attributecopy_from
attributedelete
attributeedit_line
attributeedit_xml
attributeperms
attributetouch
attributeedit_template
attributeacl
attributetransformer
attributerename
attributeIs there any other ones that I've missed?