You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
User with privileged SCC can't let images start as default user #5317
I1022 05:08:19.208508 6230 admission.go:110] getting security context constraints for pod hello-openshift (generate: ) in namespace default with user info &{system:admin [system:cluster-admins system:authenticated]}
I1022 05:08:19.209151 6230 admission.go:119] getting security context constraints for pod hello-openshift (generate: ) with service account info &{system:serviceaccount:default:default [system:serviceaccounts system:serviceaccounts:default]}
I1022 05:08:19.211671 6230 admission.go:335] got preallocated values for min: 1000010000, max: 1000019999 for uid range in namespace default
I1022 05:08:19.211722 6230 admission.go:348] got preallocated value for level: s0:c3,c2 for selinux options in namespace default
I1022 05:08:19.212470 6230 admission.go:393] validating pod hello-openshift (generate: ) against providers restricted,privileged
I1022 05:08:19.212881 6230 admission.go:146] pod hello-openshift (generate: ) validated against provider restricted
Unless you specifically ask for something you will run as the most restrictive context available to you. In this case the admin has access to both the restricted and privileged scc. You should be able to set the RunAsUser to anything you want though.
Allow users to use their least restrictive SCC by default when creating pods rather than having to request elevated privileges to activate a less restrictive SCC
Allow administrators to influence the order in which SCC generation/validation is attempted per namespace
Changes
Refactor the existing ByRestrictions sorter to reverse the order that SCCs are sorted.
Introduce a new, per-namespace annotation of `sa.scc.sort="comma, delim, list, of, scc, names"
Adapt the sorter to provide increased scoring for SCCs named in the namespace annotation
Current scoring adds weighted points per escalated feature. The less restricted an SCC is, the higher the score
For SCCs in the namespace annotation point scoring is overridden such that anything in the annotation is given a score of 500 - idx where idx is the SCC's position in the annotation.
Use cases
Assumptions
Current scoring mechanism is modified for new features being introduced and will look as follows:
priv = 100
host dir = 10
host pid = 10
host ipc = 10
host network = 10
host ports = 10
RunAsAny strat = 4
RunAsNonRoot strat = 3
RunAsRangeStrat = 2
MustRunAsStrat = 1
Max base score for everything except root (4 strategies): 66
Min base score: 4
All use cases assume the following SCCs are configured:
privileged: base score of 166 (priv + all host access + all RunAsAny strats)
semi-privileged: base score of 66 (all host access + RunAsAny strats)
restricted: base score of 4
Use cases describe the returned sort in the form of [name:score]
No ns annotation
Granted access to restricted only returns sort of [restricted:4]
Granted access to restricted and semi-privileged returns sort of [semi-privileged:66, restricted:4]
Granted access to all SCCs returns sort of [privileged:166, semi-privileged:66, restricted:4]
NS annotation of 'restricted'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of [restricted:500, semi-privileged:66]
Granted access to all SCCs returns sort of [restricted:500, privileged: 166, semi-privileged:66]
NS annotation of 'restricted,semi-privileged'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of [restricted:500, semi-privileged:499]
Granted access to all SCCs returns sort of [restricted:500, semi-privileged:499, privileged: 166]
NS annotation of 'restricted,semi-privileged,privileged'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of [restricted:500, semi-privileged:499]
Granted access to all SCCs returns sort of [restricted:500, semi-privileged:499, privileged: 498]
NS annotation of 'semi-privileged,restricted,privileged'
Granted access to restricted only returns sort of [restricted:499]
Granted access to restricted and semi-privileged returns sort of [semi-privileged:500, restricted:499]
Granted access to all SCCs returns sort of [semi-privileged:500, restricted:499, privileged:498]
If a SCC allows a default to be applied to be used from the image, use
that in preference to the most restrictive
a. This applies for all allocated fields from the namespace
Why can we not structured this as "if the allowed SCCs allows the pod to
use an inherited default for a known set of inherited defaults, don't
enforce".
Allow users to use their least restrictive SCC by default when
creating pods rather than having to request elevated privileges to activate
a less restrictive SCC
Allow administrators to influence the order in which SCC
generation/validation is attempted per namespace
Changes
Refactor the existing ByRestrictions sorter to reverse the order
that SCCs are sorted.
Introduce a new, per-namespace annotation of `sa.scc.sort="comma,
delim, list, of, scc, names"
Adapt the sorter to provide increased scoring for SCCs named in the
namespace annotation
Current scoring adds weighted points per escalated feature. The
less restricted an SCC is, the higher the score
For SCCs in the namespace annotation point scoring is overridden
such that anything in the annotation is given a score of 500 - idx) where
idx is the SCC's position in the annotation.
Use cases Assumptions
Current scoring mechanism is modified for new features being introduced
and will look as follows:
priv = 100
host dir = 10
host pid = 10
host ipc = 10
host network = 10
host ports = 10
RunAsAny strat = 4
RunAsNonRoot strat = 3
RunAsRangeStrat = 2
MustRunAsStrat = 1
Max base score for everything except root (4 strategies): 66
Min base score: 4
All use cases assume the following SCCs are configured:
privileged: base score of 166 (priv + all host access + all
RunAsAny strats)
semi-privileged: base score of 66 (all host access + RunAsAny
strats)
restricted: base score of 4
Use cases describe the returned sort in the form of [name:score]
No ns annotation
Granted access to restricted only returns sort of [restricted:4]
Granted access to restricted and semi-privileged returns sort of
[semi-privileged:66, restricted:4]
Granted access to all SCCs returns sort of [privileged:166,
semi-privileged:66, restricted:4]
NS annotation of 'restricted'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of
[restricted:500, semi-privileged:66]
Granted access to all SCCs returns sort of [restricted:500,
privileged: 166, semi-privileged:66]
NS annotation of 'restricted,semi-privileged'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of
[restricted:500, semi-privileged:499]
Granted access to all SCCs returns sort of [restricted:500,
semi-privileged:499, privileged: 166]
NS annotation of 'restricted,semi-privileged,privileged'
Granted access to restricted only returns sort of [restricted:500]
Granted access to restricted and semi-privileged returns sort of
[restricted:500, semi-privileged:499]
Granted access to all SCCs returns sort of [restricted:500,
semi-privileged:499, privileged: 498]
NS annotation of 'semi-privileged,restricted,privileged'
Granted access to restricted only returns sort of [restricted:499]
Granted access to restricted and semi-privileged returns sort of []
Granted access to all SCCs returns sort of [semi-privileged:500,
restricted:499, privileged:498]
—
Reply to this email directly or view it on GitHub #5317 (comment).
Do we not get that by default if we reverse the points comparison? Strategies that allow using dockerfile defaults are RunAsAny and RunAsNonRoot which have higher scores.
That's correct. In that case we would only need to rate mutating strategies so the sort code could be reduced quite a bit. Ok with the admin influence piece of this?
The question is do we even need this complexity. The use case for keeping
admin influence and sorting is "let the admin impose a default". But I
think that's better targeted by something like "apply this SCC as the
defaults to the pod if the user has access to it." Can't we just break
this up into
Apply defaults
Verify access
On Tue, Oct 27, 2015 at 9:41 AM, Jordan Liggitt [email protected]
wrote:
Ok with the admin influence piece of this?
I guess
—
Reply to this email directly or view it on GitHub #5317 (comment).
ok. In that case, how about if the annotation takes only takes a single, named SCC for the namespace. If it exists it is bumped to the front of the line, period. No changing of scores, no changing of sort methods.
So the behavior would be:
secure by default, you generate/validate against the most restrictive scc that supports the request
UNLESS your namespace has a preferred SCC in which case you'll generate/validate against the provided SCC first and fall back to item 1
Jordan and I argued for a bit. Here's the proposal:
Add a priority field to SCC which is "defaultingOrder" or
"defaultingPriority"
Create a few new SCCs between restricted and privileged - one being
"runAsAny" (or a better name, like "relaxed")
Find the SCCs that apply, sort them by priority only, apply a
deterministic sort when priorities are equal (name), drop all existing
magic sorting rules), apply those as defaults. Defaulting only sets unset
fields
Validate the final result against their SCCs that apply
On Tue, Oct 27, 2015 at 11:07 AM, Paul Weil [email protected]
wrote:
ok. In that case, how about if the annotation takes only takes a single,
named SCC for the namespace. If it exists it is bumped to the front of the
line, period. No changing of scores, no changing of sort methods.
So the behavior would be:
secure by default, you generate/validate against the most
restrictive scc that supports the request
UNLESS your namespace has a preferred SCC in which case you'll
generate/validate against the provided SCC first and fall back to item 1
—
Reply to this email directly or view it on GitHub #5317 (comment).
Basically this replaces the calculated sorting (most-least restrictive,
somewhat arbitrary) with admin controlled ordering.
On Tue, Oct 27, 2015 at 11:33 AM, Clayton Coleman [email protected]
wrote:
Jordan and I argued for a bit. Here's the proposal:
Add a priority field to SCC which is "defaultingOrder" or
"defaultingPriority"
Create a few new SCCs between restricted and privileged - one being
"runAsAny" (or a better name, like "relaxed")
Find the SCCs that apply, sort them by priority only, apply a
deterministic sort when priorities are equal (name), drop all existing
magic sorting rules), apply those as defaults. Defaulting only sets unset
fields
Validate the final result against their SCCs that apply
On Tue, Oct 27, 2015 at 11:07 AM, Paul Weil [email protected]
wrote:
ok. In that case, how about if the annotation takes only takes a single,
named SCC for the namespace. If it exists it is bumped to the front of the
line, period. No changing of scores, no changing of sort methods.
So the behavior would be:
secure by default, you generate/validate against the most
restrictive scc that supports the request
UNLESS your namespace has a preferred SCC in which case you'll
generate/validate against the provided SCC first and fall back to item 1
—
Reply to this email directly or view it on GitHub #5317 (comment).
3 - Find the SCCs that apply, sort them by priority only, apply a deterministic sort when priorities are equal (name), drop all existing magic sorting rules), apply those as defaults. Defaulting only sets unset fields
4 - Validate the final result against their SCCs that apply
Close, but I think you only need step 3, and the application of an SCC should stay the same as it is today. Only the way we select the SCC would change. Some constraints (RunAsAny) wouldn't mutate the pod, while others would (RunAsRange). Which SCC gets selected determines whether the pod is mutated
@liggitt - got it. Discussed in IRC. This won't change the way admission behaves (only the ByRestrictions sorter which will no longer be by restrictions it will be by priority) so I think it is relatively minor. I'll work it up.
Activity
smarterclayton commentedon Oct 22, 2015
smarterclayton commentedon Oct 22, 2015
from the default namespace
pweil- commentedon Oct 22, 2015
Unless you specifically ask for something you will run as the most restrictive context available to you. In this case the admin has access to both the restricted and privileged scc. You should be able to set the RunAsUser to anything you want though.
pweil- commentedon Oct 26, 2015
proposal:
Requirements
Changes
ByRestrictionssorter to reverse the order that SCCs are sorted.Use cases
Assumptions
Current scoring mechanism is modified for new features being introduced and will look as follows:
Max base score for everything except root (4 strategies): 66
Min base score: 4
All use cases assume the following SCCs are configured:
Use cases describe the returned sort in the form of [name:score]
No ns annotation
NS annotation of 'restricted'
NS annotation of 'restricted,semi-privileged'
NS annotation of 'restricted,semi-privileged,privileged'
NS annotation of 'semi-privileged,restricted,privileged'
smarterclayton commentedon Oct 27, 2015
I would rephrase the requirements:
that in preference to the most restrictive
a. This applies for all allocated fields from the namespace
Why can we not structured this as "if the allowed SCCs allows the pod to
use an inherited default for a known set of inherited defaults, don't
enforce".
On Mon, Oct 26, 2015 at 5:14 PM, Paul Weil [email protected] wrote:
liggitt commentedon Oct 27, 2015
Yeah, it's more "select the SCC that requires the least mutation of the pod"
pweil- commentedon Oct 27, 2015
Do we not get that by default if we reverse the points comparison? Strategies that allow using dockerfile defaults are RunAsAny and RunAsNonRoot which have higher scores.
liggitt commentedon Oct 27, 2015
"security points" isn't the same as "mutation distance"... only the RunAs strategies mutate (I think)
pweil- commentedon Oct 27, 2015
That's correct. In that case we would only need to rate mutating strategies so the sort code could be reduced quite a bit. Ok with the admin influence piece of this?
liggitt commentedon Oct 27, 2015
I guess
smarterclayton commentedon Oct 27, 2015
The question is do we even need this complexity. The use case for keeping
admin influence and sorting is "let the admin impose a default". But I
think that's better targeted by something like "apply this SCC as the
defaults to the pod if the user has access to it." Can't we just break
this up into
On Tue, Oct 27, 2015 at 9:41 AM, Jordan Liggitt [email protected]
wrote:
pweil- commentedon Oct 27, 2015
ok. In that case, how about if the annotation takes only takes a single, named SCC for the namespace. If it exists it is bumped to the front of the line, period. No changing of scores, no changing of sort methods.
So the behavior would be:
smarterclayton commentedon Oct 27, 2015
Jordan and I argued for a bit. Here's the proposal:
"defaultingPriority"
"runAsAny" (or a better name, like "relaxed")
deterministic sort when priorities are equal (name), drop all existing
magic sorting rules), apply those as defaults. Defaulting only sets unset
fields
On Tue, Oct 27, 2015 at 11:07 AM, Paul Weil [email protected]
wrote:
smarterclayton commentedon Oct 27, 2015
Basically this replaces the calculated sorting (most-least restrictive,
somewhat arbitrary) with admin controlled ordering.
On Tue, Oct 27, 2015 at 11:33 AM, Clayton Coleman [email protected]
wrote:
liggitt commentedon Oct 27, 2015
Close, but I think you only need step 3, and the application of an SCC should stay the same as it is today. Only the way we select the SCC would change. Some constraints (RunAsAny) wouldn't mutate the pod, while others would (RunAsRange). Which SCC gets selected determines whether the pod is mutated
pweil- commentedon Oct 27, 2015
@liggitt - got it. Discussed in IRC. This won't change the way admission behaves (only the ByRestrictions sorter which will no longer be by restrictions it will be by priority) so I think it is relatively minor. I'll work it up.