A Kubernetes operator that enables just-in-time access requests for RBAC, integrated with Jira
981
https://github.com/samirtahir91/jira-jit-rbac-operator?tab=readme-ov-file
The jira-jit-rbac-operator is a Kubernetes operator that creates short-lived rolebindings for users based on a JitRequest custom resource. It integrates with a configurable Jira Workflow, the operator submitts a Jira ticket in a Jira Project for approval by a Human before granting the role-binding for the requested time period. It empowers self-service of Just-In-Time privileged access using Kubernetes RBAC.
JitRequest, where a user creates a JitReuest with:
customFields)allowedClusterRoles list defined in a JustInTimeConfig custom resource (set by admins/operators) and then pre-approves the request.JitRequest spec.JitRequest object for the defined startTime and checks the Jira Ticket for approval statusJitRequest if the Jira Ticket is not approved.JitRequests and child objects (RoleBindings) at scheduled endTime.kubectl -n jira-jit-rbac-operator-system create secret generic \
jira-credentials \
--from-literal=api-token=<PERSONAL ACCESS TOKEN>
The operator is configurable for a Jira project and Workflow using the JustInTimeConfig custom resource sample
You will need to create the required custom fields in Jira to be used by the workflow and map them to the JustInTimeConfig, i.e.:
| Custom Field | Type |
|---|---|
| Cluster Role | Single select |
| Start Time | Date and time |
| End Time | Date and time |
The sample workflow used is here, you need to import/create an identical Workflow in your Jira Project (the IDs of fields etc are configurable as below).
You must define these with the values according to your Jira Project and Workflow (to map the fields from your workflow to the opertor's config):
| Field | Description |
|---|---|
workflowApprovedStatus | The status indicating that the workflow has been approved in the Jira workflow. |
rejectedTransitionID | The ID of the transition used when a workflow is rejected. |
jiraProject | The Jira project associated with the request. |
jiraIssueType | The type of Jira issue to be created. |
completedTransitionID | The ID of the transition used when a workflow is completed. |
requiredFields | The type and id of the required fields in Jira. |
customFields | The type and id of the required fields in Jira for custom fields that need to |
| be validated against the JiraFields in the request. |
The customFields are completely configurable to what fields you want a user to define a value for in a JitRequest
Each custom field is sent in the payload to Jira on creation of a new issue.
This allows you to use whatever fields as per your workflow.
Detail:
type and jiraCustomFieldJitRequest.Spec.JiraFieldsProductOwner as a custom field, then all users will need to define JiraFields.ProductOwner in my JitRequest| Custom Field | Type |
|---|---|
| Reporter | Text |
| ProductOwner | User Select |
| Justification | Text multiline |
DEBUG_LOG to true in the manager deployment environment variable for debug level logs.kubectl get jitreq:
JitRequestsJitRequestJitRequest ResourceHere is an example of how to define the JitRequest resource:
apiVersion: justintime.samir.io/v1
kind: JitRequest
metadata:
name: jitrequest-sample
spec:
userEmail: [email protected]
additionalEmails:
- "[email protected]"
- "[email protected]"
namespaces:
- foo
- bar
namespaceLabels:
foo: bar
startTime: 2025-01-18T11:48:10Z
endTime: 2025-01-18T11:51:10Z
clusterRole: edit
jiraFields:
Approver: admin
ProductOwner: admin
Justification: "need a jit now pls"
Above the jiraFields are mapped to the customFields in the JustInTimeConfig:
apiVersion: justintime.samir.io/v1
kind: JustInTimeConfig
metadata:
name: jira-jit-rbac-operator-default
spec:
allowedClusterRoles:
- admin
- edit
labels:
- minikube-test
namespaceAllowedRegex: ".*"
environment:
environment: local
cluster: minikube
additionalCommentText: "cluster: minikube"
workflowApprovedStatus: "Approved"
rejectedTransitionID: "21"
jiraProject: IAM
jiraIssueType: Access Request
completedTransitionID: "41"
requiredFields:
ClusterRole:
type: "select"
jiraCustomField: "customfield_10115"
StartTime:
type: "date"
jiraCustomField: "customfield_10200"
EndTime:
type: "date"
jiraCustomField: "customfield_10201"
customFields:
Approver:
type: "user"
jiraCustomField: "customfield_10112"
ProductOwner:
type: "user"
jiraCustomField: "customfield_10113"
Justification:
type: "text"
jiraCustomField: "customfield_10114"
Content type
Image
Digest
sha256:baf73d1f0…
Size
32.2 MB
Last updated
over 1 year ago
docker pull samirtahir91076/jira-jit-rbac-operator