Refine /etc/matter layout for network-manager daemon#49
Merged
Conversation
Change /etc/matter to be owned by root and group-readable and move non-factory data into /etc/matter/data; only this sub-directory is now owned by the matter user. Change permissions of chip_factory.ini to be no longer group or world readable. Run the daemon with umask 027 instead of the default 022. These changes make it easier to "factory reset" the Matter service by deleting /etc/matter/data, and lay the ground work for giving another daemon read-access to some files managed by the matter daemon via the matter group (e.g. letting hostapd read /etc/matter/network). Also simplify get_model_name() to use jsonfilter instead of jshn (this is the same logic also used in the otbr-agent init script). jsonfilter is a dependency of the base-files package, so is always already available in practice. Also add the missing jsonfilter dependency to the openthread-br package.
There was a problem hiding this comment.
Code Review
This pull request migrates Matter configuration and persistence data from /etc/matter to /etc/matter/data, replaces custom JSON parsing in bootstrap.sh with jsonfilter, and introduces umask restrictions. The review feedback suggests three key improvements: unconditionally setting correct ownership and permissions on /etc/matter to avoid skipped migrations, checking for file existence before moving them during migration to prevent shell errors, and using the native procd_set_param umask in the init script instead of spawning an intermediate shell.
Contributor
|
I went over it only briefly and haven't tested it, but the changes look good to me 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change /etc/matter to be owned by root and group-readable and move non-factory data into /etc/matter/data; only this sub-directory is now owned by the matter user. Change permissions of chip_factory.ini to be no longer group or world readable. Run the daemon with umask 027 instead of the default 022.
These changes make it easier to "factory reset" the Matter service by deleting /etc/matter/data, and lay the ground work for giving another daemon read-access to some files managed by the matter daemon via the matter group (e.g. letting hostapd read /etc/matter/network).
Also simplify get_model_name() to use jsonfilter instead of jshn (this is the same logic also used in the otbr-agent init script). jsonfilter is a dependency of the base-files package, so is always already available in practice. Also add the missing jsonfilter dependency to the openthread-br package.