Skip to content

Add a uci config file for matter and fix permissions - #51

Draft
fvb-mind wants to merge 3 commits into
project-chip:mainfrom
fvb-mind:dev/matter-managed-nim
Draft

Add a uci config file for matter and fix permissions#51
fvb-mind wants to merge 3 commits into
project-chip:mainfrom
fvb-mind:dev/matter-managed-nim

Conversation

@fvb-mind

@fvb-mind fvb-mind commented Jul 9, 2026

Copy link
Copy Markdown
  • Add a matter uci config file with one config variable (wifi_iface)
  • Matter could not access ubus --> running as root for now

Note: This PR also includes the change of #50 since we need it and it hasn't been merged yet

@CLAassistant

CLAassistant commented Jul 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds rpcd as a dependency, installs a new UCI configuration file, and comments out the user and group parameters in the init script, causing the daemon to run as root. The review feedback highlights a security regression where the daemon runs as root instead of the unprivileged matter user; it is recommended to restore the unprivileged user and update the ACL permissions instead. Additionally, it is suggested to rename the matter_uci.defaults file to avoid confusion, as it is installed as a configuration file rather than a first-boot defaults script.

Comment thread service/matter-netman/files/matter.init Outdated
Comment on lines +27 to +28
#procd_set_param user matter
#procd_set_param group matter

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

Running the daemon as root instead of the unprivileged matter user is a significant security regression. The reason the daemon could not access ubus is likely because the matter user lacks the necessary permissions in service/matter-netman/files/matter_acl.json to access the uci ubus object (provided by rpcd, which was added as a dependency in this PR) or other required ubus objects.

Instead of running as root, we should keep the daemon running as the matter user and update service/matter-netman/files/matter_acl.json to grant the necessary ubus permissions. For example, to allow reading UCI configurations, you can add the uci object with the get method to the ACL file:

	"access": {
		"otbr": {
			"methods": ["*"]
		},
		"uci": {
			"methods": ["get"]
		}
	}
Suggested change
#procd_set_param user matter
#procd_set_param group matter
procd_set_param user matter
procd_set_param group matter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of running as root you should be able to just add the relevant objects to service/matter-netman/files/matter_acl.json to give the matter user access.

Comment thread service/matter-netman/Makefile Outdated
$(INSTALL_DATA) ./files/bootstrap.sh $(1)/usr/share/matter/
$(INSTALL_DATA) ./files/matter_acl.json $(1)/usr/share/acl.d
$(INSTALL_BIN) ./files/matter.init $(1)/etc/init.d/matter
$(INSTALL_DATA) ./files/matter_uci.defaults $(1)/etc/config/matter

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The source file is named matter_uci.defaults, but it is installed directly as a UCI configuration file to /etc/config/matter. In OpenWrt, .defaults files typically refer to uci-defaults scripts (which are shell scripts executed on first boot). To avoid confusion, the source file should be renamed to matter.config or simply matter in the repository.

	$(INSTALL_DATA) ./files/matter.config $(1)/etc/config/matter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think calling it matter.defaults is fine, have a look at otbr-agent.defaults for an example. They need to be installed into /etc/uci-defaults/; I think what you're doing here will overwrite the config file on a package upgrade.

* Add a matter uci config file with one config variable (wifi_iface)
* Matter could not access ubus --> running as root for now

Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
@fvb-mind
fvb-mind force-pushed the dev/matter-managed-nim branch from 4b54686 to a2079ce Compare August 13, 2026 16:02
@fvb-mind
fvb-mind marked this pull request as draft August 13, 2026 16:03
@fvb-mind fvb-mind changed the title Add a uci config file for matter and run matter as root Add a uci config file for matter and fix permissions Aug 13, 2026
Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants