Skip to content

Commit 0442b42

Browse files
authored
Merge pull request #97 from SentriusLLC/fixup_ztat
Fixup ztat interface
2 parents a2c100a + a25ecc3 commit 0442b42

File tree

8 files changed

+314
-465
lines changed

8 files changed

+314
-465
lines changed

.local.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SENTRIUS_VERSION=1.1.345
1+
SENTRIUS_VERSION=1.1.369
22
SENTRIUS_SSH_VERSION=1.1.41
33
SENTRIUS_KEYCLOAK_VERSION=1.1.53
44
SENTRIUS_AGENT_VERSION=1.1.42

.local.env.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SENTRIUS_VERSION=1.1.345
1+
SENTRIUS_VERSION=1.1.369
22
SENTRIUS_SSH_VERSION=1.1.41
33
SENTRIUS_KEYCLOAK_VERSION=1.1.53
44
SENTRIUS_AGENT_VERSION=1.1.42

api/src/main/resources/templates/fragments/header.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,34 @@
6969
margin: 0; /* Remove outer margin */
7070
padding: 5px 10px; /* Adjust padding to desired amount */
7171
}
72+
73+
/* Sidebar-specific nav pills */
74+
#menu.nav-pills .nav-link {
75+
background: transparent;
76+
color: #adb5bd;
77+
border-radius: 8px;
78+
padding: .65rem .9rem;
79+
width: 100%;
80+
text-align: left;
81+
}
82+
83+
#menu.nav-pills .nav-link.active {
84+
background-color: #0d6efd; /* blue highlight */
85+
color: #fff;
86+
}
87+
88+
/* Only affect page-content pills, not sidebar */
89+
.main-content .nav-pills .nav-link {
90+
background: var(--surface-2);
91+
color: var(--muted);
92+
border-radius: 999px;
93+
}
94+
95+
.main-content .nav-pills .nav-link.active {
96+
background: var(--primary);
97+
color: #fff;
98+
}
99+
72100
</style>
73101

74102
<script th:inline="javascript">

api/src/main/resources/templates/sso/ztats/view_ztats.html

Lines changed: 266 additions & 456 deletions
Large diffs are not rendered by default.

dataplane/src/main/java/io/sentrius/sso/automation/auditing/AccessTokenAuditor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,24 @@ protected synchronized TriggerAction submit(String command) {
241241

242242
// keep the current trigger
243243
} else if (ztatService.hasJITRequest(command, user, system)){
244-
245-
if (!ztatService.isActive(command, user, system)) {
244+
var isActive = ztatService.isActive(command, user, system);
245+
log.info("on message is approved {} is active ? {}", command, isActive);
246+
if (!isActive) {
246247
ZeroTrustAccessTokenReason reason = ztatService.createReason("need ", " ticket ", " url");
247248
ZeroTrustAccessTokenRequest request = ztatService.createRequest(command, reason, connectedSystem.getUser(),
248249
connectedSystem.getHostSystem()
249250
);
250251
request = ztatService.addJITRequest(request);
251252
return TriggerAction.DENY_ACTION;
252253
} else {
254+
log.info("on message is approved and active {}", command);
253255
ztatService.incrementUses(command, user, system);
254256
currentTrigger = Trigger.NO_ACTION;
255257
}
256258

257259

258260
} else {
259-
261+
log.info("on message is approved, but no jit request {}", command);
260262
currentTrigger = Trigger.NO_ACTION;
261263
}
262264

dataplane/src/main/java/io/sentrius/sso/core/services/SshListenerService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public void startListeningToSshServer(String terminalSessionId, DataSession sess
8080
// logic for receiving data from SSH server
8181
var sshData = sessionTrackingService.getOutput(connectedSystem, 1L, TimeUnit.SECONDS,
8282
output -> (!connectedSystem.getSession().getClosed() && (null != activeSessions.get(terminalSessionId) && activeSessions.get(terminalSessionId).isOpen())));
83-
log.info("Received data from SSH server for session: {}", terminalSessionId);
8483
// Send data to the specific terminal session
8584
if (null != sshData ) {
8685
for(Session.TerminalMessage terminalMessage : sshData){

dataplane/src/main/java/io/sentrius/sso/core/services/security/ZeroTrustAccessTokenService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ public boolean isActive(
202202
var lastUpdated = null != status.get().getZtatRequest().getLastUpdated() ?
203203
status.get().getZtatRequest().getLastUpdated().getTime() : System.currentTimeMillis();
204204
var currentTime = System.currentTimeMillis();
205+
log.info("JIT request last updated: " + lastUpdated);
206+
log.info("JIT request current time: " + currentTime);
207+
log.info("JIT request max duration: " + systemOptions.getMaxJitDurationMs());
208+
log.info("JIT request uses: " + status.get().getUses());
209+
log.info("JIT request max uses: " + systemOptions.getMaxJitUses());
205210
if (systemOptions.getMaxJitUses() > 0
206211
&& status.get().getUses() >= systemOptions.getMaxJitUses()) {
207212
log.info("JIT request has reached max uses: " + request.getId());
@@ -212,6 +217,8 @@ public boolean isActive(
212217
} else {
213218
return true;
214219
}
220+
} else {
221+
log.info("JIT request not found: " + command);
215222
}
216223
}
217224
log.info("JIT request not found: " + command);

dataplane/src/main/java/io/sentrius/sso/core/services/security/ZeroTrustRequestService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ public Optional<OpsApproval> getOpsTokenStatus(String token ) {
198198

199199
public Optional<ZeroTrustAccessTokenApproval> getAccessTokenStatus(ZeroTrustAccessTokenRequest request) {
200200
var approvals = request.getApprovals();
201+
log.info("Approvals for request {}: {}", request.getId(), approvals.size());
201202
if (!approvals.isEmpty()) {
202203
return Optional.of(approvals.get(0));
203204
}
204-
// Implement logic to retrieve the JIT status (if applicable).
205-
// Example: Retrieve from a specific table or calculate based on data.
205+
206206
return Optional.empty(); // Placeholder for actual implementation.
207207
}
208208

@@ -248,10 +248,13 @@ public void incrementAccessTokenUses(ZeroTrustAccessTokenRequest request) {
248248
if (approval.getUses() >= systemOptions.maxJitUses) {
249249
throw new RuntimeException("JIT uses exceeded");
250250
}
251-
;
251+
252252
ztatUseRepository.save(ZtatUse.builder().ztatApproval(approval).user(request.getUser()).build());
253253
log.info("Incrementing uses for JITRequest: {}", request.getId());
254254
ztatApprovalRepository.save(approval);
255+
256+
approval.setUses(approval.getUses() + 1);
257+
ztatApprovalRepository.save(approval);
255258
});
256259
}
257260
}

0 commit comments

Comments
 (0)