Skip to content

Commit ab1afce

Browse files
authored
[Doc] Add architecture document (#2869)
* Add initial architecture document Signed-off-by: Peter Nied <petern@amazon.com>
1 parent 50ce79c commit ab1afce

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

ARCHITECTURE.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# OpenSearch Security Plugin Architecture
2+
3+
OpenSearch’s core systems do not include security features, these features are added by installing the Security Plugin. The Security Plugin extends OpenSearch to provide authentication, authorization, end to end Encryption, audit logging, and management interfaces.
4+
5+
## Components
6+
7+
The Security Plugin is packaged into a standard plugin zip file used by OpenSearch which can be installed by using the plugin tool. The security configuration is accessible on disk for modification before the node has been turned on. After node startup, the admin tools or API endpoints can be used for dynamic changes.
8+
9+
```mermaid
10+
graph TD
11+
subgraph OpenSearch Node
12+
subgraph File System
13+
cfg[Security Configuration files]
14+
adm[Admin Tools]
15+
end
16+
subgraph Indices
17+
idx(Index 1..n)
18+
secIdx[Security Index]
19+
end
20+
subgraph Plugins
21+
pgns(Plugins 1..n)
22+
sec[Security Plugin]
23+
end
24+
25+
sec -- bootstrap security config --> cfg
26+
sec -- refresh security config from cluster --> secIdx
27+
adm -- backup/restore security config --> sec
28+
end
29+
```
30+
31+
### Security Plugin
32+
33+
The runtime of the Security Plugin uses extension points to insert itself into the path actions. Several security management actions are registered in OpenSearch so they can be changed through REST API actions.
34+
35+
### Security Configuration
36+
37+
The security configuration is stored in an system index that is replicated to all nodes. When a change has been made to the configuration, the Security Plugin is reloaded to cleanly initialize its components with the new settings.
38+
39+
#### Configuration Files
40+
41+
When starting up with no security index detected in the cluster, the Security Plugin will attempt to load configuration files from disk into a new security index. The configuration files can be manually modified or sourced from a backup of a security index created using the admin tools.
42+
43+
### Admin Tools
44+
45+
For OpenSearch nodes to join a cluster, they need to have the same security configuration. Complete security configurations will include SSL settings and certificate files. The admin tools allow users to manage these settings and other features.
46+
47+
## Flows
48+
49+
### Authentication / Authorization
50+
51+
The Security Plugin supports multiple authentication backends including an internal identity provider which works with HTTP basic authentication as well as support [external providers](https://opensearch.org/docs/latest/security/authentication-backends/authc-index/) such as OpenId Connect (OIDC) and SAML.
52+
53+
Authorization is governed by roles declared in the security configuration. Roles control resource access by referencing the transport action name and/or index names in combination with OpenSearch action names.
54+
55+
Users are assigned roles via the role mappings. These mappings include backend role assignments from authentication providers as well as internal roles defined in the Security Plugin.
56+
57+
```mermaid
58+
sequenceDiagram
59+
title Basic Authorization flow
60+
autonumber
61+
participant C as Client
62+
participant O as OpenSearch
63+
participant SP as Security Plugin
64+
participant RH as Request Handler
65+
participant AL as Audit Log
66+
67+
C->>O: Request
68+
O->>SP: Request Received
69+
activate SP
70+
SP->>SP: Authenticate user via internal/external auth providers
71+
SP->>SP: Resolve Authorization for user
72+
SP-->>O: Allow/Deny request
73+
SP->>AL: Update Audit Log asynchronously
74+
deactivate SP
75+
O->>RH: Request continues to request handler
76+
RH-->>O: Result
77+
O->>C: Response
78+
```
79+
80+
#### Multiple Authorization Provider flow
81+
82+
Based on the order within the Security Plugin's configuration authentication providers are iterated through to discover which provider can authenticate the user.
83+
84+
```mermaid
85+
sequenceDiagram
86+
title Multiple Authorization Provider flow
87+
autonumber
88+
participant C as Client
89+
participant SP as Security Plugin
90+
participant IAP as Internal Auth Provider
91+
participant EAP as External Auth Provider*
92+
participant SC as Security Configuration
93+
94+
C->>SP: Incoming request
95+
SP->>IAP: Attempt to authenticate internally
96+
IAP-->>SP: Internal user result
97+
loop for each External Auth Provider
98+
SP->>EAP: Attempt to authenticate
99+
EAP-->>SP: External user result
100+
end
101+
SP->>SC: Check Authorization rules
102+
SC->>SC: Match user roles & permissions
103+
SC-->>SP: Authorization result
104+
SP-->>C: Response
105+
```
106+
107+
#### Rest vs Transport flow
108+
109+
OpenSearch treats external REST requests differently than internal transport requests. While REST requests allow for client-to-node communication and make use of API routes, transport requests are more structured and are used to communicate between nodes.
110+
111+
```mermaid
112+
sequenceDiagram
113+
title Rest vs Transport Flow
114+
autonumber
115+
participant C as Client
116+
participant O as OpenSearch
117+
participant SP as Security Plugin (Rest Filter & Security Interceptor)
118+
participant AH as Action Handler
119+
120+
C->>O: Request
121+
O->>SP: REST Request Received
122+
SP->>SP: If using client cert, Authenticate
123+
SP-->>O: Continue request
124+
O->>SP: Transport Request Received
125+
SP->>SP: Authenticate user via internal/external auth providers
126+
SP->>SP: Resolve Authorization for user
127+
SP-->>O: Allow/Deny request
128+
O->>AH: Send transport request to action handler
129+
AH-->>O: Result
130+
O->>C: Response
131+
```

0 commit comments

Comments
 (0)