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
subjectAltName
extension in the certificate is used to convey theControllerID
(R-SEC.0a
). - Pre-shared Keys/Enrollment: Agents can be pre-provisioned with trusted
ControllerID
s 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.Controller
object (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 aSet
message.Addable
: Indicates if new instances of an object can be created under a parent path via anAdd
message.Deletable
: Indicates if an instance of an object can be removed via aDelete
message.Executable
: Indicates if a command can be invoked via anOperate
message.Secured
: (From TR-106 and TR-181). This is paramount. ASecured
parameter or object requires special authorization. Access toSecured
elements is restricted to Controllers with higher trust levels or specific roles (like theSecuredRole
mentioned in TR-369 Amendment 3, or thesecured_user
role 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 aControllerID
to 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
SecuredRole
and clarifies that role permissions apply to both Supported and Instantiated Data Models, and specifically tosecured
parameters.
- 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/security
directory contains diagrams likecheck-cert.png
anddetermine-role.png
that illustrate how the Agent checks the Controller's certificate and derives itsRole
or trust level based on factors like trusted Certificate Authorities (TrustedCertificateAuthorities
in TR-369).R-E2E.43
explicitly 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
ControllerID
from the header (from_id
). - ACL Evaluation (Policy Decision Point - PDP):
- For the extracted
ControllerID
and 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.
Writable
Check: ForSet
operations, the Agent confirms the parameter isWritable
.Addable
/Deletable
Check: ForAdd
andDelete
operations, the Agent checks the parent object/target instance forAddable
orDeletable
attributes.Executable
Check: ForOperate
messages, it confirms the command isExecutable
.Secured
Parameter Handling: If a parameter isSecured
, the Agent's policy explicitly requires higher privileges (e.g.,SecuredRole
). TheROLE_POLICIES
in our Go program demonstrate this by routing requests forSecured
resources through thecanAccessSecuredResource
policy function. Theusp.txt
CHANGELOG.md
forv1.4.0
explicitly 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
Set
messages over insecure MTPs for certain sensitive parameters).usp.txt
describes 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.5
inspecification/mtp/index.md
for 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
User
struct,RoleName
enums,AppPermission
enums,ROLE_DEFINITIONS
, andROLE_POLICIES
maps directly implement this. PolicyContext
(PIP): For each requested action, the Controller gathers relevant attributes (user's roles/department, target Agent's owner/department,Secured
status of the parameter being accessed, current time, IP address). ThisPolicyContext
is 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_ERROR
messages 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 theRoleOperator
role, which in our policies, canServiceElementUpdate
if the agent'sDepartment
matches, but it doesn't havecanAccessSecuredResource
granted generally. - Controller-Side:
- The Controller's internal logic (e.g., triggered by a web UI for the customer service agent) prepares a
SET
USP message. - Before sending, the Controller's
CheckPermission
is invoked forServiceElementUpdate
onDevice.WiFi.SSID
andDevice.WiFi.Password
. - For
Device.WiFi.SSID
: PolicycanUpdateAgentIfDepartmentMatches
is checked. Ifagent-001
's department matchesoperator1
's department ("Operations"), this part passes. - For
Device.WiFi.Password
: TheServiceElementUpdate
permission is checked. Even ifcanUpdateAgentIfDepartmentMatches
passes, thecanAccessSecuredResource
policy (triggered becauseDevice.WiFi.Password
isSecured
) will likely fail forRoleOperator
becauseIsSecured
isfalse
foroperator1
, andRoleOperator
does not implicitly gain secured access. - Outcome (Controller): The Controller might prevent sending the entire
SET
message or redact theDevice.WiFi.Password
part 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
SET
message from the Controller. - MTP/Authentication: Validates the Controller's connection (e.g., mTLS).
- Overall Message Permission: Checks
USPMessageSet
for the Controller's identity. (Assume it passes for operators generally). - Per-Path/Attribute Checks:
- For
Device.WiFi.SSID
:- Checks
ServiceElementUpdate
for this path. (Passes as per ACL/Role). - Checks
Writable
attribute ofDevice.WiFi.SSID
(true in ourAgent.DataModel
). (Passes). - Checks
Secured
attribute (false). (PassescanAccessSecuredResource
trivially). - Result: SSID is updated.
- Checks
- For
Device.WiFi.Password
:- Checks
ServiceElementUpdate
for this path. (Passes as per ACL/Role). - Checks
Writable
attribute ofDevice.WiFi.Password
(true). (Passes). - Crucial
Secured
check: The Agent seesDevice.WiFi.Password
isSecured
. It invokes thecanAccessSecuredResource
policy (Policies["canAccessSecuredResource"](policyCtx)
). Sinceoperator1
is notIsSecured
and notadmin
, this policy returnsfalse
. - Outcome: Password update is denied.
- Checks
- For
- Error Reporting: The Agent sends a
SET_RESP
USP message. TheModifiedPaths
list will includeDevice.WiFi.SSID
, but notDevice.WiFi.Password
. Instead, the response (in a real USP message, or conceptually in our simulated one) would include aSetFailure
element forDevice.WiFi.Password
witherr_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 byadmin1
in Operations): Has ACLs configured (or implicit policies) grantingadmin1
full access.agent-002
(owned byoperator1
in Sales): Has ACLs allowingdiag_user
(RoleViewer
) read access toDevice.LAN.1.Stats.**
but noSet
/Add
/Delete
/Operate
permissions on any path, and no access toSecured
parameters.
- Controller-Side Evaluation:
- ISP Controller:
admin1
attemptsSet
onagent-001
'sDevice.Time.NTPServer1
. The Controller's internal logic confirmsadmin1
hasUSPMessageSet
andServiceElementUpdate
permissions. PolicycanUpdateAgentIfDepartmentMatches
is evaluated for agent1. Sinceadmin
role bypasses most checks, it succeeds. The USPSET
message is sent. - Diagnostic Controller:
diag_user
attemptsGet
onagent-002
'sDevice.LAN.1.Stats.BytesSent
. The Controller's internal logic confirmsdiag_user
hasUSPMessageGet
andServiceElementView
permissions. ThecanViewAgentIfUnblocked
policy is also checked. The USPGET
message is sent. - Diagnostic Controller attempts
Set
onagent-002
'sDevice.LAN.1.IPAddress
: The Controller's internalCheckPermission
forUSPMessageSet
andServiceElementUpdate
fordiag_user
will fail based onROLE_POLICIES[RoleViewer]
which explicitly setsUSPMessageSet
tofalse
. The UI fordiag_user
on 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.Set
onDevice.Time.NTPServer1
succeeds. - Diagnostic Controller (for
agent-002
-Get
onStats
):- Agent receives
GET
fromdiag_user
. - ACL grants
USPMessageGet
toRoleViewer
. - ACL grants
ServiceElementView
toRoleViewer
onDevice.LAN.1.Stats.**
. Device.LAN.1.Stats.BytesSent
is notSecured
.- Outcome: Success. Agent returns
GET_RESP
with data.
- Agent receives
- Diagnostic Controller (for
agent-002
-Set
onIPAddress
):- Agent receives
SET
fromdiag_user
. - ACL denies
USPMessageSet
toRoleViewer
(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-001
has 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 isWritable
andAddable
but itsLightLevel
parameter isSecured
andWritable
. - Onboarding: A trusted ISP Admin (
admin1
) sends aSET
USP message toagent-001
to add a newDevice.LocalAgent.Controller
entry and associated ACL rules forcontroller-iot-app
. The ACL entry grantsSet
andGet
permissions only toDevice.IoT.Bulb.1.Color
andDevice.IoT.Bulb.1.Brightness
forcontroller-iot-app
. It also setscanAccessSecuredResource
policy totrue
for this specific controller onDevice.IoT.Bulb.1.**
. - Agent
admin1
'sSET
on ACL objects is authorized (sinceadmin1
has full control). The ACL is updated. - IoT App attempts
Set
onDevice.IoT.Bulb.1.Color
(value: "Red"):- IoT App Controller sends
SET
USP message fromcontroller-iot-app
. - Agent receives
SET
. ChecksUSPMessageSet
forcontroller-iot-app
. (Passes if the onboarding process also included granting genericUSPMessageSet
to new app controllers, or the specificcanAccessSecuredResource
policy covers it). - Checks
ServiceElementUpdate
onDevice.IoT.Bulb.1.Color
. Agent finds the specific ACL rule created byadmin1
. (Passes). - Checks
Writable
attribute ofDevice.IoT.Bulb.1.Color
(true). (Passes). - Checks
Secured
attribute ofDevice.IoT.Bulb.1.Color
(false). (PassescanAccessSecuredResource
trivially). - 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
Set
messages 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 aDELETE
USP message forDevice.DeviceInfo.**
over a seemingly "trusted" (e.g., TLS-secured) WebSocket interface toagent-002
.Device.DeviceInfo
is 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
USPMessageDelete
fordiag_user
. The ACL fordiag_user
(RoleViewer
) does not permitUSPMessageDelete
(as explicitly set tofalse
inROLE_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_ERROR
witherr_code: 7006
("Permission Denied"). - Fallback (If general permission allowed): Even if
USPMessageDelete
was allowed fordiag_user
(e.g., by misconfiguration):- Agent would check
ServiceElementDelete
forDevice.DeviceInfo.**
. ACL fordiag_user
would likely deny this specific path for deletion. - The Agent would then check the intrinsic attributes of
Device.DeviceInfo
. It would discover thatDevice.DeviceInfo
is an object, but itsDeletable
attribute isfalse
. - Outcome (Second/Third Check): The Agent would still deny the request, returning
USP_ERROR
witherr_code: 7006
or7004
(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
ControllerID
is 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.md
forv1.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
, andSecured
attributes 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 aSet
operation. 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 gainingSecuredRole
access) 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.17
related 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.