Consolidate LDAP roles into OPC UA session roles with granular write permissions
Map LDAP groups to custom OPC UA role NodeIds on RoleBasedIdentity.GrantedRoleIds during authentication, replacing the username-to-role side cache. Split ReadWrite into WriteOperate/WriteTune/WriteConfigure so write access is gated per Galaxy security classification. AnonymousCanWrite now behaves consistently regardless of LDAP state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -266,25 +266,50 @@ The CLI tool auto-generates its own client certificate on first use (stored unde
|
||||
|
||||
## LDAP Authentication
|
||||
|
||||
The server supports LDAP-based user authentication via GLAuth (or any standard LDAP server). When enabled, OPC UA `UserName` token credentials are validated by LDAP bind, and LDAP group membership controls what operations each user can perform.
|
||||
The server supports LDAP-based user authentication via GLAuth (or any standard LDAP server). When enabled, OPC UA `UserName` token credentials are validated by LDAP bind. LDAP group membership is resolved once during authentication and mapped to custom OPC UA role `NodeId`s in the `urn:zbmom:lmxopcua:roles` namespace. These role NodeIds are stored on the session's `RoleBasedIdentity.GrantedRoleIds` and checked directly during write and alarm-ack operations.
|
||||
|
||||
### Architecture
|
||||
|
||||
```
|
||||
OPC UA Client → UserName Token → LmxOpcUa Server → LDAP Bind (validate credentials)
|
||||
→ LDAP Search (resolve group membership)
|
||||
→ Role assignment → Permission enforcement
|
||||
→ Map groups to OPC UA role NodeIds
|
||||
→ Store on RoleBasedIdentity.GrantedRoleIds
|
||||
→ Permission checks via GrantedRoleIds.Contains()
|
||||
```
|
||||
|
||||
### LDAP Groups and OPC UA Permissions
|
||||
|
||||
| LDAP Group | OPC UA Permission |
|
||||
All authenticated LDAP users can browse and read nodes regardless of group membership. Groups grant additional permissions:
|
||||
|
||||
| LDAP Group | Permission |
|
||||
|---|---|
|
||||
| ReadOnly | Browse and read nodes |
|
||||
| ReadWrite | Read and write tag values |
|
||||
| ReadOnly | No additional permissions (read-only access) |
|
||||
| WriteOperate | Write FreeAccess and Operate attributes |
|
||||
| WriteTune | Write Tune attributes |
|
||||
| WriteConfigure | Write Configure attributes |
|
||||
| AlarmAck | Acknowledge alarms |
|
||||
|
||||
Users can belong to multiple groups. A user with all three groups has full access.
|
||||
Users can belong to multiple groups. The `admin` user in the default GLAuth configuration belongs to all groups.
|
||||
|
||||
### Effective Permission Matrix
|
||||
|
||||
The effective permission for a write operation depends on two factors: the user's session role (from LDAP group membership or anonymous access) and the Galaxy attribute's security classification. The security classification controls the node's `AccessLevel` — attributes classified as `SecuredWrite`, `VerifiedWrite`, or `ViewOnly` are exposed as read-only nodes regardless of the user's role. For writable classifications, the required write role depends on the classification.
|
||||
|
||||
| | FreeAccess | Operate | SecuredWrite | VerifiedWrite | Tune | Configure | ViewOnly |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| **Anonymous (`AnonymousCanWrite=true`)** | Write | Write | Read | Read | Write | Write | Read |
|
||||
| **Anonymous (`AnonymousCanWrite=false`)** | Read | Read | Read | Read | Read | Read | Read |
|
||||
| **ReadOnly** | Read | Read | Read | Read | Read | Read | Read |
|
||||
| **WriteOperate** | Write | Write | Read | Read | Read | Read | Read |
|
||||
| **WriteTune** | Read | Read | Read | Read | Write | Read | Read |
|
||||
| **WriteConfigure** | Read | Read | Read | Read | Read | Write | Read |
|
||||
| **AlarmAck** (only) | Read | Read | Read | Read | Read | Read | Read |
|
||||
| **Admin** (all groups) | Write | Write | Read | Read | Write | Write | Read |
|
||||
|
||||
All roles can browse and read all nodes. The "Read" entries above mean the node is either read-only by classification or the user lacks the required write role. "Write" means the write is permitted by both the node's classification and the user's role.
|
||||
|
||||
Alarm acknowledgment is an independent permission controlled by the `AlarmAck` role and is not affected by security classification.
|
||||
|
||||
### GLAuth Setup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user