Homed bulk directories v2 - #30840
Conversation
e7aaad8 to
e00f082
Compare
23a18ab to
77741d9
Compare
|
Unforeseen issue I ran into w/ this approach: signatures Right now the code works something like this. If a caller wants to change the bulk directory, they add So here's the problem: Before handing the JSON record into homework, homed signs it first. This signature happens before homework strips the This all also brings in a natural follow-up question: should the contents of the bulk directory be signed into the user record? Couple ideas on how to solve this:
|
77741d9 to
93fc727
Compare
93fc727 to
b3f4ace
Compare
b3f4ace to
39b984a
Compare
39b984a to
89109c7
Compare
|
So for various fields we allow overriding via the binding section. I think a scheme where we have one of these dirs declared in the regular user record, and then overriden with the copied out version in the binding section does make sense to me. thta would would mean clients would always have to check the binding first, and only when not set use the original one. but we do something similar with |
|
btw, should we really name this "bulk"? i.e. is that really descriptive enough? it's just saying something about the size. But I think its more important to say something about the public exposure of the data contained in there. Hence maybe publicResourceDirectory? |
|
I'd probably not try to hide the updating of the bulkdir in the updating of the record, but keep that a separaze operation, where you just pass in an fd to a temporary dir with the new bulkdir, and homed does the replacement. |
|
I am still not onboard with moving the identity file down one level. This just opens uip the door to various vulnerabilities with symlinks. i.e. people could then replace .identity/ with a symlink to anything they like and a simple O_NOFOLLOW when opening the identity file won't suffice anymore to avoid being tricked. i.e. the tough bit here is that privileged code is going to access this, and we should not make it easy for an evil user to trick priv code to read stuff it shouldn't read, and trusting it because the object's perms actually indicate its owend by root. but in reality somebody just redirected things via symlinks. |
|
please rebase |
60687b4 to
de29e26
Compare
|
i don't like the passing down of the flags field still |
poettering
left a comment
There was a problem hiding this comment.
let's get this baby landed.
|
please fix those error return things, and we are good to go. |
|
CI failures appear unrelated:
|
|
too many failures for comfort, I've hit the rebase button for another run |
This is useful for situations where an array of FDs is to be passed into a child process (i.e. by passing it through safe_fork). This function can be called in the child (before calling exec) to pack the FDs to all be next to each-other starting from SD_LISTEN_FDS_START (i.e. 3)
We're documenting the behavior of blob directories here. These docs refer to things that aren't yet implemented at the time of the commit, but will be later in the same PR.
These fields are used to connect a JSON user record to its blob directory, and to include the directory's contents in the record's signature
This ensures that a user-specific blob directory exists in /var/cache/systemd/homed for as long as the user exists, and gets deleted if the user gets deleted. It also advertises this blob directory via the user record, so that clients can find and use it.
Whenever the host & embedded records are reconciled, the host & embedded blob directories are now reconciled too in the same direction. Reconciling the blob directories serves exactly the same purpose as reconciling the user records, and thus should behave in the same way.
Introduces new extended variants of the various incarnations of Create and Update, which take a map of filenames to FDs. This map is then used to populate the bulk directory. FDs are used to prevent the client from abusing homed's blob directory permissions (everything is made world-readable by homed) to open files that they normally aren't allowed to open. Passing along an FD ensures that the client has read access to the file it wants homed to make world-readable. Internally, homework uses the map to overwrite the system blob dir. Later, homework's existing blob dir reconciliation logic will propagate the new contents from the system blob dir into the embedded blob dir
This makes it possible to edit blob directories using homectl. The following syntax is available: * `--blob-directory=/path/somewhere`: Replaces the entire blob directory with the contents of /path/somewhere * `--blob-directory=foobar=/path/somewhere`: Replaces just the file foobar in the blob directory with the contents of /path/somewhere * `--blob-directory=foobar=`: Deletes the file foobar from the blob directory * `--blob-directory=`: Resets all previous flags * `--avatar=`, etc: Shortcuts for `--blob-directory=FILENAME=` for the known files in the blob directory
|
🎉 Thank you! |
This is a reimagined approach for #30646, as I described in this comment
Depends on #31004
Fixes: #18323