Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Bug 1235399 - enable tc-proxy to work with certificates #8

Merged
merged 14 commits into from
Jan 19, 2016

Conversation

petemoore
Copy link
Member

Not yet tested...

@petemoore
Copy link
Member Author

In order to test this in travis, we'll need to implement http://docs.taskcluster.net/auth/temporary-credentials/ in go - that hasn't been done yet, but should live in taskcluster-client-go.

@petemoore
Copy link
Member Author

Note, I logged in just now with login.taskcluster.net, and got myself some temporary credentials. I then used these for running the tests, and all the tests passed. \o/

We should still do this as part of the tests - but just so you know, it does seem to be working, even if we don't have unit tests yet.

…t 3 numbers. Since supporting a new feature now (temp creds), bumped second number rather than third.
…t 3 numbers. Since supporting a new feature now (temp creds), bumped second number rather than third.
@petemoore
Copy link
Member Author

Note - the travis failure is only because coverage has reduced overall with this change. When I add tests for temp creds, this will obviously be resolved.

and `TASKCLUSTER_ACCESS_TOKEN` environment variables.
and `TASKCLUSTER_ACCESS_TOKEN` environment variables, optionally with
a `TASKCLUSTER_CERITIFICATE` environment variable in the case of using
temporary credentials.
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that at least with docker, you do NOT want to communicate these with env vars, as those vars get injected into every linked container (including the task container). Docker-worker uses the command-line options instead.

@djmitche
Copy link
Contributor

Looks good :)

@petemoore
Copy link
Member Author

Although the latest commit appears like a big refactor, I essentially just inlined the tests as a local function, and then call it with both permanent credentials and temporary credentials. Due to the increased indentation, the diff looks like quite a mess, but essentially that's all I did...

@petemoore
Copy link
Member Author

@djmitche can you take a look again? Thanks!


func testWithTempCreds(t *testing.T, test IntegrationTest) {
skipIfNoPermCreds(t)
tempCredentials, err := permCredentials.CreateTemporaryCredentials(1*time.Hour, "*")
Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops - I forgot to reduce this from '*' - I still need to do that (will do that tomorrow)...

@djmitche
Copy link
Contributor

djmitche commented Jan 6, 2016

Looks good

…ther with temp creds in current implementation
@petemoore
Copy link
Member Author

I updated the test - and discovered a bug in the process! In short, currently AuthorizationDelegate function is not working with temporary credentials - the easiest way to fix this will be to use tcclient library instead.

Basically, the ext field in the Authorization header doesn't include both the temporary credentials certificate and the authorizedScopes - they need to be merged into a single json. The tcclient library does this.

@petemoore
Copy link
Member Author

Fixed the genuine bug that was discovered via a test. With the updates, taskcluster-proxy is now using the same tcclient library as taskcluster-client-go uses under the hood, so we now have less code to manage

@djmitche hopefully this should be the last review! Thanks.

@djmitche
Copy link
Contributor

👍

petemoore added a commit that referenced this pull request Jan 19, 2016
Bug 1235399 - enable tc-proxy to work with certificates
@petemoore petemoore merged commit 66dd510 into master Jan 19, 2016
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.

None yet

2 participants