Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Disallow running Graphene as root #2654

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

boryspoplawski
Copy link
Contributor

@boryspoplawski boryspoplawski commented Aug 18, 2021

Description of the changes

Just don't.


This change is Reviewable

@boryspoplawski
Copy link
Contributor Author

Jenkins, retest Jenkins-Debug-20.04 please (sendfile09 timed out, known issue)

Copy link

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @boryspoplawski)

a discussion (no related file):
But why?

What about Docker containers, where the user is typically root (though I'm not sure about accessibility of /proc/kallsyms inside Docker)? I don't know apps that restrict being run as root, is this something that people do?

Also, maybe just change to a warning instead of failing?


Copy link
Member

@woju woju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @boryspoplawski and @dimakuv)

a discussion (no related file):

is this something that people do?

Rarely, but this happens for several reasons. Wireshark bails out, because the corpus of packet dissectors is too big and probably vulnerable (and usually run over untrusted traffic), so only the capture process itself runs as root. X11 apps should not be run as root and some of them complain, because there will be problems with connecting to X server and friends (auth cookie, session dbus etc. -- while it can be done, it's not recommended).

I think the only reason people run graphene as root is because they can't configure their servers and sudo graphene-sgx is a magic incantation to overcome problems with permissions.

Also, maybe just change to a warning instead of failing?

Or better, an undocumented override like
if ! [ -z "$I_PROMISE_NOT_TO_SEND_SUPPORT_REQUESTS_ANYWHERE" ] && [ $(id ...) -eq 0 ].



Runtime/pal_loader, line 25 at r1 (raw file):

fi

if [ "00" -eq "0$(id -u 2>/dev/null)" ]

if [ 0"$(id ...)" -eq 0 ] is OK, -eq works on ints, not strings.

Copy link
Contributor Author

@boryspoplawski boryspoplawski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @dimakuv and @woju)

a discussion (no related file):
@dimakuv

But why?

Because it's insecure and unsupported yet lots of people do that.

What about Docker containers, where the user is typically root (though I'm not sure about accessibility of /proc/kallsyms inside Docker)?

This checks if user is root and if they have CAP_SYSLOG, which is not true in default docker (but it would fail in --privileged one, but that's basically the same as running as root). Ideally we would check for CAP_SYSADMIN, but I couldn't find a way without manually parsing /proc/self/status and checking caps bits.



Runtime/pal_loader, line 25 at r1 (raw file):

Previously, woju (Wojtek Porczyk) wrote…

if [ 0"$(id ...)" -eq 0 ] is OK, -eq works on ints, not strings.

But I wanted to work on strings (in case id returns something thats not a number).
Should look better now.

Signed-off-by: Borys Popławski <[email protected]>
Copy link
Member

@woju woju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @dimakuv)


Runtime/pal_loader, line 25 at r1 (raw file):

Previously, boryspoplawski (Borys Popławski) wrote…

But I wanted to work on strings (in case id returns something thats not a number).
Should look better now.

Yep.

Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @boryspoplawski and @dimakuv)


Runtime/pal_loader, line 25 at r2 (raw file):

fi

if [ -z "$I_AM_AWARE_OF_CONSEQUENCES_AND_I_WONT_SUBMIT_GRAPHENE_REPORTS_WITH_THIS_ENABLED" ] && \

GRAPHENE_REPORTS -> GRAPHENE_BUGREPORTS (it's not clear what "reports" you mean here)

Copy link
Contributor Author

@boryspoplawski boryspoplawski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @dimakuv and @mkow)


Runtime/pal_loader, line 25 at r2 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…

GRAPHENE_REPORTS -> GRAPHENE_BUGREPORTS (it's not clear what "reports" you mean here)

Any and all of them

@svenkata9
Copy link
Contributor

svenkata9 commented Aug 23, 2021

Because it's insecure and unsupported yet lots of people do that.

@boryspoplawski I know executing as root in general is insecure. But, what is the specific issue w.r.t. Graphene?

Copy link

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @boryspoplawski and @mkow)

a discussion (no related file):

Previously, boryspoplawski (Borys Popławski) wrote…

@dimakuv

But why?

Because it's insecure and unsupported yet lots of people do that.

What about Docker containers, where the user is typically root (though I'm not sure about accessibility of /proc/kallsyms inside Docker)?

This checks if user is root and if they have CAP_SYSLOG, which is not true in default docker (but it would fail in --privileged one, but that's basically the same as running as root). Ideally we would check for CAP_SYSADMIN, but I couldn't find a way without manually parsing /proc/self/status and checking caps bits.

OK. I'm fine with the magic override I_AM_AWARE_OF_CONSEQUENCES_AND_I_WONT_SUBMIT_GRAPHENE_REPORTS_WITH_THIS_ENABLED.


a discussion (no related file):
From what I understand, @boryspoplawski wanted to add some documentation on how to config the system to NOT require root. So this PR is blocked on this.


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

Successfully merging this pull request may close these issues.

5 participants