Skip to content

Commit

Permalink
Cosmetic on the Security UI:
Browse files Browse the repository at this point in the history
- Add missing sort icon in table header
- Replace 'null' by '-' in table cells
  • Loading branch information
csavelief committed Aug 9, 2024
1 parent 0e7af14 commit ac4ffbd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
17 changes: 13 additions & 4 deletions app/Models/YnhOsquery.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,23 @@ public static function lastLoginsAndLogoutsSecurityEvents(Collection $servers):
ynh_servers.name AS ynh_server_name,
TIMESTAMP(ynh_osquery.calendar_time - SECOND(ynh_osquery.calendar_time)) AS timestamp,
json_unquote(json_extract(ynh_osquery.columns, '$.pid')) AS pid,
json_unquote(json_extract(ynh_osquery.columns, '$.host')) AS entry_host,
CASE
WHEN json_unquote(json_extract(ynh_osquery.columns, '$.host')) = 'null' THEN NULL
ELSE json_unquote(json_extract(ynh_osquery.columns, '$.host'))
END AS entry_host,
json_unquote(json_extract(ynh_osquery.columns, '$.time')) AS entry_timestamp,
json_unquote(json_extract(ynh_osquery.columns, '$.tty')) AS entry_terminal,
json_unquote(json_extract(ynh_osquery.columns, '$.type_name')) AS entry_type,
json_unquote(json_extract(ynh_osquery.columns, '$.username')) AS entry_username,
CASE
WHEN json_unquote(json_extract(ynh_osquery.columns, '$.username')) = 'null' THEN NULL
ELSE json_unquote(json_extract(ynh_osquery.columns, '$.username'))
END AS entry_username,
ynh_osquery.action
FROM ynh_osquery
INNER JOIN ynh_servers ON ynh_servers.id = ynh_osquery.ynh_server_id
WHERE ynh_osquery.name = 'last'
AND ynh_osquery.ynh_server_id IN ({$servers->pluck('id')->join(',')})
ORDER BY timestamp DESC
ORDER BY timestamp DESC, entry_timestamp DESC
LIMIT 20;
"));
}
Expand Down Expand Up @@ -264,7 +270,10 @@ public static function authorizedKeysSecurityEvents(Collection $servers): Collec
TIMESTAMP(ynh_osquery.calendar_time - SECOND(ynh_osquery.calendar_time)) AS timestamp,
json_unquote(json_extract(ynh_osquery.columns, '$.key_file')) AS key_file,
json_unquote(json_extract(ynh_osquery.columns, '$.key')) AS `key`,
json_unquote(json_extract(ynh_osquery.columns, '$.comment')) AS key_comment,
CASE
WHEN json_unquote(json_extract(ynh_osquery.columns, '$.comment')) = 'null' THEN NULL
ELSE json_unquote(json_extract(ynh_osquery.columns, '$.comment'))
END AS key_comment,
json_unquote(json_extract(ynh_osquery.columns, '$.algorithm')) AS algorithm,
ynh_osquery.action
FROM ynh_osquery
Expand Down
16 changes: 8 additions & 8 deletions resources/views/home/cards/_security.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<thead>
<tr>
<th>{{ __('Server') }}</th>
<th>{{ __('Timestamp') }}</th>
<th><i class="zmdi zmdi-long-arrow-up"></i>&nbsp;{{ __('Timestamp') }}</th>
<th>{{ __('Key File') }}</th>
<th>{{ __('Key') }}</th>
<th>{{ __('Key Comment') }}</th>
Expand Down Expand Up @@ -53,7 +53,7 @@
{{ \Illuminate\Support\Str::limit($event->key, 50, '...') }}
</td>
<td>
{{ $event->key_comment }}
{{ $event->key_comment ?? '-' }}
</td>
<td>
{{ $event->algorithm }}
Expand Down Expand Up @@ -96,7 +96,7 @@
<thead>
<tr>
<th>{{ __('Server') }}</th>
<th>{{ __('Timestamp') }}</th>
<th><i class="zmdi zmdi-long-arrow-up"></i>&nbsp;{{ __('Timestamp') }}</th>
<th>{{ __('PID') }}</th>
<th>{{ __('Entry Host') }}</th>
<th>{{ __('Entry Timestamp') }}</th>
Expand All @@ -123,7 +123,7 @@
{{ $event->pid }}
</td>
<td>
{{ $event->entry_host }}
{{ $event->entry_host ?? '-' }}
</td>
<td>
{{ $event->entry_timestamp }}
Expand All @@ -135,7 +135,7 @@
{{ $event->entry_type }}
</td>
<td>
{{ $event->entry_username }}
{{ $event->entry_username ?? '-' }}
</td>
<td>
<span class="tw-pill rounded-pill bg-primary">
Expand Down Expand Up @@ -175,7 +175,7 @@
<thead>
<tr>
<th>{{ __('Server') }}</th>
<th>{{ __('Timestamp') }}</th>
<th><i class="zmdi zmdi-long-arrow-up"></i>&nbsp;{{ __('Timestamp') }}</th>
<th>{{ __('User ID') }}</th>
<th>{{ __('Group ID') }}</th>
<th>{{ __('Username') }}</th>
Expand Down Expand Up @@ -250,7 +250,7 @@
<thead>
<tr>
<th>{{ __('Server') }}</th>
<th>{{ __('Timestamp') }}</th>
<th><i class="zmdi zmdi-long-arrow-up"></i>&nbsp;{{ __('Timestamp') }}</th>
<th>{{ __('Name') }}</th>
<th>{{ __('Size') }}</th>
<th>{{ __('Address') }}</th>
Expand Down Expand Up @@ -333,7 +333,7 @@
<thead>
<tr>
<th>{{ __('Server') }}</th>
<th>{{ __('Timestamp') }}</th>
<th><i class="zmdi zmdi-long-arrow-up"></i>&nbsp;{{ __('Timestamp') }}</th>
<th>{{ __('Path') }}</th>
<th>{{ __('Group') }}</th>
<th>{{ __('Username') }}</th>
Expand Down

0 comments on commit ac4ffbd

Please sign in to comment.