Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

58 Commits

Repository files navigation

GLAuth Helm Chart

GLAuth is a lightweight LDAP server for development, home use, or CI.

This Helm chart allows you to deploy GLAuth in a Kubernetes cluster with your backend of choice, either as internal cluster infrastructure (e.g., mated to Keycloak in an OIDC environment) or exposed outside your cluster as a high availability authentication server.

TL;DR

helm repo add glauth https://nnstd.github.io/helm-glauth
helm install my-glauth glauth/glauth

Introduction

This chart bootstraps a GLAuth deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.2.0+
  • PV provisioner support in the underlying infrastructure (if persistence is enabled)

What changed?

  • Added support of PostgresOperator for database creation and secret management.
  • Refactored the chart to cover all the configuration options.

Installing the Chart

To install the chart with the release name my-glauth:

helm install my-glauth glauth/glauth

The command deploys GLAuth on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-glauth deployment:

helm delete my-glauth

The command removes all the Kubernetes components associated with the chart and deletes the release.

Parameters

Common Parameters

NameDescriptionValue
replicaCountNumber of GLAuth replicas to deploy1
nameOverrideString to partially override common.names.name""
fullnameOverrideString to fully override common.names.fullname""

GLAuth Image Parameters

NameDescriptionValue
image.repositoryGLAuth image repositoryghcr.io/nnstd/glauth
image.tagGLAuth image tag (immutable tags are recommended)v2.4.44
image.pullPolicyGLAuth image pull policyIfNotPresent
imagePullSecretsGLAuth image pull secrets[]

GLAuth Configuration Parameters

NameDescriptionValue
config.debugEnable debug modefalse
config.systemLoggingEnable system loggingfalse
config.structuredLoggingEnable structured loggingfalse

Users and Groups Configuration

NameDescriptionValue
config.usersArray of users for config backend (used only when backend.type is "config")[]
config.groupsArray of groups for config backend (used only when backend.type is "config")[]

Storage Configuration

NameDescriptionValue
config.storage.sizeSize of the persistent volume for GLAuth data20G
config.storage.classNameStorage class name for the persistent volume""
config.storage.accessModeAccess mode for the persistent volume""
config.storage.existingClaimUse an existing PVC for GLAuth datafalse

LDAP Configuration

NameDescriptionValue
config.ldap.enabledEnable LDAP servicetrue
config.ldap.listenListen address for LDAP (default: "0.0.0.0:3893")""

LDAPS Configuration

NameDescriptionValue
config.ldaps.enabledEnable LDAPS servicefalse
config.ldaps.listenListen address for LDAPS (default: "0.0.0.0:3894")""
config.ldaps.certPath to the certificate file for LDAPS""
config.ldaps.keyPath to the key file for LDAPS""

API Configuration

NameDescriptionValue
config.api.enabledEnable API servicetrue
config.api.internalsEnable internal API for debugging application performancetrue
config.api.tlsWhether to enable TLS for APIfalse
config.api.listenListen address for the API (default: "0.0.0.0:5555")""
config.api.certPath to the certificate file for API TLS""
config.api.keyPath to the key file for API TLS""

Behavior Configuration

NameDescriptionValue
config.behaviors.ignoreCapabilitiesIgnore all capabilities restrictionsfalse
config.behaviors.limitFailedBindsEnable "fail2ban" type backoff mechanismtrue
config.behaviors.numberOfFailedBindsHow many failed login attempts before ban3
config.behaviors.periodOfFailedBindsTime window for failed login attempts (seconds)10
config.behaviors.blockFailedBindsForBan duration (seconds)60
config.behaviors.pruneSourceTableEveryClean learnt IP addresses every N seconds600
config.behaviors.pruneSourcesOlderThanClean learnt IP addresses not seen in N seconds600

Backend Configuration

NameDescriptionValue
config.backend.typeBackend type for GLAuth (config or database)database
config.backend.fileCustom configuration file name (stored in ConfigMap)""
config.backend.baseDNBase DN for LDAP structuredc=glauth,dc=com
config.backend.nameFormatName format for LDAP entriescn
config.backend.groupFormatGroup format for LDAP entriesou
config.backend.anonymousDSEEnable anonymous DSE for clients like SSSDfalse
config.backend.sshKeyAttrSSH key attribute name (e.g., 'ipaSshPubKey' for IPA compatibility)""

Database Configuration

NameDescriptionValue
config.database.engineDatabase engine (sqlite or postgres)sqlite

SQLite Database Configuration

NameDescriptionValue
config.database.sqlite.shellEnable SQLite shell pod for database managementfalse

PostgreSQL Database Configuration

NameDescriptionValue
config.database.postgres.connectionStringPostgreSQL connection string (required when createResources is false)""
config.database.postgres.createResourcesCreate PostgreSQL CRD resources (Postgres and PostgresUser)false
config.database.postgres.secretNameSecret name for PostgreSQL credentialspostgres-user
config.database.postgres.existingSecretNameExisting secret name created by PostgreSQL operator""

Service Configuration

NameDescriptionValue
service.nameGLAuth service nameglauth
service.typeGLAuth service typeNodePort
service.portsGLAuth service ports configurationSee values.yaml

Service Account Configuration

NameDescriptionValue
serviceAccount.createSpecifies whether a ServiceAccount should be createdtrue
serviceAccount.nameThe name of the ServiceAccount to use""
serviceAccount.annotationsAdditional Service Account annotations{}

Pod Configuration

NameDescriptionValue
podAnnotationsAnnotations for GLAuth pods{}
podSecurityContextGLAuth pods' Security Context{}
securityContextGLAuth containers' Security Context{}

Ingress Configuration

NameDescriptionValue
ingress.enabledEnable ingress record generation for GLAuthfalse
ingress.classNameIngressClass that will be used to implement the Ingress""
ingress.annotationsAdditional annotations for the Ingress resource{}
ingress.hostsAn array with hosts and pathsSee values.yaml
ingress.tlsTLS configuration for the Ingress[]

Resource Management

NameDescriptionValue
resourcesThe resources limits and requests for the GLAuth containers{}

Autoscaling Configuration

NameDescriptionValue
autoscaling.enabledEnable Horizontal POD autoscaling for GLAuthfalse
autoscaling.minReplicasMinimum number of GLAuth replicas1
autoscaling.maxReplicasMaximum number of GLAuth replicas100
autoscaling.targetCPUUtilizationPercentageTarget CPU utilization percentage80

Other Configuration

NameDescriptionValue
nodeSelectorNode labels for GLAuth pods assignment{}
tolerationsTolerations for GLAuth pods assignment[]
affinityAffinity for GLAuth pods assignment{}

Configuration and Installation Details

Configuration Philosophy

The current configuration philosophy is to remain fully compatible with the config files already supported by GLAuth. In the future, GLAuth may be adapted to read Kubernetes secrets, etc. However, this would grow the project's code base quite significantly.

Backend Types

GLAuth supports two main backend types:

  1. Config Backend: Uses a simple configuration file with embedded users and groups
  2. Database Backend: Uses SQLite or PostgreSQL for storing user and group data

Config Backend

When using the config backend, users and groups are defined directly in the values.yaml file:

config:
backend:
type: configusers:
- name: "johndoe"givenname: "John"sn: "Doe"mail: "jdoe@example.com"uidnumber: 5001primarygroup: 5501passsha256: "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a"capabilities:
- action: "search"object: "*"groups:
- name: "users"gidnumber: 5501

User Configuration Options:

  • name: Username (required)
  • givenname: First name
  • sn: Surname/last name
  • mail: Email address
  • uidnumber: Unique user ID number (required)
  • primarygroup: Primary group ID (required)
  • loginShell: User's login shell
  • homeDir: User's home directory
  • passsha256: SHA256 hashed password
  • passappsha256: Array of SHA256 hashed application passwords
  • passappbcrypt: Array of bcrypt hashed application passwords
  • sshkeys: Array of SSH public keys
  • otpsecret: OTP secret for 2FA
  • yubikey: YubiKey identifier
  • capabilities: Array of user capabilities (action and object)

Group Configuration Options:

  • name: Group name (required)
  • gidnumber: Unique group ID number (required)
  • includegroups: Array of group IDs to include in this group

Database Configuration

SQLite

When using SQLite as the backend:

config:
backend:
type: databasedatabase:
engine: sqlitesqlite:
shell: true # Enable shell pod for database management

Setting shell: true creates a companion pod that allows you to manage the SQLite database:

kubectl exec -it glauth-sqlite-client -- sqlite3 /root/db/gl.db

PostgreSQL

For PostgreSQL backend with external database:

config:
backend:
type: databasedatabase:
engine: postgrespostgres:
connectionString: "host=my-postgres-host port=5432 dbname=glauth user=glauth password=secretpassword sslmode=require"createResources: false

For PostgreSQL backend with PostgreSQL Operator:

config:
backend:
type: databasedatabase:
engine: postgrespostgres:
createResources: truesecretName: "postgres-user"

Service Configuration

GLAuth exposes three main ports:

  • 3893: LDAP (unencrypted)
  • 3894: LDAPS (encrypted)
  • 5555: Web interface/API

The default service configuration uses NodePort:

service:
type: NodePortports:
- name: ldapinternal: 3893external: 3893node: 30389
- name: ldapsinternal: 3894external: 3894node: 30636
- name: webinternal: 5555external: 5555node: 30555

LDAPS Configuration

To enable LDAPS, you need to provide certificates:

config:
ldaps:
enabled: truecert: "/path/to/glauth.crt"key: "/path/to/glauth.key"

Generate a certificate with:

openssl req -x509 -newkey rsa:4096 -keyout glauth.key -out glauth.crt -days 365 -nodes -subj '/CN=`hostname`'

Persistence

GLAuth uses persistent volumes to store:

  • Configuration files
  • SQLite databases (when using SQLite backend)
  • SSL certificates for LDAPS

Configure persistence using the config.storage section:

config:
storage:
size: 20GclassName: "fast-ssd"accessMode: "ReadWriteOnce"

Security Features

GLAuth includes built-in security features:

  1. Failed Login Protection: Implements a "fail2ban" style mechanism
  2. Rate Limiting: Configurable thresholds and ban durations
  3. IP Address Management: Automatic cleanup of learned IP addresses

Configure these via the config.behaviors section.

Security

For production deployments, consider:

  • Using LDAPS (port 3894) instead of plain LDAP
  • Configuring proper network policies
  • Using secrets for database credentials
  • Disabling the SQLite shell pod when not needed
  • Enabling TLS for the API endpoint

Troubleshooting

Common Issues

  1. Pod not starting: Check resource limits and node capacity
  2. Database connection issues: Verify connection string and network policies
  3. LDAP authentication failures: Check user configuration and base DN settings
  4. Persistence issues: Verify storage class and PVC creation

Debug Commands

# Check pod status
kubectl get pods -l app=glauth
# View logs
kubectl logs -l app=glauth
# Check service endpoints
kubectl get svc glauth
# Test LDAP connectivity (if using NodePort)
ldapsearch -x -H ldap://node-ip:30389 -b "dc=glauth,dc=com"# Access SQLite shell (if enabled)
kubectl exec -it glauth-sqlite-client -- sqlite3 /root/db/gl.db

Upgrading

To Latest Version

When upgrading, review the changelog and:

  1. Check for breaking changes in configuration
  2. Update your values.yaml if using custom configurations
  3. Consider backup of your data before upgrading
  4. Test in a non-production environment first

Examples

Config Backend with Users and Groups

config:
backend:
type: configusers:
- name: "admin"givenname: "Administrator"sn: "User"mail: "admin@example.com"uidnumber: 5001primarygroup: 5501passsha256: "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a"capabilities:
- action: "search"object: "*"
- name: "user1"givenname: "Regular"sn: "User"mail: "user1@example.com"uidnumber: 5002primarygroup: 5502passsha256: "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a"groups:
- name: "admins"gidnumber: 5501
- name: "users"gidnumber: 5502

Basic SQLite Setup

config:
backend:
type: databasedatabase:
engine: sqlitesqlite:
shell: truestorage:
size: 10Gi

PostgreSQL with External Database

config:
backend:
type: databasedatabase:
engine: postgrespostgres:
connectionString: "host=postgres.example.com port=5432 dbname=glauth user=glauth password=secret sslmode=require"createResources: false

LDAPS with Custom Certificates

config:
ldaps:
enabled: truecert: "/app/config/tls.crt"key: "/app/config/tls.key"storage:
size: 5Gi

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This Helm chart is licensed under the Apache 2.0 license.

Support

For support and questions:

About

A Helm chart to setup GLAuth in a Kubernetes cluster

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages