padlok

command module
v0.0.0-...-d288bae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

padlok

padlok is a Kubernetes webhook token authentication service that builds on the foundation laid by the Structured Authentication Configuration feature, extending it for enterprise environments.

What does padlok add?

  • Claims Resolution — Resolve claims from sources beyond what is present in the token itself, enabling richer identity mapping configurations for enterprise environments.

How It Works

padlok implements the webhook token authentication protocol, making it a drop-in replacement for Structured Authentication Configuration. No changes are needed on the Kubernetes side beyond pointing to padlok as the webhook authenticator.

The following highlights how a request to the Kubernetes API server goes through authentication when padlok is configured:

  1. The Kubernetes API server receives a request with a bearer token and sends a TokenReview to padlok's /authenticate endpoint.
  2. padlok validates the JWT against the configured OIDC issuer.
  3. If configured, additional claims are resolved from external sources (e.g., a UserInfo endpoint or Microsoft Graph API).
  4. Token and external claims are mapped to a Kubernetes identity (username, groups, uid, extra) using CEL expressions.
  5. The authenticated identity is returned to the API server.

Configuration

padlok is configured with an AuthenticationConfiguration resource that defines how tokens should be validated and mapped to Kubernetes identities. The configuration file is specified at startup via the --config flag and is automatically reloaded when changes are detected.

padlok's AuthenticationConfiguration type mirrors the Kubernetes AuthenticationConfiguration type, extending it with additional fields like externalClaimsSources. If you already have a Structured Authentication Configuration, you can use it as a starting point — update the apiVersion to padlok.everettraven.github.io/v1alpha1 and add any extensions you need.

A minimal configuration that authenticates tokens from an OIDC provider:

apiVersion: padlok.everettraven.github.io/v1alpha1
kind: AuthenticationConfiguration
jwt:
  - issuer:
      url: https://idp.example.com
      audiences:
        - my-k8s-cluster
    claimMappings:
      username:
        claim: "sub"
        prefix: ""

To resolve claims from an external source, add an externalClaimsSources entry. The following example fetches group membership from the OIDC provider's UserInfo endpoint when the token does not already contain a groups claim:

apiVersion: padlok.everettraven.github.io/v1alpha1
kind: AuthenticationConfiguration
jwt:
  - issuer:
      url: https://idp.example.com
      audiences:
        - my-k8s-cluster
    claimMappings:
      username:
        claim: "sub"
        prefix: ""
      groups:
        expression: "claims.groups.split(',')"
    externalClaimsSources:
      - authentication:
          type: RequestProvidedToken
        url:
          hostname: idp.example.com
          pathExpression: "['protocol', 'openid-connect', 'userinfo']"
        mappings:
          - name: groups
            expression: "response.body.groups.join(',')"
        conditions:
          - expression: "!has(claims.groups)"

Getting Started

Documentation on the padlok project can be found under docs.

Contributing

Contributions are welcome! See CONTRIBUTING.md for development setup, conventions, and contribution workflow.

License

padlok is licensed under the Apache License 2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/authentication
+groupName=padlok.everettraven.github.io Package authentication is the internal version of the API.
+groupName=padlok.everettraven.github.io Package authentication is the internal version of the API.
apis/authentication/v1alpha1
+groupName=padlok.everettraven.github.io Package v1alpha1 is the v1alpha1 version of the API.
+groupName=padlok.everettraven.github.io Package v1alpha1 is the v1alpha1 version of the API.
cmd
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/manifest
Package manifest provides shared utilities for loading admission configurations from static manifest files.
Package manifest provides shared utilities for loading admission configurations from static manifest files.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/manifest/metrics
Package metrics provides metrics for manifest-based admission configuration.
Package metrics provides metrics for manifest-based admission configuration.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig
Package policyconfig defines the configuration for the validating and mutating admission policy plugins.
Package policyconfig defines the configuration for the validating and mutating admission policy plugins.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/install
Package install installs the policyconfig API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the policyconfig API group, making it available as an option to all of the API encoding/decoding machinery.
Package v1 is the v1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/policy/internal/generic
Package generic contains a typed wrapper over cache SharedIndexInformer and Lister (maybe eventually should have a home there?)
Package generic contains a typed wrapper over cache SharedIndexInformer and Lister (maybe eventually should have a home there?)
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/policy/manifest/loader
Package loader provides generic functionality to load policy and binding configurations from manifest files.
Package loader provides generic functionality to load policy and binding configurations from manifest files.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/policy/manifest/source
Package source provides a Source implementation that loads policy configurations from manifest files.
Package source provides a Source implementation that loads policy configurations from manifest files.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/resourcequota
Package resourcequota enforces all incoming requests against any applied quota in the namespace context of the request
Package resourcequota enforces all incoming requests against any applied quota in the namespace context of the request
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/resourcequota/apis/resourcequota/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package v1 is the v1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
Package v1beta1 is the v1beta1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package v1 is the v1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/errors
Package errors contains utilities for admission webhook specific errors
Package errors contains utilities for admission webhook specific errors
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/manifest/loader
Package loader provides generic functionality to load webhook configurations from manifest files.
Package loader provides generic functionality to load webhook configurations from manifest files.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/manifest/source
Package source provides a Source implementation that loads webhook configurations from manifest files.
Package source provides a Source implementation that loads webhook configurations from manifest files.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/mutating
Package mutating delegates admission checks to dynamically configured mutating webhooks.
Package mutating delegates admission checks to dynamically configured mutating webhooks.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/predicates/namespace
Package namespace defines the utilities that are used by the webhook plugin to decide if a webhook should be applied to an object based on its namespace.
Package namespace defines the utilities that are used by the webhook plugin to decide if a webhook should be applied to an object based on its namespace.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/predicates/object
Package object defines the utilities that are used by the webhook plugin to decide if a webhook should run, as long as either the old object or the new object has labels matching the webhook config's objectSelector.
Package object defines the utilities that are used by the webhook plugin to decide if a webhook should run, as long as either the old object or the new object has labels matching the webhook config's objectSelector.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/request
Package request creates admissionReview request based on admission attributes.
Package request creates admissionReview request based on admission attributes.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/testcerts
Package testcerts contains generated key pairs used by the unit tests of mutating and validating webhooks.
Package testcerts contains generated key pairs used by the unit tests of mutating and validating webhooks.
internal/third_party/kubernetes/apiserver/pkg/admission/plugin/webhook/validating
Package validating makes calls to validating (i.e., non-mutating) webhooks during the admission process.
Package validating makes calls to validating (i.e., non-mutating) webhooks during the admission process.
internal/third_party/kubernetes/apiserver/pkg/apis/apidiscovery/v2
Once the v2beta1 types are removed (intended for Kubernetes v1.33), this file will be removed.
Once the v2beta1 types are removed (intended for Kubernetes v1.33), this file will be removed.
internal/third_party/kubernetes/apiserver/pkg/apis/apiserver
Package apiserver is the internal version of the API.
Package apiserver is the internal version of the API.
internal/third_party/kubernetes/apiserver/pkg/apis/apiserver/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/apis/apiserver/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/apis/apiserver/v1beta1
Package v1beta1 is the v1beta1 version of the API.
Package v1beta1 is the v1beta1 version of the API.
internal/third_party/kubernetes/apiserver/pkg/apis/apiserver/validation
Package validation validates EncryptionConfiguration.
Package validation validates EncryptionConfiguration.
internal/third_party/kubernetes/apiserver/pkg/apis/audit/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
internal/third_party/kubernetes/apiserver/pkg/apis/example
package example contains an example API used to demonstrate how to create api groups.
package example contains an example API used to demonstrate how to create api groups.
internal/third_party/kubernetes/apiserver/pkg/apis/example/install
Package install installs the example API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the example API group, making it available as an option to all of the API encoding/decoding machinery.
internal/third_party/kubernetes/apiserver/pkg/apis/example2
+k8s:deepcopy-gen=package +groupName=example2.k8s.io
+k8s:deepcopy-gen=package +groupName=example2.k8s.io
internal/third_party/kubernetes/apiserver/pkg/apis/example2/install
Package install installs the example2 API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the example2 API group, making it available as an option to all of the API encoding/decoding machinery.
internal/third_party/kubernetes/apiserver/pkg/audit
TODO: Delete this file if we generate a clientset.
TODO: Delete this file if we generate a clientset.
internal/third_party/kubernetes/apiserver/pkg/authentication/cel
Package cel contains the CEL related interfaces and structs for authentication.
Package cel contains the CEL related interfaces and structs for authentication.
internal/third_party/kubernetes/apiserver/pkg/authentication/request/x509
Package x509 provides a request authenticator that validates and extracts user information from client certificates
Package x509 provides a request authenticator that validates and extracts user information from client certificates
internal/third_party/kubernetes/apiserver/pkg/authentication/user
Package user contains utilities for dealing with simple user exchange in the auth packages.
Package user contains utilities for dealing with simple user exchange in the auth packages.
internal/third_party/kubernetes/apiserver/pkg/authorization/path
Package path contains an authorizer that allows certain paths and path prefixes.
Package path contains an authorizer that allows certain paths and path prefixes.
internal/third_party/kubernetes/apiserver/pkg/authorization/union
Package union implements an authorizer that combines multiple subauthorizer.
Package union implements an authorizer that combines multiple subauthorizer.
internal/third_party/kubernetes/apiserver/pkg/endpoints
Package endpoints contains the generic code that provides a RESTful Kubernetes-style API service.
Package endpoints contains the generic code that provides a RESTful Kubernetes-style API service.
internal/third_party/kubernetes/apiserver/pkg/endpoints/filters
Package filters contains all the http handler chain filters which _are_ api related, i.e.
Package filters contains all the http handler chain filters which _are_ api related, i.e.
internal/third_party/kubernetes/apiserver/pkg/endpoints/handlers
Package handlers contains HTTP handlers to implement the apiserver APIs.
Package handlers contains HTTP handlers to implement the apiserver APIs.
internal/third_party/kubernetes/apiserver/pkg/endpoints/handlers/negotiation
Package negotiation contains media type negotiation logic.
Package negotiation contains media type negotiation logic.
internal/third_party/kubernetes/apiserver/pkg/endpoints/handlers/responsewriters
Package responsewriters containers helpers to write responses in HTTP handlers.
Package responsewriters containers helpers to write responses in HTTP handlers.
internal/third_party/kubernetes/apiserver/pkg/endpoints/request
Package request contains everything around extracting info from a http request object.
Package request contains everything around extracting info from a http request object.
internal/third_party/kubernetes/apiserver/pkg/registry
Package registry contains the generic implementation of the storage and system logic.
Package registry contains the generic implementation of the storage and system logic.
internal/third_party/kubernetes/apiserver/pkg/registry/generic
Package generic provides a generic object store interface and a generic label/field matching type.
Package generic provides a generic object store interface and a generic label/field matching type.
internal/third_party/kubernetes/apiserver/pkg/registry/generic/registry
Package etcd has a generic implementation of a registry that stores things in etcd.
Package etcd has a generic implementation of a registry that stores things in etcd.
internal/third_party/kubernetes/apiserver/pkg/registry/generic/rest
Package rest has generic implementations of resources used for REST responses
Package rest has generic implementations of resources used for REST responses
internal/third_party/kubernetes/apiserver/pkg/registry/rest
Package rest defines common logic around changes to Kubernetes-style resources.
Package rest defines common logic around changes to Kubernetes-style resources.
internal/third_party/kubernetes/apiserver/pkg/server
Package server contains the plumbing to create kubernetes-like API server command.
Package server contains the plumbing to create kubernetes-like API server command.
internal/third_party/kubernetes/apiserver/pkg/server/filters
Package filters contains all the http handler chain filters which are not api related.
Package filters contains all the http handler chain filters which are not api related.
internal/third_party/kubernetes/apiserver/pkg/server/flagz/api/v1alpha1
Package v1alpha1 contains API Schema definitions for the flagz v1alpha1 API group
Package v1alpha1 contains API Schema definitions for the flagz v1alpha1 API group
internal/third_party/kubernetes/apiserver/pkg/server/flagz/api/v1beta1
Package v1beta1 contains API Schema definitions for the flagz v1beta1 API group
Package v1beta1 contains API Schema definitions for the flagz v1beta1 API group
internal/third_party/kubernetes/apiserver/pkg/server/healthz
Package healthz implements basic http server health checking.
Package healthz implements basic http server health checking.
internal/third_party/kubernetes/apiserver/pkg/server/httplog
Package httplog contains a helper object and functions to maintain a log along with an http response.
Package httplog contains a helper object and functions to maintain a log along with an http response.
internal/third_party/kubernetes/apiserver/pkg/server/mux
Package mux contains abstractions for http multiplexing of APIs.
Package mux contains abstractions for http multiplexing of APIs.
internal/third_party/kubernetes/apiserver/pkg/server/options
package options is the public flags and options used by a generic api server.
package options is the public flags and options used by a generic api server.
internal/third_party/kubernetes/apiserver/pkg/server/resourceconfig
Package resourceconfig contains the resource config related helper functions.
Package resourceconfig contains the resource config related helper functions.
internal/third_party/kubernetes/apiserver/pkg/server/routes
Package routes holds a collection of optional genericapiserver http handlers.
Package routes holds a collection of optional genericapiserver http handlers.
internal/third_party/kubernetes/apiserver/pkg/server/statusz/api/v1alpha1
Package v1alpha1 contains API Schema definitions for the statusz v1alpha1 API group
Package v1alpha1 contains API Schema definitions for the statusz v1alpha1 API group
internal/third_party/kubernetes/apiserver/pkg/server/statusz/api/v1beta1
Package v1beta1 contains API Schema definitions for the statusz v1beta1 API group
Package v1beta1 contains API Schema definitions for the statusz v1beta1 API group
internal/third_party/kubernetes/apiserver/pkg/server/storage
Package storage contains the plumbing to setup the etcd storage of the apiserver.
Package storage contains the plumbing to setup the etcd storage of the apiserver.
internal/third_party/kubernetes/apiserver/pkg/storage
Interfaces for database-related operations.
Interfaces for database-related operations.
internal/third_party/kubernetes/apiserver/pkg/storage/errors
Package storage provides conversion of storage errors to API errors.
Package storage provides conversion of storage errors to API errors.
internal/third_party/kubernetes/apiserver/pkg/storage/value
Package value contains methods for assisting with transformation of values in storage.
Package value contains methods for assisting with transformation of values in storage.
internal/third_party/kubernetes/apiserver/pkg/storage/value/encrypt/aes
Package aes transforms values for storage at rest using AES-GCM.
Package aes transforms values for storage at rest using AES-GCM.
internal/third_party/kubernetes/apiserver/pkg/storage/value/encrypt/envelope
Package envelope transforms values for storage at rest using a Envelope provider
Package envelope transforms values for storage at rest using a Envelope provider
internal/third_party/kubernetes/apiserver/pkg/storage/value/encrypt/envelope/kmsv2
Package kmsv2 transforms values for storage at rest using a Envelope v2 provider
Package kmsv2 transforms values for storage at rest using a Envelope v2 provider
internal/third_party/kubernetes/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2
Package v2 contains definition of kms-plugin's serialized types.
Package v2 contains definition of kms-plugin's serialized types.
internal/third_party/kubernetes/apiserver/pkg/storage/value/encrypt/secretbox
Package secretbox transforms values for storage at rest using XSalsa20 and Poly1305.
Package secretbox transforms values for storage at rest using XSalsa20 and Poly1305.
internal/third_party/kubernetes/apiserver/pkg/util/flowcontrol/fairqueuing/queueset
Package queueset implements a technique called "fair queuing for server requests".
Package queueset implements a technique called "fair queuing for server requests".
internal/third_party/kubernetes/apiserver/pkg/util/flushwriter
Package flushwriter implements a wrapper for a writer that flushes on every write if that writer implements the io.Flusher interface
Package flushwriter implements a wrapper for a writer that flushes on every write if that writer implements the io.Flusher interface
internal/third_party/kubernetes/apiserver/pkg/util/proxy
Among other files, this directory contains functionality for two stream proxies: streamtranslator.go and streamtunnel.go.
Among other files, this directory contains functionality for two stream proxies: streamtranslator.go and streamtunnel.go.
internal/third_party/kubernetes/apiserver/pkg/util/webhook
Package webhook implements a generic HTTP webhook plugin.
Package webhook implements a generic HTTP webhook plugin.
internal/third_party/kubernetes/apiserver/plugin/pkg/audit
Package audit contains implementations for pkg/audit/AuditBackend interface
Package audit contains implementations for pkg/audit/AuditBackend interface
internal/third_party/kubernetes/apiserver/plugin/pkg/audit/buffered
Package buffered provides an implementation for the audit.Backend interface that batches incoming audit events and sends batches to the delegate audit.Backend.
Package buffered provides an implementation for the audit.Backend interface that batches incoming audit events and sends batches to the delegate audit.Backend.
internal/third_party/kubernetes/apiserver/plugin/pkg/audit/fake
Package fake provides a fake audit.Backend interface implementation for testing.
Package fake provides a fake audit.Backend interface implementation for testing.
internal/third_party/kubernetes/apiserver/plugin/pkg/audit/truncate
Package truncate provides an implementation for the audit.Backend interface that truncates audit events and sends them to the delegate audit.Backend.
Package truncate provides an implementation for the audit.Backend interface that truncates audit events and sends them to the delegate audit.Backend.
internal/third_party/kubernetes/apiserver/plugin/pkg/audit/webhook
Package webhook implements the audit.Backend interface using HTTP webhooks.
Package webhook implements the audit.Backend interface using HTTP webhooks.
internal/third_party/kubernetes/apiserver/plugin/pkg/authenticator
Package authenticator contains implementations for pkg/auth/authenticator interfaces
Package authenticator contains implementations for pkg/auth/authenticator interfaces
internal/third_party/kubernetes/apiserver/plugin/pkg/authenticator/token/oidc
oidc implements the authenticator.Token interface using the OpenID Connect protocol.
oidc implements the authenticator.Token interface using the OpenID Connect protocol.
internal/third_party/kubernetes/apiserver/plugin/pkg/authenticator/token/webhook
Package webhook implements the authenticator.Token interface using HTTP webhooks.
Package webhook implements the authenticator.Token interface using HTTP webhooks.
internal/third_party/kubernetes/apiserver/plugin/pkg/authorizer/webhook
Package webhook implements the authorizer.Authorizer interface using HTTP webhooks.
Package webhook implements the authorizer.Authorizer interface using HTTP webhooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL