9830 praudit should be able to map users and groups correctly

Review Request #1204 — Created Sept. 10, 2018 and submitted

ptribble
illumos-gate
9830
general

It's common to aggregate audit logs on a central system. Currently, running praudit then resolves uids and gids back to names on the system where praudit runs, which may be completely wrong.

This fix allows the user to copy the group and passwd files to the aggregated system and point praudit at those files. It does this by preloading the uid and gid caches introduced in 9106.

Run praudit with the -p and -g flags, verified that it resolves uids and gids correctly. Verified that without the flags being used, we get the same (wrong) results as before.

  • 0
  • 0
  • 7
  • 1
  • 8
Description From Last Updated
citrus
  1. Ship It!
  2. 
      
jclulow
  1. 
      
  2. usr/src/cmd/praudit/format.c (Diff revision 1)
     
     

    We should be checking for and handling failures from fgetpwent() here, so that the program doesn't silently accept an error and move on.

    1. I've added this, although it turns out that the only failures that you catch are if the file is well-formed but has oversized entries. Input files that are just bad (or that have invalid lines) get accepted but skipped.

  3. usr/src/cmd/praudit/format.c (Diff revision 1)
     
     

    Check for failures of fgetgrent(), too.

  4. usr/src/cmd/praudit/main.c (Diff revision 1)
     
     
     

    It looks like these definitions should go in praudit.h, rather than directly here.

  5. usr/src/cmd/praudit/main.c (Diff revision 1)
     
     

    pf is a pointer, so we should compare against NULL; i.e., if (pf != NULL) {

  6. usr/src/cmd/praudit/main.c (Diff revision 1)
     
     

    We should check the return of fclose() here, even if just via VERIFY0(fclose(pf)). Same with fclose(gf) a couple of lines down.

    1. Indirectly via the errno check on fgetpwent; looking at the gate very few instance of fclose are checked, and we don't have pending writes to worry about.

  7. usr/src/cmd/praudit/main.c (Diff revision 1)
     
     

    if (gf != NULL) {

  8. usr/src/man/man1m/praudit.1m (Diff revision 1)
     
     

    Is there a period missing on the front of the line here?

  9. usr/src/man/man1m/praudit.1m (Diff revision 1)
     
     

    Is this behaviour desirable? If the audit file is from a foreign system, would it not be more correct to use only the provided file and not fall back to IDs from the local system?

    1. I think this is correct. It's far better than what we have now, and also covers the case where you're importing a NIS passwd map (or the users from configuration management) and using the local passwd file for base system accounts.

  10. 
      
ptribble
ptribble
ptribble
ptribble
citrus
  1. Ship It!
  2. 
      
andy_js
  1. Ship It!
  2. 
      
jclulow
  1. Ship It!
  2. 
      
ptribble
Review request changed

Status: Closed (submitted)

Loading...