Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Privileged usage not correctly detected #6

Open
GamerBene19 opened this issue Aug 16, 2024 · 0 comments
Open

Privileged usage not correctly detected #6

GamerBene19 opened this issue Aug 16, 2024 · 0 comments

Comments

@GamerBene19
Copy link

This image fails to start with with --privileged (at least in my docker environments).

The issue seems to be the output of capsh --print in this case. This line in the entrypoint script isn't able to handle the capsh output in the privileged case.

Compare

[~] * docker run --rm --cap-add SYS_ADMIN -it  alpine:latest sh
/ # apk add --no-cache --update libcap
...
OK: 8 MiB in 19 packages
/ # capsh --print
Current: cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_sys_admin,cap_mknod,cap_audit_write,cap_setfcap=ep
...

to

[~] * docker run --rm --privileged -it alpine:latest sh
/ # apk add --no-cache --update libcap
...
OK: 8 MiB in 19 packages
/ # capsh --print
Current: =ep
...

As far as I understand =ep more or less indicates "everything is allowed" see here.
Thereby, I think the simplest fix is to add another check to the function like so

  if capsh --print | grep -Eq "^Current: =ep"; then
    return 0
  fi

but I might be overlooking something, that's why I've opened this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant