Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1422252 - `oc logout` does not work when logged in with a service account token
`oc logout` does not work when logged in with a service account token
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.4.0
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Juan Vallejo
Xingxing Xia
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-02-14 16:23 EST by Jordan Liggitt
Modified: 2017-07-24 10 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Deleting an access token using the OAuthAccessTokens client would fail for users that had logged in using a serviceaccount token. Consequence: A failure from the access token client would prevent the token from being deleted from the local config, causing a user to be unable to log out. Fix: Rather than failing ona failure to delete a token using the api, such failure is now logged, ensuring that an attempt to remove the token from the user's local config always takes place. Result: A user is now able to logout after logging in with a serviceaccount token.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-04-12 15:12:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Origin (Github) 7011 None None None 2017-02-14 16:23 EST
Red Hat Product Errata RHBA-2017:0884 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.5 RPM Release Advisory 2017-04-12 18:50:07 EDT

  None (edit)
Description Jordan Liggitt 2017-02-14 16:23:31 EST
Clone of https://github.com/openshift/origin/issues/7011

When logged in with a service account token, `oc logout` does not remove the token from the kubeconfig

Example:

``` sh
$ oc new-project my-project
Now using project "my-project" on server "https://10.13.137.174:8443".
$ oc sa new my-sa
serviceaccount/my-sa
$ oc login --token="$( oc sa get-token my-sa )"
Logged into "https://10.13.137.174:8443" as "system:serviceaccount:my-project:my-sa" using the token provided.
$ oc logout
Error from server: oauthaccesstokens "<snip>" not found
$ oc whoami
system:serviceaccount:my-project:my-sa
```


The token cannot be deleted via the API, but it should be removed from the kubeconfig.
Comment 1 Juan Vallejo 2017-02-14 18:32:57 EST
Related PR: https://github.com/openshift/origin/pull/12962
Comment 2 Fabiano Franz 2017-02-21 09:27:06 EST
Fixed in https://github.com/openshift/origin/pull/12962
Comment 3 Troy Dawson 2017-02-24 15:47:40 EST
This has been merged into ocp and is in OCP v3.5.0.34 or newer.
Comment 5 Xingxing Xia 2017-02-27 01:12:42 EST
Verified in oc v3.5.0.34.
$ oc create serviceaccount my-sa
serviceaccount "my-sa" created

$ oc login --token="$( oc sa get-token my-sa )"
Logged into "https://<master>:8443" as "system:serviceaccount:xxia-proj:my-sa" using the token provided.

$ oc logout
Logged "system:serviceaccount:xxia-proj:my-sa" out on "https://<master>:8443"

$ oc whoami
Error from server (Forbidden): User "system:anonymous" cannot get users at the cluster scope

From above result, oc logout can logout a serviceaccount token
Comment 7 errata-xmlrpc 2017-04-12 15:12:56 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0884

Note You need to log in before you can comment on or make changes to this bug.