libs icon indicating copy to clipboard operation
libs copied to clipboard

Consider scap host root for passwd and group lookup

Open deepskyblue86 opened this issue 3 years ago • 1 comments

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area libscap

/area libsinsp

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it: Take users and groups considering scap host root. When no host root is set, fall back using getpwent, getgrent, getpwuid, and getgrgid.

This way, when running on the host we will preserve the lookup with NSS, when running as a container we will show the host users and groups instead of the container ones (from files).

This applies to scap_create_userlist and sinsp_usergroup_manager. Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer: This may look as a change in the current behavior, but actually when running as a container, sinsp will report the host users and groups trying to map them to the container ones, which would be misleading.

Does this PR introduce a user-facing change?:

consider scap host root for passwd and group lookup

deepskyblue86 avatar Aug 08 '22 09:08 deepskyblue86

I like this! Thank you @deepskyblue86 !

FedeDP avatar Aug 30 '22 07:08 FedeDP

LGTM label has been added.

Git tree hash: f11e0ad57cde42abda2e390aa8ff826370f0a78e

poiana avatar Aug 30 '22 07:08 poiana

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepskyblue86, FedeDP, Molter73

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • ~~OWNERS~~ [FedeDP,Molter73]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

poiana avatar Aug 31 '22 12:08 poiana