Skip to content
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

Machine ID: Add bitbucket join method for Bitbucket Pipelines joining #48724

Merged
merged 20 commits into from
Nov 21, 2024

Conversation

timothyb89
Copy link
Contributor

@timothyb89 timothyb89 commented Nov 9, 2024

This adds a new bitbucket join method that Machine ID bots can use to authenticate to Teleport from Bitbucket Pipelines CI runs.


Minimal bitbucket pipeline config (using a custom build on my own infra with this patch):

image: atlassian/default-image:3

pipelines:
  custom:
    run-tbot:
      - step:
          oidc: true
          script:
            - wget https://builds.cursed.industries/teleport-v17.0.0-dev-linux-amd64-bin.tar.gz
            - tar zxvf teleport-v17.0.0-dev-linux-amd64-bin.tar.gz
            - ./teleport/tbot start identity --storage=./tbot-data --destination ./tbot-user --join-method=bitbucket --proxy-server=example.cloud.gravitational.io:443 --token=bot-bitbucket --oneshot
            - ssh -F ./tbot-user/ssh_config root@b54e07fe397f.example.cloud.gravitational.io echo "hello world"

And associated bitbucket-type join token:

kind: token
version: v2
metadata:
  # name will be specified in the `tbot` to use this token
  name: bot-bitbucket
spec:
  roles: [Bot]
  # bot_name should match the name of the bot created earlier in this guide.
  bot_name: bitbucket
  join_method: bitbucket
  bitbucket:
    identity_provider_url: 'https://api.bitbucket.org/2.0/workspaces/example/pipelines-config/identity/oidc'
    audience: 'ari:cloud:bitbucket::workspace/foo'
    allow:
    - workspace_uuid: '{foo}'

Fixes #28601

changelog: Support delegated joining for Bitbucket Pipelines in Machine ID

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.
lib/bitbucket/bitbucket.go Show resolved Hide resolved
lib/bitbucket/token_validator.go Outdated Show resolved Hide resolved
This also fully adds `deployment_environment_uuid` which was found to
be missing.
Copy link

🤖 Vercel preview here: https://docs-hl9n6zvuq-goteleport.vercel.app/docs/ver/preview

@public-teleport-github-review-bot

@timothyb89 - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

Copy link

🤖 Vercel preview here: https://docs-hzp7pdojr-goteleport.vercel.app/docs/ver/preview

Copy link

🤖 Vercel preview here: https://docs-pg96y6ii0-goteleport.vercel.app/docs

Copy link

🤖 Vercel preview here: https://docs-p0hyichos-goteleport.vercel.app/docs

Copy link

🤖 Vercel preview here: https://docs-peb5ift37-goteleport.vercel.app/docs

@timothyb89 timothyb89 added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@timothyb89 timothyb89 added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@timothyb89 timothyb89 added this pull request to the merge queue Nov 21, 2024
Merged via the queue into master with commit dee7a6f Nov 21, 2024
44 checks passed
@timothyb89 timothyb89 deleted the timothyb89/bitbucket-pipelines-joining branch November 21, 2024 23:24
@public-teleport-github-review-bot

@timothyb89 See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Failed

timothyb89 added a commit that referenced this pull request Nov 21, 2024
…ng (#48724)

* Add `bitbucket` join method for Bitbucket Pipelines joining

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.

* Add unit tests for bitbucket joining

This also fully adds `deployment_environment_uuid` which was found to
be missing.

* Fix imports

* Update tf docs

* Docs update

* Update generated TF resources

* Attempt to work around docs linter

* Add provision token tests

* Remove pipeline_uuid and step_uuid from protos

Also, fix deploment_environment_uuid field name.

* Remove references to removed fields in tests

* Switch to go-oidc/v3 and remove now-redundant nbf check

* Fix go.mod imports for the TF provider

* Fix event-handler go.mod

* Address review feedback; add 15s timeout to fetch provider metadata

* Update lib/bitbucket/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Fix build after constant rename

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
timothyb89 added a commit that referenced this pull request Nov 22, 2024
…ng (#48724)

* Add `bitbucket` join method for Bitbucket Pipelines joining

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.

* Add unit tests for bitbucket joining

This also fully adds `deployment_environment_uuid` which was found to
be missing.

* Fix imports

* Update tf docs

* Docs update

* Update generated TF resources

* Attempt to work around docs linter

* Add provision token tests

* Remove pipeline_uuid and step_uuid from protos

Also, fix deploment_environment_uuid field name.

* Remove references to removed fields in tests

* Switch to go-oidc/v3 and remove now-redundant nbf check

* Fix go.mod imports for the TF provider

* Fix event-handler go.mod

* Address review feedback; add 15s timeout to fetch provider metadata

* Update lib/bitbucket/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Fix build after constant rename

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Nov 23, 2024
* Machine ID: Documentation for Bitbucket Pipelines joining

This adds guides and other documentation for the `bitbucket` join
method, which allows Machine ID bots to join from Bitbucket Pipelines
runs without shared secrets.

Follow up to #48724

* Linter appeasement (round 1)

* Add note about braces in UUIDs
github-actions bot pushed a commit that referenced this pull request Nov 23, 2024
This adds guides and other documentation for the `bitbucket` join
method, which allows Machine ID bots to join from Bitbucket Pipelines
runs without shared secrets.

Follow up to #48724
github-actions bot pushed a commit that referenced this pull request Nov 23, 2024
This adds guides and other documentation for the `bitbucket` join
method, which allows Machine ID bots to join from Bitbucket Pipelines
runs without shared secrets.

Follow up to #48724
github-merge-queue bot pushed a commit that referenced this pull request Nov 23, 2024
…ng (#48724) (#49335)

* Add `bitbucket` join method for Bitbucket Pipelines joining

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.

* Add unit tests for bitbucket joining

This also fully adds `deployment_environment_uuid` which was found to
be missing.

* Fix imports

* Update tf docs

* Docs update

* Update generated TF resources

* Attempt to work around docs linter

* Add provision token tests

* Remove pipeline_uuid and step_uuid from protos

Also, fix deploment_environment_uuid field name.

* Remove references to removed fields in tests

* Switch to go-oidc/v3 and remove now-redundant nbf check

* Fix go.mod imports for the TF provider

* Fix event-handler go.mod

* Address review feedback; add 15s timeout to fetch provider metadata

* Update lib/bitbucket/token_validator.go



* Fix build after constant rename

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Nov 26, 2024
* Machine ID: Documentation for Bitbucket Pipelines joining

This adds guides and other documentation for the `bitbucket` join
method, which allows Machine ID bots to join from Bitbucket Pipelines
runs without shared secrets.

Follow up to #48724

* Linter appeasement (round 1)

* Add note about braces in UUIDs
github-merge-queue bot pushed a commit that referenced this pull request Nov 27, 2024
… joining (#49337)

* Machine ID: Add `bitbucket` join method for Bitbucket Pipelines joining (#48724)

* Add `bitbucket` join method for Bitbucket Pipelines joining

This adds a new `bitbucket` join method that Machine ID bots can use
to authenticate to Teleport from Bitbucket Pipelines CI runs.

* Add unit tests for bitbucket joining

This also fully adds `deployment_environment_uuid` which was found to
be missing.

* Fix imports

* Update tf docs

* Docs update

* Update generated TF resources

* Attempt to work around docs linter

* Add provision token tests

* Remove pipeline_uuid and step_uuid from protos

Also, fix deploment_environment_uuid field name.

* Remove references to removed fields in tests

* Switch to go-oidc/v3 and remove now-redundant nbf check

* Fix go.mod imports for the TF provider

* Fix event-handler go.mod

* Address review feedback; add 15s timeout to fetch provider metadata

* Update lib/bitbucket/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Fix build after constant rename

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Fix logger for v16

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Dec 2, 2024
* Machine ID: Documentation for Bitbucket Pipelines joining

This adds guides and other documentation for the `bitbucket` join
method, which allows Machine ID bots to join from Bitbucket Pipelines
runs without shared secrets.

Follow up to #48724

* Linter appeasement (round 1)

* Add note about braces in UUIDs

* Adjust steps for v16 without new CLI features

* Linter appeasement

* Remove reference to a specific identity output type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Machine ID: BitBucket Pipelines Delegated Joining
6 participants