The USP (User Services Platform) permission system is a critical component of the TR-369 specification, designed to provide robust and granular access control for managing connected devices. It's a complex interplay between the Controller and the Agent, leveraging various mechanisms to ensure security and compliance.
The USP permission system operates on the principle of least privilege, meaning that any entity (Controller) interacting with a USP Agent (the managed device) should only be granted the minimum necessary access rights to perform its intended function. This is vital in heterogeneous environments with multiple stakeholders (e.g., ISPs, IoT platforms, end-users) and diverse devices.
The system is characterized by a layered approach:
- Controller-Side (Proactive Evaluation): The Controller is responsible for determining if its internal user (human or automated process) is authorized to initiate a specific USP operation. This acts as a first line of defense, preventing unauthorized requests from even being sent to the Agent. Our Go program's RBAC/ABAC logic resides here.
- Agent-Side (Primary Enforcement): The Agent is the ultimate authority for access control. Every USP message received by the Agent is rigorously validated against its configured security policies before any action is performed on the device's resources. This is where the core enforcement logic resides, ensuring the device's integrity regardless of the Controller's intent or potential compromise.
To understand the USP permission system fully, the following key concepts are essential, drawing from TR-369, TR-181 (Device Data Model), and TR-106 (Data Model Template):
- Controller Identity & Trust: Each USP Controller has a unique
ControllerID. The Agent must be configured to trust specific Controllers. This trust is established through:- Mutual Authentication: Typically using X.509 certificates (mTLS) over secure Message Transfer Protocols (MTPs) like WebSockets, MQTT, or UNIX Domain Sockets. The
subjectAltNameextension in the certificate is used to convey theControllerID(R-SEC.0a). - Pre-shared Keys/Enrollment: Agents can be pre-provisioned with trusted
ControllerIDs or keys. - Dynamic Onboarding: A highly privileged Controller can dynamically onboard and grant permissions to new Controllers by modifying the Agent's internal
Device.LocalAgent.Controllerobject (R-DIS.0).
- Mutual Authentication: Typically using X.509 certificates (mTLS) over secure Message Transfer Protocols (MTPs) like WebSockets, MQTT, or UNIX Domain Sockets. The
- Agent Identity: Each USP Agent has a unique
EndpointID, which Controllers use to target specific devices. - Data Model & Attributes (TR-181, TR-106): USP Agents expose their capabilities and configurable parameters through a hierarchical data model (e.g.,
Device.WiFi.SSID,Device.Reboot()). Critical attributes for permissioning include:Writable: Indicates if a parameter's value can be changed by aSetmessage.Addable: Indicates if new instances of an object can be created under a parent path via anAddmessage.Deletable: Indicates if an instance of an object can be removed via aDeletemessage.Executable: Indicates if a command can be invoked via anOperatemessage.Secured: (From TR-106 and TR-181). This is paramount. ASecuredparameter or object requires special authorization. Access toSecuredelements is restricted to Controllers with higher trust levels or specific roles (like theSecuredRolementioned in TR-369 Amendment 3, or thesecured_userrole in our Go program). This attribute protects sensitive configurations (e.g., Wi-Fi passwords, admin credentials, factory reset commands).
- Access Control Lists (ACLs) / Roles: On the Agent side, ACLs (or "Roles" as USP refers to them, implying a set of permissions) are the primary mechanism for runtime permission enforcement (
R-SEC.1). An ACL maps aControllerIDto allowed operations on specific data model paths. ACLs can use path patterns (wildcards likeDevice.**), specify allowed operations (Get,Set,Add,Delete,Operate), and are evaluated in a defined order (most specific rule takes precedence). The fundamental rule is Default Deny: if no explicit rule grants access, access is denied.- TR-369 Amendment 3 introduces the concept of
SecuredRoleand clarifies that role permissions apply to both Supported and Instantiated Data Models, and specifically tosecuredparameters.
- TR-369 Amendment 3 introduces the concept of
- Interface Security: USP allows Agents to apply different security policies based on the originating MTP interface. For instance, a local UNIX Domain Socket MTP (
UDSConnectRecord) might have different trust implications than a remote WebSocket MTP (WebSocketConnectRecord) or MQTT MTP (MQTTConnectRecord).
The Agent is the ultimate authority. Every USP message undergoes a multi-stage authorization process:
- MTP-Level Security & Authentication: The Agent first authenticates the Controller's connection using MTP-specific mechanisms (e.g., mTLS certificates, shared secrets). This verifies the identity of the Controller.
- Example from
usp.txt: Thespecification/securitydirectory contains diagrams likecheck-cert.pnganddetermine-role.pngthat illustrate how the Agent checks the Controller's certificate and derives itsRoleor trust level based on factors like trusted Certificate Authorities (TrustedCertificateAuthoritiesin TR-369).R-E2E.43explicitly states that USP Endpoints MUST be mutually authenticated using X.509 certificates.
- Example from
- USP Message Parsing & Controller Identification: The Agent parses the incoming USP message (Protocol Buffers) and extracts the
ControllerIDfrom the header (from_id). - ACL Evaluation (Policy Decision Point - PDP):
- For the extracted
ControllerIDand theRequested Path(the data model element being targeted by the USP message), the Agent consults its internal ACLs (its defined "Roles"). - It finds the most specific ACL rule that applies.
- It checks if the requested USP operation (
Get,Set,Add,Delete,Operate) is permitted by that rule. - Default Deny: If no explicit rule grants access, it's denied.
R-SEC.1(fromusp.txt): "An Agent MUST confirm a Controller has the necessary permissions to perform the requested actions in a Message prior to performing that action." This is the core requirement for Agent-side authorization.
- For the extracted
- Data Model Attribute Checks (Fine-grained Authorization):
- Even if the ACL grants general permission, the Agent performs a secondary check against the inherent attributes of the target data model element.
WritableCheck: ForSetoperations, the Agent confirms the parameter isWritable.Addable/DeletableCheck: ForAddandDeleteoperations, the Agent checks the parent object/target instance forAddableorDeletableattributes.ExecutableCheck: ForOperatemessages, it confirms the command isExecutable.SecuredParameter Handling: If a parameter isSecured, the Agent's policy explicitly requires higher privileges (e.g.,SecuredRole). TheROLE_POLICIESin our Go program demonstrate this by routing requests forSecuredresources through thecanAccessSecuredResourcepolicy function. Theusp.txtCHANGELOG.mdforv1.4.0explicitly states: "Updated Role Definition Section with clarifications to Role permissions applying to Supported and Instantiated Data model and the Secured Role as applying to 'secured' parameter in the path(s), with examples of both."
- Interface Security (Binding-Specific):
- Different MTPs might have varying levels of inherent security or be exposed on different network segments. The Agent can apply additional restrictions based on the MTP used (e.g., blocking
Setmessages over insecure MTPs for certain sensitive parameters).usp.txtdescribes MTP bindings like WebSocket (RFC6455), MQTT (MQTT-5-0), STOMP (STOMP-1-2), and UNIX Domain Sockets. Each MTP section in TR-369 includes specific security considerations and requirements (e.g.,R-MTP.5inspecification/mtp/index.mdfor error handling).
- Different MTPs might have varying levels of inherent security or be exposed on different network segments. The Agent can apply additional restrictions based on the MTP used (e.g., blocking
The Controller acts as the Policy Enforcement Point (PEP) for its own users before even generating USP messages.
- Internal IAM (RBAC/ABAC): The Controller manages its own user identities, roles, and attributes. Our Go program's
Userstruct,RoleNameenums,AppPermissionenums,ROLE_DEFINITIONS, andROLE_POLICIESmaps directly implement this. PolicyContext(PIP): For each requested action, the Controller gathers relevant attributes (user's roles/department, target Agent's owner/department,Securedstatus of the parameter being accessed, current time, IP address). ThisPolicyContextis then passed to the PDP.CheckPermission(PDP): This function determines if the user is authorized based on a hybrid evaluation of their roles (RBAC) and specific attribute-based policies (ABAC). This prevents unauthorized requests from leaving the Controller's domain.- Synchronization: While not explicitly a "USP" requirement for the Agent, Controllers need to handle
USP_ERRORmessages from the Agent, especially7006 (Permission Denied), to update their internal state or inform the user that their request was rejected at the Agent. This feedback loop is crucial for a robust system.
- Scenario: An "ISP Customer Service" Controller user attempts to change
Device.WiFi.SSID(non-secured, writable) andDevice.WiFi.Password(secured, writable) onagent-001. The "ISP Customer Service" user is only assigned theRoleOperatorrole, which in our policies, canServiceElementUpdateif the agent'sDepartmentmatches, but it doesn't havecanAccessSecuredResourcegranted generally. - Controller-Side:
- The Controller's internal logic (e.g., triggered by a web UI for the customer service agent) prepares a
SETUSP message. - Before sending, the Controller's
CheckPermissionis invoked forServiceElementUpdateonDevice.WiFi.SSIDandDevice.WiFi.Password. - For
Device.WiFi.SSID: PolicycanUpdateAgentIfDepartmentMatchesis checked. Ifagent-001's department matchesoperator1's department ("Operations"), this part passes. - For
Device.WiFi.Password: TheServiceElementUpdatepermission is checked. Even ifcanUpdateAgentIfDepartmentMatchespasses, thecanAccessSecuredResourcepolicy (triggered becauseDevice.WiFi.PasswordisSecured) will likely fail forRoleOperatorbecauseIsSecuredisfalseforoperator1, andRoleOperatordoes not implicitly gain secured access. - Outcome (Controller): The Controller might prevent sending the entire
SETmessage or redact theDevice.WiFi.Passwordpart if its internal logic is sophisticated enough. If it sends the message anyway, the Agent will catch it.
- The Controller's internal logic (e.g., triggered by a web UI for the customer service agent) prepares a
- Agent-Side Enforcement:
- Agent receives the
SETmessage from the Controller. - MTP/Authentication: Validates the Controller's connection (e.g., mTLS).
- Overall Message Permission: Checks
USPMessageSetfor the Controller's identity. (Assume it passes for operators generally). - Per-Path/Attribute Checks:
- For
Device.WiFi.SSID:- Checks
ServiceElementUpdatefor this path. (Passes as per ACL/Role). - Checks
Writableattribute ofDevice.WiFi.SSID(true in ourAgent.DataModel). (Passes). - Checks
Securedattribute (false). (PassescanAccessSecuredResourcetrivially). - Result: SSID is updated.
- Checks
- For
Device.WiFi.Password:- Checks
ServiceElementUpdatefor this path. (Passes as per ACL/Role). - Checks
Writableattribute ofDevice.WiFi.Password(true). (Passes). - Crucial
Securedcheck: The Agent seesDevice.WiFi.PasswordisSecured. It invokes thecanAccessSecuredResourcepolicy (Policies["canAccessSecuredResource"](policyCtx)). Sinceoperator1is notIsSecuredand notadmin, this policy returnsfalse. - Outcome: Password update is denied.
- Checks
- For
- Error Reporting: The Agent sends a
SET_RESPUSP message. TheModifiedPathslist will includeDevice.WiFi.SSID, but notDevice.WiFi.Password. Instead, the response (in a real USP message, or conceptually in our simulated one) would include aSetFailureelement forDevice.WiFi.Passwordwitherr_code: 7006(USPErrorPermissionDenied) and an appropriateerr_msg.
- Agent receives the
- Scenario:
- ISP Controller (
admin1,RoleAdmin, Department: Operations): Managesagent-001. Needs full control. - Third-Party Diagnostic App Controller (
diag_user,RoleViewer, Department: Support): Wants to monitoragent-002's performance stats (Device.LAN.1.Stats.BytesSent).
- ISP Controller (
- Agent-Side Enforcement (ACL Configuration):
agent-001(owned byadmin1in Operations): Has ACLs configured (or implicit policies) grantingadmin1full access.agent-002(owned byoperator1in Sales): Has ACLs allowingdiag_user(RoleViewer) read access toDevice.LAN.1.Stats.**but noSet/Add/Delete/Operatepermissions on any path, and no access toSecuredparameters.
- Controller-Side Evaluation:
- ISP Controller:
admin1attemptsSetonagent-001'sDevice.Time.NTPServer1. The Controller's internal logic confirmsadmin1hasUSPMessageSetandServiceElementUpdatepermissions. PolicycanUpdateAgentIfDepartmentMatchesis evaluated for agent1. Sinceadminrole bypasses most checks, it succeeds. The USPSETmessage is sent. - Diagnostic Controller:
diag_userattemptsGetonagent-002'sDevice.LAN.1.Stats.BytesSent. The Controller's internal logic confirmsdiag_userhasUSPMessageGetandServiceElementViewpermissions. ThecanViewAgentIfUnblockedpolicy is also checked. The USPGETmessage is sent. - Diagnostic Controller attempts
Setonagent-002'sDevice.LAN.1.IPAddress: The Controller's internalCheckPermissionforUSPMessageSetandServiceElementUpdatefordiag_userwill fail based onROLE_POLICIES[RoleViewer]which explicitly setsUSPMessageSettofalse. The UI fordiag_useron the Controller might not even allow this action to be selected.
- ISP Controller:
- Agent-Side Enforcement:
- ISP Controller (for
agent-001): All operations are permitted by Agent's ACLs and data model attributes.SetonDevice.Time.NTPServer1succeeds. - Diagnostic Controller (for
agent-002-GetonStats):- Agent receives
GETfromdiag_user. - ACL grants
USPMessageGettoRoleViewer. - ACL grants
ServiceElementViewtoRoleVieweronDevice.LAN.1.Stats.**. Device.LAN.1.Stats.BytesSentis notSecured.- Outcome: Success. Agent returns
GET_RESPwith data.
- Agent receives
- Diagnostic Controller (for
agent-002-SetonIPAddress):- Agent receives
SETfromdiag_user. - ACL denies
USPMessageSettoRoleViewer(or no explicit grant). - Outcome: Agent immediately returns
USP_ERROR(7006) to the Diagnostic Controller.
- Agent receives
- ISP Controller (for
- Scenario: A new "Home Automation App" (e.g.,
controller-iot-app) needs to control a smart bulb (Device.IoT.Bulb.1.) connected toagent-001. Initially,agent-001has no ACL entries forcontroller-iot-app. - Agent-Side Enforcement:
- Initial State (
agent-001): Default ACL behavior is "deny all" for unknown controllers. TheDevice.IoT.Bulb.1.object isWritableandAddablebut itsLightLevelparameter isSecuredandWritable. - Onboarding: A trusted ISP Admin (
admin1) sends aSETUSP message toagent-001to add a newDevice.LocalAgent.Controllerentry and associated ACL rules forcontroller-iot-app. The ACL entry grantsSetandGetpermissions only toDevice.IoT.Bulb.1.ColorandDevice.IoT.Bulb.1.Brightnessforcontroller-iot-app. It also setscanAccessSecuredResourcepolicy totruefor this specific controller onDevice.IoT.Bulb.1.**. - Agent
admin1'sSETon ACL objects is authorized (sinceadmin1has full control). The ACL is updated. - IoT App attempts
SetonDevice.IoT.Bulb.1.Color(value: "Red"):- IoT App Controller sends
SETUSP message fromcontroller-iot-app. - Agent receives
SET. ChecksUSPMessageSetforcontroller-iot-app. (Passes if the onboarding process also included granting genericUSPMessageSetto new app controllers, or the specificcanAccessSecuredResourcepolicy covers it). - Checks
ServiceElementUpdateonDevice.IoT.Bulb.1.Color. Agent finds the specific ACL rule created byadmin1. (Passes). - Checks
Writableattribute ofDevice.IoT.Bulb.1.Color(true). (Passes). - Checks
Securedattribute ofDevice.IoT.Bulb.1.Color(false). (PassescanAccessSecuredResourcetrivially). - Outcome: Success. Bulb color is set.
- IoT App Controller sends
- Initial State (
- Controller-Side Evaluation: The IoT App Controller, upon successful onboarding, now knows it can send
Setmessages to these specific parameters and presents appropriate controls to the end-user.
- Scenario: A malicious actor spoofs
ControllerID: "diag_user"(a valid but low-privilege Controller) and attempts to send aDELETEUSP message forDevice.DeviceInfo.**over a seemingly "trusted" (e.g., TLS-secured) WebSocket interface toagent-002.Device.DeviceInfois not deletable. - Agent-Side Enforcement:
- MTP-Level: The Agent validates the TLS connection, establishing trust for the connection itself.
- Controller Identification: Agent extracts
ControllerID: "diag_user". - Overall Message Permission: Agent checks
USPMessageDeletefordiag_user. The ACL fordiag_user(RoleViewer) does not permitUSPMessageDelete(as explicitly set tofalseinROLE_POLICIES). - Outcome (First Check): Agent immediately denies the request based on the lack of high-level message type permission. It constructs and sends a
USP_ERRORwitherr_code: 7006("Permission Denied"). - Fallback (If general permission allowed): Even if
USPMessageDeletewas allowed fordiag_user(e.g., by misconfiguration):- Agent would check
ServiceElementDeleteforDevice.DeviceInfo.**. ACL fordiag_userwould likely deny this specific path for deletion. - The Agent would then check the intrinsic attributes of
Device.DeviceInfo. It would discover thatDevice.DeviceInfois an object, but itsDeletableattribute isfalse. - Outcome (Second/Third Check): The Agent would still deny the request, returning
USP_ERRORwitherr_code: 7006or7004(Operation Failed due to non-deletable object).
- Agent would check
- Security Isolation: This showcases that even if a network interface is compromised or a low-privilege
ControllerIDis spoofed, the Agent's application-layer ACLs and data model attribute checks provide critical security isolation, preventing unauthorized operations.
USP strongly supports PoLP through its multi-layered design and granular controls:
- Default Deny: The fundamental security posture. Agents, by default, deny any operation unless explicitly permitted by an ACL. This forces administrators to consciously grant access.
- Granular ACLs/Roles: Controllers can be assigned roles (or ACLs) that grant highly specific permissions (
ServiceElementView,ServiceElementUpdate,ServiceElementAdd,ServiceElementDelete,AgentCommandExecute) on precisely defined data model paths. This avoids broad "all-or-nothing" access.- Example from
usp.txt(CHANGELOG.mdforv1.4.0): "Updated Role Definition Section with clarifications to Role permissions applying to Supported and Instantiated Data model and the Secured Role as applying to 'secured' parameter in the path(s), with examples of both." This highlights continuous refinement towards more granular PoLP.
- Example from
- Data Model Attributes: The
Writable,Addable,Deletable,Executable, andSecuredattributes of data model elements directly enforce PoLP at the resource level. A parameter markedRead-only(i.e.,Writable: false) cannot be changed, even if an ACL would theoretically permit aSetoperation. This is a crucial device-side self-protection mechanism. - Controller Onboarding and Challenge Mechanisms: For devices in the field, Controllers might initially have an "UntrustedRole" (
Device.LocalAgent.ControllerTrust.UntrustedRole). Highly sensitive operations (like gainingSecuredRoleaccess) can be protected by "Challenges" (Device.LocalAgent.ControllerTrust.Challenge.{i}.), requiring physical interaction or verification (e.g., "Enter passphrase printed on bottom of device"). This ensures that broad privileges are not easily gained by remote, unverified entities (R-SEC.15,R-SEC.16,R-SEC.17related to challenges). - Interface-Specific Policies: The ability to configure different access rules per MTP interface enables stronger PoLP. A local management interface might allow broader administrative access, while a wide-area network interface would be locked down to only essential, limited operations.
- Ephemeral Permissions (Conceptual): In advanced scenarios, ACLs could be dynamically modified to grant temporary, just-in-time permissions for specific tasks, then automatically revoked, further enforcing PoLP.
- Clear Error Reporting: When a permission is denied, the Agent sends a specific
USP_ERROR(code 7006) which allows the Controller to understand why the operation failed and guide its users/applications to adhere to PoLP. This transparency aids debugging and policy refinement.
In summary, USP's permission system is built to provide a secure and flexible management framework, enabling fine-grained control over connected devices by combining explicit Controller-side policies with robust, attribute-aware enforcement on the Agent side, all while adhering to the principle of least privilege.