Skip to content

Repository files navigation

teleport-plugin-slack-access-request

License MADE BY Go Version



πŸ“ Table of Contents


What is This?

teleport-plugin-slack-access-request is
Go-based Teleport plugin server developed by teletwoboy.

It provides convenient Slack-based features
integrated with the open-source version of Teleport.

Find us also at Dockerhub


Why Use This Plugin?

  • We have two powerful features.
  1. /access-request

    • Neither the requester nor the reviewer needs to log in to the Teleport Web UI.
      They only need to be connected to Slack.

    • All request and review records are stored in the plugin server's database, Slack messages, and Teleport Server, making it easy to track and audit the history.

    • Only users in the Slack channel mapped to the requested role can review the request. This enables clear management of reviewers for each role.

  2. /access-policy : ABAC-based Access Request Auto-Review Policy

    • Reviewers can create auto-review policies for requests that do not require manual review every time.

    • Policies can be configured based on specific channels, roles, users, time windows, and whether to automatically approve or deny the request.


Installation with ArgoCD

teletwoboy aims for GitOps-based infrastructure management.

Prerequisites Before Installation

  • Kubernetes
  • ArgoCD
  • Teleport OpenSource Cluster and Teleport Operator in k8s
  • Permission to create Teleport roles, users, tbot
  • Permission to create Slack App, Channel etc
  • Two Slack users (If testing alone, you will act as both the Requester and the Reviewer)
  • A domain name for the slack-plugin server
1️⃣ Setting up Teleport Tbot
  • Define the role that the Teleport Bot will impersonate
    apiVersion: resources.teleport.dev/v1
    kind: TeleportRoleV7
    metadata:
      name: access-plugin
      namespace: teleport
    spec:
      allow:
        rules:
          - resources:
              - access_request
            verbs:
              - list
              - read
              - update
              - submit
              - create
          - resources:
              - access_plugin_data
            verbs:
              - update
          - resources:
              - user
            verbs:
              - read
              - list
          - resources:
              - role
            verbs:
              - read
              - list
          - resources:
              - event
            verbs:
              - list
              - read
          - resources:
              - user_login_state
            verbs:
              - list
              - read
              - delete
    
    • These rules define the minimum required permissions for the Tbot

  • Create Tbot via CLI
    kubectl exec -it -n teleport deploy/teleport-auth -- \
      tctl bots add access-plugin --roles=access-plugin
    

  • Copy the bot token value

    스크란샷 2025-08-08 α„‹α…©α„Œα…₯ᆫ 1 38 27

  • Deploy Tbot Server
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: teleport-tbot
      namespace: argocd
    spec:
      project: <Project Name>
      destination:
        server: https://kubernetes.default.svc
        namespace: <Namespace to deploy>
      source:
        repoURL: https://charts.releases.teleport.dev
        targetRevision: <Same version as the Teleport Cluster server>
        chart: tbot
        helm:
          values: |-
            clusterName: <clusterName used during Teleport Cluster deployment>
            teleportAuthAddress: <Auth Server Service Name>.<Namespace>.svc.cluster.local:3025
    
            defaultOutput:
              enabled: false
    
            persistence: "secret"
            joinMethod: "token"
            token: <The bot token>
    
            outputs:
              - type: identity
                destination:
                  type: kubernetes_secret
                  name: <Name of the Kubernetes Secret to be created>
                roles:
                  - access-plugin
    
            tbotConfig:
              credential_ttl: "10h"
              renewal_interval: "20m"
    

  • Check if the Secret Has Been Created

    kubectl get secrets -n teleport
    kubectl describe secret <created Secret> -n teleport
    
    image
    • The identity Data field must be populated for it to be considered valid
    • If it doesn't work as expected, please check the tbot pod logs
2️⃣ Creating Teleport User
  • Define the Role to be obtained through an Access Request
    apiVersion: resources.teleport.dev/v1
    kind: TeleportRoleV7
    metadata:
      name: dev-role
      namespace: teleport
    spec:
      allow:
        kubernetes_labels:
          "*": "*"
        kubernetes_groups:
          - "<Role the user will assume in Kubernetes>"
          # This is related to Kubernetes RBAC.
          # Please configure it manually.
      options:
        max_session_ttl: 30m
    

  • Define the Role that is allowed to request an Access Request for the target Role
    apiVersion: resources.teleport.dev/v1
    kind: TeleportRoleV7
    metadata:
      name: dev-role-requester
      namespace: teleport
    spec:
      allow:
        request:
          roles:
            - dev-role
          reason:
            mode: "optional" or "required"
            # This determines whether providing an Access Request reason is optional or required
      options:
        max_session_ttl: 1h
    

  • Define the User who is allowed to request the specified Role
    apiVersion: resources.teleport.dev/v2
    kind: TeleportUser
    metadata:
      name: <requester slack user email username>
      namespace: teleport
    spec:
      roles:
        - dev-role-requester
      traits:
        logins:
          - root
          - ubuntu
    
3️⃣ Setting up Slack App
  • Add a Slack App

    • Go to api.slack.com/apps

    • Click the Create New App button

      Image
    • Select From scratch

      Image
    • Enter an App Name, select the Workspace, and click Create App

      image
    • After creation, you’ll be redirected to the App Information page:

      • Under Basic Information, copy and securely store the Signing Secret

        image
      • In the left sidebar, click OAuth & Permissions, scroll down to the Bot Token Scopes section, and add the following permissions:

        image
        • channels:read
        • chat:write
        • commands
        • groups:read
        • pins:write
        • users.profile:read
        • users:read
        • users:read.email
      • Scroll up and click the Install to <Workspace> button to add the app to your workspace

        스크란샷 2025-08-08 α„‹α…©α„Œα…₯ᆫ 12 14 18
      • After installation, copy and securely store the Bot User OAuth Token

        스크란샷 2025-08-08 α„‹α…©α„Œα…₯ᆫ 12 57 59

  • Add Slash Commands

    • In the left sidebar, click Slash Commands, then click the Create New Command button

      image
    • Fill in the required fields and click the Save button:

      • Command : The command users will type in Slack chat

        • /access-request
        • /access-policy
      • Request URL : The endpoint that Slack will send requests to when the command is used

        • https://<your-plugin-domain>/api/v1/access-request
        • https://<your-plugin-domain>/api/v1/access-policy
      • Short Description : A brief description of the command


  • Enable Slack Interactivity

    • In the left sidebar, click Interactivity & Shortcuts

    • Toggle the switch from Off to On

      image
    • In the Request URL field, enter the following and click Save Changes button:

      • https://<your-plugin-domain>/api/v1/interaction
4️⃣ Setting up Slack Channel
  • Create Slack Channels

    1. Plugin server notification channel (used for general alerts)
    1. dev-role-requester # Optional, but you must add the app to at least one channel
    2. dev-role-reviewers
       # ‼️ Must follow the format: <Role Name + '-reviewers'> ‼️
       # Please make the Reviewers channel private so that the requester cannot access it.
    

  • Add your Slack app to each of the above channels
    /invite @<Your App Name>
    

  • Add reviewers to the dev-role-reviewers channel
    /invite @<Reviewer>
    

  • Copy and store the Channel ID of the plugin server's notification channel

    • Select the channel in Slack
    • Click the # Channel Name at the top of the message view
    • Scroll down and copy the Channel ID
5️⃣ Installing the Plugin Server
  • Write the application.yaml for ArgoCD

    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: teleport-plugin-slack-access-request
      namespace: argocd
    spec:
      project: <Project Name>
      destination:
        server: https://kubernetes.default.svc
        namespace: <Namespace to deploy>
      source:
        repoURL: https://github.com/teletwoboy/teleport-plugin-slack-access-request-helm.git
        targetRevision: 0.1.0
        path: .
        helm:
          values: |-
            server:
              port: <Server Container Port>
              secret:
                slackToken: <Copied Bot User OAuth Token>
                slackSigningSecret: <Copied Signing Secret>
                slackDefaultNotifChannelID: <Copied notification channel ID>
                teleportAddress: <Teleport Cluster Server Address>
              
              teleport:
                identity:
                  secretName: <Tbot Secret generated by the Tbot Server>
    
            postgres:
              auth:
                username: <Username to be created>
                password: <Password for the user>
                database: <Database name>
    

    If you want to pass sensitive information via Kubernetes Secrets,
    configure ingress settings directly in values.yaml,
    or explore other configuration options,
    please refer to the Chart's Values.yaml file

  • Note: Ingress setup is not covered in this guide.


How to use

Access Request
  • Requester

    • type /access-request

      image
    • Select Requeted Role and Reviewers Channel

      image
    • Select Start Date

      Image
    • Select Access Duration

      Image
    • Select Request TTL

      Image
    • Review the summary, fill in the request reason, and click the Submit button

      Image
    • Check the request creation message in the channel

      Image

  • Reviewer (in the Reviewers Channel)

    • See the Access Request notification and click Review Request button

      Image
    • Fill in the review reason and select Allow or Deny

      Image
    • Check the review result message in the channel

      Image

  • Requester

    • Check if the request has been reviewed

      1. APPROVED

        Image
      2. DENIED

        Image
Access Policy
  • Reviewer in Reviewers Channel

    • type /access-policy

      image
    • Select the target channel, role, and user

      image
    • Choose the start date/time, end date/time, and effect (Allow or Deny)

      image
    • Review the summary, write a title and reason, then click Submit button

      image
    • Check the created Access Policy Message in the channel

      image
      • The policy is automatically pinned for easier management.

  • Requester

    • Perform the /access-request process as usual

    • Check that the request was automatically reviewed

      1. APPROVED

        image
      2. DENIED

        image

  • Reviewer in Reviewers Channel

    • Check the information for the request that was auto-reviewed

      image

How to Contribute

This project was created by university student developers.
If you find any mistakes,
have ideas for new features,
or suggestions for improvements,
we welcome your contributions!


Directory Structure

.
β”œβ”€β”€ db                # Database schema and migration files
β”œβ”€β”€ cmd               # Application entry points (main executables)
β”œβ”€β”€ internal          # Internal application packages (not for public use)
β”‚   β”œβ”€β”€ api           # API route handlers and related logic
β”‚   β”œβ”€β”€ app           # Application startup and lifecycle management
β”‚   β”œβ”€β”€ config        # Configuration loading and management
β”‚   β”œβ”€β”€ database      # Database connection and query logic
β”‚   β”œβ”€β”€ events        # Teleport Event handling and dispatching
β”‚   β”œβ”€β”€ logging       # Logging utilities and setup
β”‚   β”œβ”€β”€ policy        # Access policy logic and enforcement
β”‚   β”œβ”€β”€ seedinit      # Initial data seeding scripts
β”‚   β”œβ”€β”€ slack         # Slack integration logic
β”‚   β”œβ”€β”€ teleport      # Teleport integration logic
β”‚   β”œβ”€β”€ user          # User management and related logic
β”‚   └── util          # Utility/helper functions

License

This project is licensed under the Apache License 2.0.


Acknowledgements

  • 🦫 Go Gopher image by Renee French, licensed under CC BY 3.0.
  • πŸ’œ Teleport and 🟒 Slack logos are trademarks of their respective owners.
  • This project is an unofficial open-source plugin extending Teleport Community Edition with Slack integration.

Reference

Teleport Github Repository
Teleport Official Website
Slack API methods


πŸ” Back to Top

About

Go Third-Party Server for access request via slack on teleport OSS

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages