You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ If you are an AI assistant working on this repository or a project that consumes
12
12
> [!NOTE]
13
13
> There is an **experimental and optional** RGB control interface available (`com.performativenonsense.contextd.rgb`) which allows for active state changes on supported hardware when enabled.
14
14
15
-
-**Unprivileged Access**: No root/sudo is required to query the core socket or RGB sockets. The RGB control socket is currently configured with open permissions (0666).
16
-
-**Authoritative Control**: To persist an authorized RGB controller across boots, a superuser can create `/etc/contextd/rgb-authorized-app` containing the process name of the allowed controller.
15
+
-**Unprivileged Access**: No root/sudo is required to query the core socket or RGB sockets.
16
+
-**Authoritative Control**: To authorize an application (e.g., an RGB controller), a superuser must add the application's systemd unit name (e.g., `openrgb.service`) to the `authorized_units` list in `/etc/contextd/config.toml`.
17
17
-**Data Integrity**: Process IDs and hardware nodes are verified by the daemon before being reported.
Copy file name to clipboardExpand all lines: README.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,13 +105,28 @@ To detach/uninstall:
105
105
sudo portablectl detach contextd
106
106
```
107
107
108
+
## Configuration
109
+
110
+
`contextd` can be configured via a TOML file located at `/etc/contextd/config.toml`. A sample configuration is provided in `examples/config.sample.toml`.
111
+
112
+
### Key Settings:
113
+
-**TTLs**: Control how frequently the daemon polls for games, hardware, and diagnostics.
114
+
-**Blacklisting**: Ignore specific processes or hardware devices.
115
+
-**Security**: Authorize specific systemd units for restricted operations.
116
+
117
+
## Security & Access Control
118
+
119
+
The daemon implements a "dumb" but secure peer validation system:
120
+
-**Unprivileged Public Sockets**: Basic context (active game, hardware list) is accessible via `/run/contextd/public/*.socket` to all users.
121
+
-**Restricted Private Sockets**: Control operations (RGB lighting, controller registration) are restricted via `/run/contextd/private/*.socket`.
122
+
-**Peer Validation**: Uses `SO_PEERCRED` to identify the systemd unit of the calling process.
123
+
-**Granular Authorization**: Restricted methods are only allowed if the caller's systemd unit is listed in the `authorized_units` whitelist in `config.toml`.
Methods like `RegisterController` and `SetLightingContext` are restricted. To run examples that use these methods (like `register_controller.py`), you must ensure:
44
+
1. You are connecting to the **Private** socket path if applicable.
45
+
2. The systemd unit running your script/app is listed in the `authorized_units` whitelist in `/etc/contextd/config.toml`.
46
+
47
+
If you are running an example script manually in a terminal, it will likely be identified by its `session-X.scope`. You can add that scope to the whitelist for testing, or run the script as a transient service with `systemd-run`.
48
+
41
49
> **Note:** The daemon must be running for these examples to work.
0 commit comments