Skip to content

Commit a13f675

Browse files
authored
Merge pull request #71 from 1Password/es/add-modify-reports
Refactor vault details for readability and add new dt reporting query for mac apps
2 parents 6943692 + 0fdfee6 commit a13f675

File tree

2 files changed

+58
-5
lines changed

2 files changed

+58
-5
lines changed

account-management/vault-details.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ op signin
77
for vault in $(op vault list --format=json | jq --raw-output '.[] .id')
88
do
99
echo ""
10-
echo "**************Vault Details**************"
10+
echo "Vault Details"
1111
op vault get $vault --format=json | jq -r '.|{name, items, updated_at}'
12+
sleep 1
1213
echo ""
13-
echo "**************Users**************"
14+
echo "Users"
1415
op vault user list $vault
16+
sleep 1
1517
echo ""
16-
echo "**************Groups**************"
18+
echo "Groups"
1719
op vault group list $vault
20+
sleep 1
1821
echo ""
19-
echo "*****************************************"
20-
echo "*****************************************"
22+
echo "End of Vault Details"
23+
sleep 2
24+
clear
2125
echo ""
2226
echo ""
2327
done
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
-- "Mac Apps Report"
2+
-- Internal-1P only https://app.kolide.com/4918/reporting/queries/2080
3+
4+
-- Reporting DB query to retrieve all mac_apps installed across the fleet,
5+
-- filtering out a list of "approved apps" such as 1Password and anything
6+
-- built by either Apple or Google using their bundle_identifier.
7+
8+
-- The final report contains an ordered list of "unapproved" apps with a
9+
-- JSON formatted device table containing the device name, serial and admin URL.
10+
11+
WITH device_info AS (
12+
SELECT
13+
id as device_id,
14+
name,
15+
serial,
16+
k2_url,
17+
id || ' (' || name || ')' as device_name
18+
FROM
19+
devices
20+
),
21+
22+
apps AS (
23+
SELECT
24+
*
25+
FROM
26+
mac_apps
27+
WHERE
28+
1=1
29+
AND path LIKE '/Applications%'
30+
AND name NOT LIKE '1Password%.app'
31+
AND bundle_identifier NOT LIKE 'com.apple.%'
32+
AND bundle_identifier NOT LIKE 'com.google.%'
33+
)
34+
35+
SELECT
36+
a.name,
37+
a.bundle_identifier,
38+
COUNT(*) as count,
39+
JSON_AGG(
40+
JSON_BUILD_OBJECT(
41+
'device_name', d.device_name,
42+
'device_serial', d.serial,
43+
'url', d.k2_url
44+
) ORDER BY d.device_name
45+
) as device_table
46+
FROM apps as a
47+
JOIN device_info as d on d.device_id = a.device_id
48+
GROUP BY 1, 2
49+
ORDER BY count DESC

0 commit comments

Comments
 (0)