sacharya / loginapp

Web application for Kubernetes CLI configuration with OIDC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loginapp

Docker Repository on Quay codebeat badge Codacy Badge FOSSA Status

Web application for Kubernetes CLI configuration with OIDC

Original source code from coreos/dex repository

Usage

NAME:
    loginapp - Web application for Kubernetes CLI configuration with OIDC

AUTHOR:
    fydrah <flav.hardy@gmail.com>

USAGE:
    loginapp [global options] command [command options]

COMMANDS:
    serve    Run loginapp application
    help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
    --help, -h     show help
    --version, -v  print the version

Configuration

# AppName
# default: mandatory
name: "Kubernetes Auth"
# Bind IP and port (format: "IP:PORT")
# default: mandatory
listen: "0.0.0.0:5555"
# OIDC configuration
oidc:
  # Client configuration
  client:
    # Application ID
    # default: mandatory
    id: "loginapp"
    # Application Secret
    # default: mandatory
    secret: ZXhhbXBsZS1hcHAtc2VjcmV0
    # Application Redirect URL
    # default: mandatory
    redirect_url: "https://127.0.0.1:5555/callback"
  # Issuer configuration
  issuer:
    # Location of issuer root CA certificate
    # default: mandatory
    root_ca: "example/ssl/ca.pem"
    # Issuer URL
    # default: mandatory
    url: "https://dex.example.com:5556"
  # Extra scopes
  # default: []
  extra_scopes:
    - groups
  # Enable offline scope
  # default: false
  offline_as_scope: true
  # Request token on behalf of other clients
  # default: []
  cross_clients: []
# Tls support
tls:
  # Enable tls termination
  # default: false
  enabled: true
  # Certificate location
  # default: mandatory if tls.enabled is true
  cert: example/ssl/cert.pem
  # Key location
  # default: mandatory if tls.enabled is true
  key: example/ssl/key.pem
# Logging configuration
log:
  # Loglevel: debug|info|warning|error|fatal|panic
  # default: info
  level: debug
  # Log format: json|text
  # default: json
  format: json
# Configure the web behavior
web_output:
  # ClientID to output (useful for cross_client)
  # default: value of 'oidc.client.id'
  main_client_id: loginapp
  # Claims to use for kubeconfig username.
  # default: name
  main_username_claim: email
  # Assets directory
  # default: ${pwd}/assets
  assets_dir: /assets
  # Skip main page of login app
  # default: false
  skip_main_page: false

Two main examples are available:

Kubernetes

This application is built to run on a Kubernetes cluster. You will find usage examples here:

Dev

Setup Dex
  • (Optional) Configure GitHub OAuth App
  # Configure github oauth secrets if needed.
  # You must create an app in your github account before.
  cat <<EOF > dev.env
GITHUB_CLIENT_ID=yourclientid
GITHUB_CLIENT_SECRET=yoursecretid
EOF
  • Configure host entry
  echo "127.0.0.1 dex.example.com" | sudo tee -a /etc/hosts
  docker-compose up -d
Manage dependencies

Loginapp uses golang dep.

  # Update dependencies
  dep ensure
Compile, configure and run

Configuration files are located in example directory

  make
  bin/loginapp serve example/config-loginapp-full.yaml

You can also build a temporary Docker image for loginapp, and run it with docker-compose (uncomment lines and replace image name):

  make docker-tmp
Run checks

Some checks can be launched before commits:

  • errorcheck: check for unchecked errors
  • gocyclo: cyclomatic complexities of functions
  • gosimple: simplify code
  make checks

Run also gofmt before any new commit:

  make gofmt

Contributions

Contributions (and issues) are welcomed.

I started this project to learn golang, so you will surely find some weird stuff. Please let me know if some code could be improved.

About

Web application for Kubernetes CLI configuration with OIDC

License:Apache License 2.0


Languages

Language:Go 81.2%Language:HTML 8.4%Language:Makefile 5.6%Language:Shell 2.9%Language:Dockerfile 1.9%