Add permissions function peach-config #56

Merged
notplants merged 3 commits from permissions into main 2021-12-22 17:18:24 +00:00
Owner

This PR adds a command to peach-config which correctly updates the file permissions on the PeachCloud device.

peach-config permissions

I find during development that sometimes I accidentally get file permissions into a weird state, and that it would be helpful to have an idempotent function to get permissions back into the correct state. This could also be helpful for helping users debug their systems in the future remotely.

For now it just sets /var/lib/peachcloud to 660 peach:peach. Having one function to declare the permissions also helps us reason more specifically in one place about what the permissions model is supposed to be.

This PR adds a command to peach-config which correctly updates the file permissions on the PeachCloud device. ``` peach-config permissions ``` I find during development that sometimes I accidentally get file permissions into a weird state, and that it would be helpful to have an idempotent function to get permissions back into the correct state. This could also be helpful for helping users debug their systems in the future remotely. For now it just sets /var/lib/peachcloud to 660 peach:peach. Having one function to declare the permissions also helps us reason more specifically in one place about what the permissions model is supposed to be.
notplants added 1 commit 2021-12-18 15:03:01 +00:00
notplants requested review from glyph 2021-12-18 15:03:57 +00:00
notplants added 1 commit 2021-12-18 15:22:56 +00:00
glyph requested changes 2021-12-22 12:56:31 +00:00
glyph left a comment
Owner

Besides the Rust-specific feedback, I really love this permissions feature! I've been perplexed many times by permissions-related issues in the past, especially in the context of sysadmin tasks.

I wonder if this should also set permissions for /usr/share/peach-web?

Besides the Rust-specific feedback, I really love this permissions feature! I've been perplexed many times by permissions-related issues in the past, especially in the context of sysadmin tasks. I wonder if this should also set permissions for `/usr/share/peach-web`?
@ -17,6 +18,7 @@ use crate::change_password::set_peach_web_password;
use crate::generate_manifest::generate_manifest;
Owner

I recommend not specifying paths all the way down to the function level when importing. It makes it neater when calling the function (only having to type generate_manifest() and not generate_manifest::generate_manifest()) but more difficult to navigate the codebase, especially as a 2nd party dev / contributor.

Idiomatic imports are covered in the Rust Book.

Bringing the function’s parent module into scope with use means we have to specify the parent module when calling the function. Specifying the parent module when calling the function makes it clear that the function isn’t locally defined while still minimizing repetition of the full path.

I recommend not specifying paths all the way down to the function level when importing. It makes it neater when calling the function (only having to type `generate_manifest()` and not `generate_manifest::generate_manifest()`) but more difficult to navigate the codebase, especially as a 2nd party dev / contributor. Idiomatic imports are covered in [the Rust Book](https://doc.rust-lang.org/stable/book/ch07-04-bringing-paths-into-scope-with-the-use-keyword.html?highlight=idiomatic#creating-idiomatic-use-paths). > Bringing the function’s parent module into scope with use means we have to specify the parent module when calling the function. Specifying the parent module when calling the function makes it clear that the function isn’t locally defined while still minimizing repetition of the full path.
glyph marked this conversation as resolved
notplants changed target branch from copy-rocket-toml to main 2021-12-22 14:53:47 +00:00
notplants added 1 commit 2021-12-22 15:04:31 +00:00
Author
Owner

cool makes sense! I changed the imports and added some chmod commands to set the permissions for /usr/share/peach-web

cool makes sense! I changed the imports and added some chmod commands to set the permissions for /usr/share/peach-web
Owner

Great, thanks! Clear for merge 🟢

Great, thanks! Clear for merge 🟢
notplants merged commit 068d3430d7 into main 2021-12-22 17:18:24 +00:00
notplants deleted branch permissions 2021-12-22 17:18:24 +00:00
Sign in to join this conversation.
No description provided.