-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitLab Delegated Joining #22705
GitLab Delegated Joining #22705
Conversation
SaaS GitLab testAs of 6c85c3f - we now have working delegated joining. All that remains is adding all the remaining allow rule options and testing against self-hosted GitLab. Sample workflow: stages: # List of stages for jobs, and their order of execution
- build
build-job: # This job runs in the build stage, which runs first.
stage: build
id_tokens:
TBOT_GITLAB_JWT:
aud: teleport.example.com
script:
- echo $CI_JOB_JWT | base64
- echo $CI_JOB_JWT_V2 | base64
- echo $TBOT_GITLAB_JWT | base64
- whoami
- ./tbot start --token=gitlab-bot --destination-dir=./tbot-user --auth-server=teleport.example.com:443 --join-method=gitlab --oneshot
- ./tsh -i ./tbot-user/identity --proxy teleport.example.com:443 ls Sample token config: kind: token
version: v2
metadata:
name: gitlab-bot
expires: "3000-01-01T00:00:00Z"
spec:
roles: [Bot]
join_method: gitlab
bot_name: gitlab-demo
gitlab:
allow:
- sub: "project_path:strideynet/gitlab-sandbox:ref_type:branch:ref:main |
Remaining task is to stand up a self-hosted GitLab instance and test against this instance ! |
GitLab instance stood up - will hopefully run a manual test against this instance tomorrow morning. |
Self-hosted test
stages: # List of stages for jobs, and their order of execution
- build
build-job: # This job runs in the build stage, which runs first.
stage: build
id_tokens:
TBOT_GITLAB_JWT:
aud: teleport.example.com
script:
- ./tbot start --token=gitlab-self-hosted-bot --destination-dir=./tbot-user --data-dir=./tbot-data --auth-server=teleport.example.com:443 --join-method=gitlab --oneshot
- TELEPORT_LOGIN=root ./tsh -i ./tbot-user/identity --proxy teleport.example.com:443 ls ProvisionToken resource kind: token
version: v2
metadata:
name: gitlab-self-hosted-bot
expires: "3000-01-01T00:00:00Z"
spec:
roles: [Bot]
join_method: gitlab
bot_name: gitlab-demo
gitlab:
domain: gitlab.example.com
allow:
- project_path: noah/gitlab-sandbox
ref_type: branch
ref: main
namespace_path: noah I included some additional fields more than necessary in the allow rules just to check that all of these function as expected. |
Also manually tested:
|
@strideynet See the table below for backport results.
|
* Add type for GitLab ProvisionToken * Add default behaviour for domain * Add IDTokenClaims for GitLab * Add gitlab token source and token validator * Thread GitLab support through auth and tbot packages * Adjust cluster name fetching in token validator * Initialize GitLab token validator in auth * Improve comment on `sub` * Working GitLab CI delegated joining * Add additional token rule fields * Add checking for new configuration fields * add additional test cases for validation of gitlab config struct * Add TestAuth_RegisterUsingToken_GitLab * Add tests for IDTokenSource * Fix imports * Add tests for GitLab Token Validator * Fix some comments that were incomplete * Add license headers
* Add type for GitLab ProvisionToken * Add default behaviour for domain * Add IDTokenClaims for GitLab * Add gitlab token source and token validator * Thread GitLab support through auth and tbot packages * Adjust cluster name fetching in token validator * Initialize GitLab token validator in auth * Improve comment on `sub` * Working GitLab CI delegated joining * Add additional token rule fields * Add checking for new configuration fields * add additional test cases for validation of gitlab config struct * Add TestAuth_RegisterUsingToken_GitLab * Add tests for IDTokenSource * Fix imports * Add tests for GitLab Token Validator * Fix some comments that were incomplete * Add license headers
Closes #17059
Docs will come in a future PR o7