<div dir="ltr">As <span style="font-size:12.8px">kubectl is a CLI installed on end-user machines it&#39;s a public client. For a CLI I&#39;d use a system browser and make the CLI start a temporary web server on localhost:XXXX, or I&#39;d fallback to using resource owner password cred.</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">ID token is an authentication token. So if you use that you should use it to authenticate with the service kubectl invokes and set up a session cookie to preserve the security context. Would make more sense to me to use the access token though, and have kubectl responsible to refresh it.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 September 2016 at 20:59, Marc Boorshtein <span dir="ltr">&lt;<a href="mailto:marc.boorshtein@tremolosecurity.com" target="_blank">marc.boorshtein@tremolosecurity.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Reposting on Eric&#39;s behalf</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 14, 2016 2:54 PM, &quot;Eric Chiang&quot; &lt;<a href="mailto:eric.chiang@coreos.com" target="_blank">eric.chiang@coreos.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Marc for the cc,<br><br>Just to give some background for the reasoning behind this.<br><br>Today the Kubernetes API server trusts ID Tokens issued to a single client. Refreshing a token requires a client_secret, hence the flags Marc provided in his example. Though we don&#39;t have official recommendations about what the properties of the client passed in those flags should be there&#39;s two obvious ways of going about this.<br><br>1) Have each kubectl share a client secret. Some authorization servers provide mechanisms for declaring &quot;public clients&quot; to imposes restrictions on its capabilities. For example Google, when it assumes client_secrets aren&#39;t secret, restricts the redirect URLs for embedded apps to only localhost and a magic OOB, doesn&#39;t let it do incremental authorization, etc. Though as Marc noted this may have unintended consequences with providers who assume this doesn&#39;t happen.<br><br>2) Another option is for kubectl to utilize the &quot;azp&quot; claim in the ID Token[0], which allows clients to request ID Tokens on behalf of other clients. This means each kubectl gets its own client_id and client_secret, with each one requesting ID Tokens minted for a common client_id. However that capability isn&#39;t generally supported by OIDC providers, though Google does[1]. This is probably a more secure option, but the actual implementations differ so widely that it becomes hard to make a general statement.<br><br>We&#39;d be interested in knowing if either of these methods raise red flags when combined with keycloak.<br><br>Eric<br><br>[0] <a href="https://openid.net/specs/openid-connect-core-1_0.html#IDToken" target="_blank">https://openid.net/specs/o<wbr>penid-connect-core-1_0.html#ID<wbr>Token</a><br>[1] <a href="https://developers.google.com/identity/protocols/CrossClientAuth" target="_blank">https://developers.google.<wbr>com/identity/protocols/CrossCl<wbr>ientAuth</a><br><br><br></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 10:16 AM, Marc Boorshtein <span dir="ltr">&lt;<a href="mailto:marc.boorshtein@tremolosecurity.com" target="_blank">marc.boorshtein@tremolosecuri<wbr>ty.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">KC Team,<br>
<br>
Eric Chiang from CoreOS (cc&#39;d on this email) and I have been talking<br>
on the Kubernetes sig-auth slack channel about how secret the &quot;client<br>
secret&quot; in OIDC should be.  The context for the question is that<br>
Kubernetes&#39; OIDC implementation uses the id_token as the bearer token<br>
(as opposed to the access_token) to avoid a round trip.  Since the<br>
id_token should be short lived the question of how to get a new one<br>
using a refresh_token.  The current solution is to give kubectl the<br>
refresh_token, the idp discovery url and the client id and secret:<br>
<br>
kubectl config set-credentials --auth-provider=oidc<br>
kubectl config set-credentials --auth-provider-args=idp-issue<wbr>r-url=(<br>
issuer url )<br>
kubectl config set-credentials --auth-provider-args=client_id<wbr>=( your client id )<br>
kubectl config set-credentials --auth-provider-args=client_se<wbr>cret=(<br>
your client secret )<br>
kubectl config set-credentials --auth-provider-args=refresh-t<wbr>oken=(<br>
your refresh token )<br>
<br>
This way kubectl can get a new id_token once the possessed one<br>
expires.  The question becomes does giving the client_secret directly<br>
to users become a security issue since its now a shared credential?<br>
<br>
Some issues I see are:<br>
1.  Rotation becomes harder - how many people have this?<br>
2.  While you can&#39;t generate an access_token with just this secret,<br>
you CAN impersonate an RP so if your are monitoring which RPs are<br>
making requests an attacker could generate excessive requests for a<br>
single RP even if those requests fail<br>
3.  Since most IdPs will generate some kind of back-end record for a<br>
request if you have the client id and secret you could more easily do<br>
a DoS attack by flooding the server with authenticated requestes for<br>
authentication<br>
<br>
What are your thoughts?  Google provides an example asserting that the<br>
client secret ISN&#39;T secret (reading through it I think the example<br>
contradicts its self)<br>
<a href="https://developers.google.com/api-client-library/python/auth/installed-app" rel="noreferrer" target="_blank">https://developers.google.com/<wbr>api-client-library/python/auth<wbr>/installed-app</a><br>
<br>
Thanks<br>
<span><font color="#888888"><br>
<br>
Marc Boorshtein<br>
CTO Tremolo Security<br>
<a href="mailto:marc.boorshtein@tremolosecurity.com" target="_blank">marc.boorshtein@tremolosecurit<wbr>y.com</a><br>
Twitter - @mlbiam / @tremolosecurity<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div></div>
<br>______________________________<wbr>_________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-dev</a><br></blockquote></div><br></div>