mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Update query for users listing (#3324)
- Filter undesired entries. - LEFT JOIN to include users missing groups. #2488
This commit is contained in:
parent
8ec3986263
commit
3a5037f798
2 changed files with 2 additions and 1 deletions
1
changes/update-users
Normal file
1
changes/update-users
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Remove host users without login shells, and include host users missing groups.
|
||||
|
|
@ -517,7 +517,7 @@ FROM python_packages;
|
|||
}
|
||||
|
||||
var usersQuery = DetailQuery{
|
||||
Query: `SELECT uid, username, type, groupname, shell FROM users u JOIN groups g ON g.gid=u.gid;`,
|
||||
Query: `SELECT uid, username, type, groupname, shell FROM users u LEFT JOIN groups g ON g.gid=u.gid WHERE type <> 'special' AND shell NOT LIKE '%/false' AND shell NOT LIKE '%/nologin' AND shell NOT LIKE '%/shutdown' AND shell NOT LIKE '%/halt' AND username NOT LIKE '%$' AND username NOT LIKE '\_%' ESCAPE '\' AND NOT (username = 'sync' AND shell ='/bin/sync')`,
|
||||
IngestFunc: func(logger log.Logger, host *fleet.Host, rows []map[string]string) error {
|
||||
var users []fleet.HostUser
|
||||
for _, row := range rows {
|
||||
|
|
|
|||
Loading…
Reference in a new issue