SIGHUP Distribution Auth
Overview
SIGHUP Distribution Auth uses CNCF recommended, Cloud Native projects, such as the Dex identity provider, and Pomerium as an identity-aware proxy to enable secure access to internal applications.
Module's repository: https://github.com/sighupio/module-auth
Configuration
You can customize the module using the spec.distribution.modules.auth object in the following way:
baseDomain: the base domain used for all the auth ingresses, if in the nginx dual configuration, it should be the same as the .spec.distribution.modules.ingress.dns.public.name zone.provider.type: the authentication type used for the infrastructure ingresses (all the ingress for the distribution). It can benone(default),basicAuth,sso.provider.basicAuth.usernameandprovider.basicAuth.password: if you specifiedbasicAuthinprovider.type, these two parameter let you customize the credentials to be used.oidcKubernetesAuthobject OnPremisesImmutable: this object creates a Gangplank installation to allow OIDC authentication for the Kubernetes API. It works with all theprovider.typevalues, and it needsbaseDomainand thedexsection. See Configure OIDC authentication.enabled: iftrue, components needed for interacting with the Kubernetes API with OIDC authentication (Gangplank, Dex) be deployed and configured.clientID: the client ID that the Kubernetes API will use to authenticate against the OIDC provider (Dex).clientSecret: the client secret that Gangplank uses to authenticate to Dex.namespace: the namespace to set in the context of the kubeconfig file generated by Gangplank. Defaults todefault.removeCAFromKubeconfig: set to true to remove the CA from the kubeconfig file generated by Gangplank.sessionSecurityKey: the Key to use for the sessions in Gangplank. Must be different between different instances of Gangplank.usernameClaim: the JWT claim to use as the username. This is used in Gangplank's UI. This is combined with the clusterName for the user portion of the kubeconfig. Defaults tonickname.scopes: used to specify the scope of the requested Oauth authorization by Gangplank. Defaults to:["openid", "profile", "email", "offline_access", "groups"]
dexobject: if you specifiedssoinprovider.type, or ifoidcKubernetesAuth.enabledistrue, this object lets you customize some aspects of the Dex installation.expiry.idTokensandexpiry.signingKeys: Dex ID tokens and signing key expiration time duration (default24hand6hrespectively).additionalStaticClients: The additional static clients for dex, here you can find some info about the available options.connectors: The connectors for dex, see here for more info about the available options.
pomeriumobject: if you specifiedssoinprovider.type, this object lets you customize some aspects of the Pomerium installation.-
secrets: this object contains four parameters that need to be filled when using Pomerium:-
COOKIE_SECRET: Cookie Secret is the secret used to encrypt and sign session cookies. To generate a random key, run the following command:head -c32 /dev/urandom | base64 -w0 -
IDP_CLIENT_SECRET: Identity Provider Client Secret is the OAuth 2.0 Secret Identifier. When auth type is SSO, this value will be the secret used to authenticate Pomerium with Dex, use a strong random value. -
SHARED_SECRET: Shared Secret is the base64-encoded, 256-bit key used to mutually authenticate requests between Pomerium services. It's critical that secret keys are random, and stored safely. To generate a key, run the following command:head -c32 /dev/urandom | base64 -w0 -
SIGNING_KEY: Signing Key is the base64 representation of one or more PEM-encoded private keys used to sign a user's attestation JWT, which can be consumed by upstream applications to pass along identifying user information like username, id, and groups.To generate a P-256 (ES256) signing key:
# careful! this will output your private key in base64 in terminalopenssl ecparam -genkey -name prime256v1 -noout | base64 -w0
warningIf you are using the
{file://}interpolation, be careful to not include a newline at the end of the strings, as it will be part of the interpolation and can cause issues. -
-
routes: additional routes configuration for Pomerium. Follows Pomerium's route format.
-
Introduction: Authentication in Kubernetes
Authentication in Kubernetes is a critical component for securing cluster access and ensuring that only authorized users or services can perform specific actions. Kubernetes supports several authentication methods, including service accounts, bearer tokens, certificates, and external identity providers using OpenID Connect (OIDC). For organizations with complex identity requirements, integrating OIDC providers like Dex with advanced access management solutions like Pomerium offers a powerful, flexible approach to authentication and authorization.
OpenID Connect (OIDC)
OIDC is an identity layer built on top of the OAuth 2.0 protocol. It provides a secure and standardized way for users and services to authenticate using an identity provider (IdP). Kubernetes' support for OIDC enables seamless integration with external IdPs, making it easier to manage user identities and roles across multiple clusters. This method allows organizations to unify authentication across their tech stack, leveraging providers like Google, GitHub, or self-hosted solutions like Dex.
SD: Authentication Module
The Authentication module provided by SD is a comprehensive solution to protect applications inside the cluster with a number of options for different scenarios.
The module includes:
- Pomerium to enable secure access to internal applications without requiring application changes.
- Dex, an identity service that uses OpenID Connect to drive authentication for other apps.
- Gangplank to easily enable authentication flows via OIDC for a Kubernetes cluster.
If you don't want to use OIDC flows, you can also choose to have HTTP Basic Auth instead, which will add a user and password basic authentication to every Ingress provided by SD.
This module can be configured in a number of different ways (see the reference for OnPremises, Immutable, EKSCluster or KFDDistribution):
- Disabled
- HTTP Basic Auth for all SD Ingress resources
- SSO with Pomerium + Dex for all SD Ingress resources
- OIDC authentication for Kubernetes APIs using Gangplank + Dex OnPremisesImmutable
Note that the HTTP Basic Auth and the Disabled options still let you configure OIDC authentication for Kubernetes (if you are installing SD using the OnPremises or the Immutable provider). In this case the module deploys only Dex and Gangplank, for the login to the Kubernetes API. Pomerium is not deployed: it protects only the SD Ingresses, and only with the SSO option.
Pomerium
Pomerium is a modern, open-source identity-aware access proxy that extends the capabilities of OIDC by providing fine-grained access control, zero trust security, and simplified single sign-on (SSO) configurations. By acting as an intermediary between users and applications, Pomerium centralizes authentication while offering robust features like:
- Policy-Based Access Control: Define access rules based on user identity, group membership, or custom claims.
- Dynamic Access Management: Adapt policies to changing organizational needs without downtime.
If you choose sso as provider type inside your cluster configuration, Pomerium will protect all Ingresses provided by the distribution by default. You can also specify custom routes and policies, see more in Pomerium's docs.
Dex
Dex is an open-source OIDC identity provider designed to connect to various authentication backends, such as LDAP, Active Directory, SAML, and social login providers like Google or GitHub. It acts as a bridge between these identity sources and applications that require OIDC authentication. In a Kubernetes context, Dex simplifies authentication by enabling Kubernetes to leverage centralized identity management systems without directly integrating them into the cluster.
Dex generates OIDC tokens upon successful authentication, which Kubernetes can validate to authenticate users and determine their roles. Its modular architecture makes it highly extensible and adaptable to various deployment scenarios. By combining Dex with Pomerium, organizations can integrate their existing identity solutions into Kubernetes while benefiting from advanced access management. This approach ensures secure, scalable, and user-friendly authentication workflows for applications hosted inside Kubernetes clusters.
You can customize the Dex configuration inside your cluster to use any number of connectors and additional static clients, see more in Dex's docs.
Gangplank
Kubernetes supports OpenID Connect Tokens as a way to identify users who access the cluster.
Ganplank is an open-source application maintained by SIGHUP that provides an easy way to integrate OIDC authentication for Kubernetes APIs. Using Gangplank, you authenticate on its UI with your OIDC provider and it provides you a kubeconfig file that will be tied to your user. This way, you can also specify the permissions to be granted to each user by using standard Kubernetes RBAC.
Monitoring
SD Auth module integrates out-of-the-box with SD's Monitoring module, providing metrics and dashboards to visualize the status of its components.
In particular:
- Dex exposes standard Go adapter metrics, the metrics are automatically scrapped by Prometheus when using SD Monitoring module but there are no Grafana dashboards nor alerts defined.
- Pomerium exposes several metrics about Pomerium itself and its underlying envoy proxy. Metrics are scrapped automatically by Prometheus and 2 Grafana dashboards are available with the
pomeriumtag when using SD Monitoring module. Here are some screenshots: