Skip to content

Commit 6fa5b62

Browse files
authored
feat(pedm): log and query JIT elevations (#1334)
JIT elevations (where the user right-clicks and chooses "Run elevated") are logged in the SQL datastore. The full elevation request is not logged - the current capabilities don't give any worth in logging anything about the asker application (beyond the path, maybe). Additionally we log the authenticate status of the target application but not the actual certificates used to sign it. This can be added later if needed, but that level of data is probably too high fidelity for now. We need the user to exist in the database, which isn't happening currently; so we do an upsert of the user information at the time of logging. A new route is added /log/jit to query the elevation logs from RDM. The user must filter by start and end times, and optionally by user. If the user is not elevated, they can only query their own logs. The user can specify a sort column and sort direction (currently what is available here is determined by the columns we show in RDM, it can be extended). The user must specify a page size and offset; this facilitates paging the query results rather than sending back the whole data set on one call. The data set returned is, again, driven by what we currently display in RDM. It can be extended easily.
1 parent b056ddf commit 6fa5b62

76 files changed

Lines changed: 1694 additions & 1920 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
Cargo.toml
22
README.md
3-
docs/Application.md
3+
docs/AboutData.md
44
docs/Assignment.md
5-
docs/AuthenticodeSignatureStatus.md
6-
docs/Certificate.md
75
docs/DefaultApi.md
86
docs/ElevateTemporaryPayload.md
97
docs/ElevationConfigurations.md
108
docs/ElevationKind.md
119
docs/ElevationMethod.md
12-
docs/ElevationRequest.md
13-
docs/ElevationResult.md
1410
docs/Error.md
1511
docs/ErrorResponse.md
1612
docs/GetProfilesMeResponse.md
17-
docs/Hash.md
13+
docs/JitElevationLogPage.md
14+
docs/JitElevationLogQueryOptions.md
15+
docs/JitElevationLogRow.md
1816
docs/LaunchPayload.md
1917
docs/LaunchResponse.md
2018
docs/OptionalId.md
2119
docs/PathIdParameter.md
2220
docs/Profile.md
2321
docs/SessionElevationConfiguration.md
2422
docs/SessionElevationStatus.md
25-
docs/Signature.md
26-
docs/Signer.md
2723
docs/StartupInfoDto.md
2824
docs/StatusResponse.md
2925
docs/TemporaryElevationConfiguration.md
@@ -35,20 +31,18 @@ src/apis/default_api.rs
3531
src/apis/mod.rs
3632
src/apis/request.rs
3733
src/lib.rs
38-
src/models/application.rs
34+
src/models/about_data.rs
3935
src/models/assignment.rs
40-
src/models/authenticode_signature_status.rs
41-
src/models/certificate.rs
4236
src/models/elevate_temporary_payload.rs
4337
src/models/elevation_configurations.rs
4438
src/models/elevation_kind.rs
4539
src/models/elevation_method.rs
46-
src/models/elevation_request.rs
47-
src/models/elevation_result.rs
4840
src/models/error.rs
4941
src/models/error_response.rs
5042
src/models/get_profiles_me_response.rs
51-
src/models/hash.rs
43+
src/models/jit_elevation_log_page.rs
44+
src/models/jit_elevation_log_query_options.rs
45+
src/models/jit_elevation_log_row.rs
5246
src/models/launch_payload.rs
5347
src/models/launch_response.rs
5448
src/models/mod.rs
@@ -57,8 +51,6 @@ src/models/path_id_parameter.rs
5751
src/models/profile.rs
5852
src/models/session_elevation_configuration.rs
5953
src/models/session_elevation_status.rs
60-
src/models/signature.rs
61-
src/models/signer.rs
6254
src/models/startup_info_dto.rs
6355
src/models/status_response.rs
6456
src/models/temporary_elevation_configuration.rs

crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ All URIs are relative to *http://localhost*
2626

2727
Class | Method | HTTP request | Description
2828
------------ | ------------- | ------------- | -------------
29+
*DefaultApi* | [**about_get**](docs/DefaultApi.md#about_get) | **Get** /about |
2930
*DefaultApi* | [**elevate_session_post**](docs/DefaultApi.md#elevate_session_post) | **Post** /elevate/session |
3031
*DefaultApi* | [**elevate_temporary_post**](docs/DefaultApi.md#elevate_temporary_post) | **Post** /elevate/temporary |
3132
*DefaultApi* | [**launch_post**](docs/DefaultApi.md#launch_post) | **Post** /launch |
32-
*DefaultApi* | [**logs_get**](docs/DefaultApi.md#logs_get) | **Get** /logs |
33+
*DefaultApi* | [**log_jit_get**](docs/DefaultApi.md#log_jit_get) | **Get** /log/jit |
3334
*DefaultApi* | [**policy_assignments_get**](docs/DefaultApi.md#policy_assignments_get) | **Get** /policy/assignments |
3435
*DefaultApi* | [**policy_assignments_id_put**](docs/DefaultApi.md#policy_assignments_id_put) | **Put** /policy/assignments/{id} |
3536
*DefaultApi* | [**policy_me_get**](docs/DefaultApi.md#policy_me_get) | **Get** /policy/me |
@@ -45,29 +46,25 @@ Class | Method | HTTP request | Description
4546

4647
## Documentation For Models
4748

48-
- [Application](docs/Application.md)
49+
- [AboutData](docs/AboutData.md)
4950
- [Assignment](docs/Assignment.md)
50-
- [AuthenticodeSignatureStatus](docs/AuthenticodeSignatureStatus.md)
51-
- [Certificate](docs/Certificate.md)
5251
- [ElevateTemporaryPayload](docs/ElevateTemporaryPayload.md)
5352
- [ElevationConfigurations](docs/ElevationConfigurations.md)
5453
- [ElevationKind](docs/ElevationKind.md)
5554
- [ElevationMethod](docs/ElevationMethod.md)
56-
- [ElevationRequest](docs/ElevationRequest.md)
57-
- [ElevationResult](docs/ElevationResult.md)
5855
- [Error](docs/Error.md)
5956
- [ErrorResponse](docs/ErrorResponse.md)
6057
- [GetProfilesMeResponse](docs/GetProfilesMeResponse.md)
61-
- [Hash](docs/Hash.md)
58+
- [JitElevationLogPage](docs/JitElevationLogPage.md)
59+
- [JitElevationLogQueryOptions](docs/JitElevationLogQueryOptions.md)
60+
- [JitElevationLogRow](docs/JitElevationLogRow.md)
6261
- [LaunchPayload](docs/LaunchPayload.md)
6362
- [LaunchResponse](docs/LaunchResponse.md)
6463
- [OptionalId](docs/OptionalId.md)
6564
- [PathIdParameter](docs/PathIdParameter.md)
6665
- [Profile](docs/Profile.md)
6766
- [SessionElevationConfiguration](docs/SessionElevationConfiguration.md)
6867
- [SessionElevationStatus](docs/SessionElevationStatus.md)
69-
- [Signature](docs/Signature.md)
70-
- [Signer](docs/Signer.md)
7168
- [StartupInfoDto](docs/StartupInfoDto.md)
7269
- [StatusResponse](docs/StatusResponse.md)
7370
- [TemporaryElevationConfiguration](docs/TemporaryElevationConfiguration.md)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# AboutData
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**current_request_count** | **i32** | |
8+
**last_request_time** | Option<**String**> | The time of the most recent request. This can be `None` if `/about` is the first request made. | [optional]
9+
**run_id** | **i32** | |
10+
**start_time** | **String** | |
11+
**startup_request_count** | **i32** | |
12+
13+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
14+
15+

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Application.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/AuthenticodeSignatureStatus.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Certificate.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ All URIs are relative to *http://localhost*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7+
[**about_get**](DefaultApi.md#about_get) | **Get** /about |
78
[**elevate_session_post**](DefaultApi.md#elevate_session_post) | **Post** /elevate/session |
89
[**elevate_temporary_post**](DefaultApi.md#elevate_temporary_post) | **Post** /elevate/temporary |
910
[**launch_post**](DefaultApi.md#launch_post) | **Post** /launch |
10-
[**logs_get**](DefaultApi.md#logs_get) | **Get** /logs |
11+
[**log_jit_get**](DefaultApi.md#log_jit_get) | **Get** /log/jit |
1112
[**policy_assignments_get**](DefaultApi.md#policy_assignments_get) | **Get** /policy/assignments |
1213
[**policy_assignments_id_put**](DefaultApi.md#policy_assignments_id_put) | **Put** /policy/assignments/{id} |
1314
[**policy_me_get**](DefaultApi.md#policy_me_get) | **Get** /policy/me |
@@ -22,6 +23,31 @@ Method | HTTP request | Description
2223

2324

2425

26+
## about_get
27+
28+
> models::AboutData about_get()
29+
30+
31+
### Parameters
32+
33+
This endpoint does not need any parameter.
34+
35+
### Return type
36+
37+
[**models::AboutData**](AboutData.md)
38+
39+
### Authorization
40+
41+
No authorization required
42+
43+
### HTTP request headers
44+
45+
- **Content-Type**: Not defined
46+
- **Accept**: application/json
47+
48+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
49+
50+
2551
## elevate_session_post
2652

2753
> elevate_session_post()
@@ -103,26 +129,29 @@ No authorization required
103129
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
104130

105131

106-
## logs_get
132+
## log_jit_get
107133

108-
> Vec<models::ElevationResult> logs_get()
134+
> models::JitElevationLogPage log_jit_get(jit_elevation_log_query_options)
109135
110136

111137
### Parameters
112138

113-
This endpoint does not need any parameter.
139+
140+
Name | Type | Description | Required | Notes
141+
------------- | ------------- | ------------- | ------------- | -------------
142+
**jit_elevation_log_query_options** | [**JitElevationLogQueryOptions**](JitElevationLogQueryOptions.md) | | [required] |
114143

115144
### Return type
116145

117-
[**Vec<models::ElevationResult>**](ElevationResult.md)
146+
[**models::JitElevationLogPage**](JitElevationLogPage.md)
118147

119148
### Authorization
120149

121150
No authorization required
122151

123152
### HTTP request headers
124153

125-
- **Content-Type**: Not defined
154+
- **Content-Type**: application/json
126155
- **Accept**: application/json
127156

128157
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ElevateTemporaryPayload.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**seconds** | **u64** | |
7+
**seconds** | **u64** | The number of seconds to elevate the user for. This must be between 1 and `i32::MAX`. |
88

99
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1010

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/Hash.md renamed to crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/JitElevationLogPage.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Hash
1+
# JitElevationLogPage
22

33
## Properties
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**sha1** | **String** | |
8-
**sha256** | **String** | |
7+
**results** | [**Vec<models::JitElevationLogRow>**](JitElevationLogRow.md) | |
8+
**total_pages** | **u32** | |
9+
**total_records** | **u32** | |
910

1011
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1112

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# JitElevationLogQueryOptions
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**end_time** | **i64** | |
8+
**page_number** | **u32** | |
9+
**page_size** | **u32** | |
10+
**sort_column** | **String** | |
11+
**sort_descending** | **bool** | |
12+
**start_time** | **i64** | |
13+
**user** | Option<[**models::User**](User.md)> | | [optional]
14+
15+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
16+
17+

0 commit comments

Comments
 (0)