Go-lang LDAP Authentication (GLAuth) is a secure, easy-to-use, LDAP server w/ configurable backends.

GLAuth: LDAP authentication server for developers

Go-lang LDAP Authentication (GLAuth) is a secure, easy-to-use, LDAP server w/ configurable backends.

Gitter Matrix

GitHub all releases Docker pulls

Travis (.com) branch Docker Automated build

GitHub last commit (branch) Code Climate maintainability

  • Centrally manage accounts across your infrastructure
  • Centrally manage SSH keys, Linux accounts, and passwords for cloud servers.
  • Lightweight alternative to OpenLDAP and Active Directory for development, or a homelab.
  • Store your user directory in a file, local or in S3; SQL database; or proxy to existing LDAP servers.
  • Two Factor Authentication (transparent to applications)
  • Multiple backends can be chained to inject features

Use it to centralize account management across your Linux servers, your OSX machines, and your support applications (Jenkins, Apache/Nginx, Graylog2, and many more!).

Contributing

  • Please base all Pull Requests on dev, not master.
  • Format your code autonmatically using gofmt -d ./ before committing

Quickstart

This quickstart is a great way to try out GLAuth in a non-production environment. Be warned that you should take the extra steps to setup SSL (TLS) for production use!

  1. Download a precompiled binary from the releases page.
  2. Download the example config file.
  3. Start the GLAuth server, referencing the path to the desired config file with -c.
    • ./glauth64 -c sample-simple.cfg
  4. Test with traditional LDAP tools
    • For example: ldapsearch -LLL -H ldap://localhost:3893 -D cn=serviceuser,ou=svcaccts,dc=glauth,dc=com -w mysecret -x -bdc=glauth,dc=com cn=hackers

Make Commands

Note - makefile uses git data to inject build-time variables. For best results, run in the context of the git repo.

make all - run build binaries for platforms

make fast - run build for only linux 64 bit

make run - wrapper for the 'go run' command, setting up the needed tooling

make plugins - build additional (SQL) plugin backends

make test - run the integration test on linux64 binary

Usage:

glauth: securely expose your LDAP for external auth

Usage:
  glauth [options] -c 
  glauth -h --help
  glauth --version

Options:
  -c, --config        Config file.
  -K            AWS Key ID.
  -S        AWS Secret Key.
  -r            AWS Region [default: us-east-1].
  --ldap 
Listen address for the LDAP server. --ldaps
Listen address for the LDAPS server. --ldaps-cert Path to cert file for the LDAPS server. --ldaps-key Path to key file for the LDAPS server. -h, --help Show this screen. --version Show version.

Configuration:

GLAuth can be deployed as a single server using only a local configuration file. This is great for testing, or for production if you use a tool like Puppet/Chef/Ansible:

glauth -c glauth.cfg

Here's a sample config wth hardcoded users and groups:

[backend]
  datastore = "config"
  baseDN = "dc=glauth,dc=com"
[[users]]
  name = "hackers"
  uidnumber = 5001
  primarygroup = 5501
  passsha256 = "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a"   # dogood
  sshkeys = [ "ssh-dss AAAAB3..." ]
[[users]]
  name = "uberhackers"
  uidnumber = 5006
  primarygroup = 5501
  passbcrypt = "243261243130244B62463462656F7265504F762E794F324957746D656541326B4B46596275674A79336A476845764B616D65446169784E41384F4432"   # dogood
[[groups]]
  name = "superheros"
  gidnumber = 5501

To create the password SHA hash, use this command: echo -n "mysecret" | openssl dgst -sha256

Instead of a local configuration file, GLAuth can fetch its configuration from S3. This is an easy way to ensure redundant GLAuth servers are always in-sync.

glauth -c s3://bucketname/glauth.cfg

In order to use S3, you must set your AWS credentials. Either:

  1. set the -K and -S command-line flags OR
  2. set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

More configuration options are documented here: https://github.com/glauth/glauth/blob/master/sample-simple.cfg

Chaining backends

This can be used, for instance, to inject support for Two Factor Authentication for backends that do not support the feature natively:

[[backends]]
  datastore = "ldap"
  servers = ["ldap:s//localhost:390"]

[[backends]]
  datastore = "config"

...

[[users]]
  name = "hackers"
  otpsecret = "................"

Required Fields

  • Name
    • The user's username
  • ou
    • ID of the user's primary group
  • uidnumber
    • The user's unix user id
  • sshPublicKey
    • Specify an array of public keys

Optional Fields

  • otherGroups
    • Array of IDs of groups the user is a member of.
    • Example: [5501, 5002]
    • default = blank
  • givenname
    • First name
    • Example: John
    • default = blank
  • sn
    • Last name
    • Example: Doe
    • default = blank
  • disabled
    • Specify if account is active.
    • Set to 'true' (without quotes) to make the LDAP entry add 'AccountStatus = inactive'
    • default = false (active)
  • mail
  • loginshell
    • Specify a different login shell for the user
    • Example: /bin/sh, or /sbin/nologin
    • default = /bin/bash
  • homedirectory
    • Specify an overridden home directory for the user
    • Example: /home/itadmin
    • default = /home/[username]
  • otpsecret
    • Specify OTP secret used to validate OTP passcode
    • Example: 3hnvnk4ycv44glzigd6s25j4dougs3rk
    • default = blank
  • passappbcrypt
    • Specify an array of app passwords which can also succesfully bind - these bypass the OTP check. Hash the same way as password.
    • Example: ["c32255dbf6fd6b64883ec8801f793bccfa2a860f2b1ae1315cd95cdac1338efa","4939efa7c87095dacb5e7e8b8cfb3a660fa1f5edcc9108f6d7ec20ea4d6b3a88"]
    • default = blank
  • passappsha256
    • Specify an array of app passwords which can also succesfully bind - these bypass the OTP check. Hash the same way as password.
    • Example: ["c32255dbf6fd6b64883ec8801f793bccfa2a860f2b1ae1315cd95cdac1338efa","4939efa7c87095dacb5e7e8b8cfb3a660fa1f5edcc9108f6d7ec20ea4d6b3a88"]
    • default = blank
  • yubikey
    • Specify Yubikey ID for maching Yubikey OTP against the user
    • Example: cccjgjgkhcbb
    • default = blank

OpenSSH keys:

GLAuth can store a user's SSH authorized keys. Add one or more keys per user as shown above, then setup the goklp helper: https://github.com/appliedtrust/goklp

Strong Passwords

If you are currently using sha256 passwords (passsha256 or passappsha256) moving to strong, salted paswords is recommended. Simply switch to passbcrypt and/or passappbcrypt password types. Currently (2021) 212 is a reasonably good value, depending our your server's CPU.

Two Factor Authentication

GLAuth can be configured to accept OTP tokens as appended to a users password. Support is added for both TOTP tokens (often known by it's most prominent implementation, "Google Authenticator") and Yubikey OTP tokens.

When using 2FA, append the 2FA code to the end of the password when authenticating. For example, if your password is "monkey" and your otp is "123456", enter "monkey123456" as your password.

TOTP Configuration

To enable TOTP authentication on a user, you can use a tool like this to generate a QR code (pick 'Timeout' and optionally let it generate a random secret for you), which can be scanned and used with the Google Authenticator app. To enable TOTP authentication, configure the otpsecret for the user with the TOTP secret.

App Passwords

Additionally, you can specify an array of password hashes using the passappsha256 for app passwords. These are not OTP validated, and are hashed in the same way as a password. This allows you to generate a long random string to be used in software which requires the ability to authenticate.

However, app passwords can be used without OTP as well.

Yubikey Configuration

For Yubikey OTP token authentication, first configure your Yubikey. After this, make sure to request a Client ID and Secret key pair.

Now configure the yubikeyclientid and yubikeysecret fields in the general section in the configuration file.

To enable Yubikey OTP authentication for a user, you must specify their Yubikey ID on the users yubikey field. The Yubikey ID is the first 12 characters of the Yubikey OTP, as explained in the below chart.

Yubikey OTP

When a user has been configured with either one of the OTP options, the OTP authentication is required for the user. If both are configured, either one will work.

Backends:

For advanced users, GLAuth supports pluggable backends. Currently, it can use a local file, S3 or an existing LDAP infrastructure. In the future, we hope to have backends that support Mongo, SQL, and other datastores.

[backend]
  datastore = "ldap"
  servers = [ "ldaps://server1:636", "ldaps://server2:636" ]

Production:

Any of the architectures above will work for production. Just remember:

  • Always use legit SSL certs for production!

Other Architectures

A small note about other architectures: while I expect the code is, for the most part, system-independent, there is not a good (and free) CI system which can be easily used to continuously test releases on ARM, BSD, Linux-32bit, and Windows. As such, all of the non-linux-64bit packages are provided as is. The extent of testing on these packages consists solely of cross-compiling for these architectures from a linux 64 bit system.

We will accept PRs which fix bugs on these platforms, but be aware these binaries will not be tested regularly, and instead are provided for the convenience of those who feel comfortable with this.

Building:

You'll need go-bindata to build GLAuth. Then use the Makefile.

go get github.com/jteeuwen/go-bindata/...
make all

Logging

  • using logr with increasing verbosity
    • 0 you always want to see this
    • 1 common logging that you might possibly want to turn off (error)
    • 2 warn
    • 3 notice
    • 4 info
    • 6 debug
    • 8 trace
    • 10 I would like to performance test your log collection stack
  • errors really are errors that cannot be handled or returned
    • returning a proper LDAP error code is handling an error

Testing

Of course, a core set of tests is being run by Travis CI. However, when developing new features/refactoring, a more comprehensive regression testing suite is needed.

You can run go test to execute the tests found in glauth_test.go -- better, if it is installed, you can run goconvey

Since some tests cover TOTP, you will first need to install oathtool in your environment.

In order to test GLAuth against an LDAP backend, you will need docker. Run this command:

docker run \
    --rm \
    -d \
    -p 389:389 \
    --name openldap-service \
    --hostname ldap-service \
    --env LDAP_ORGANISATION="GLauth" \
    --env LDAP_DOMAIN="glauth.com" \
    --env LDAP_ADMIN_PASSWORD="password" \
    --env LDAP_CONFIG_PASSWORD="password" \
    --env LDAP_BASE_DN="dc=glauth,dc=com" \
    -v $PWD/misc/openldap/config:/etc/ldap/slapd.d \
    -v $PWD/misc/openldap/db:/var/lib/ldap \
    osixia/openldap:latest

Refer to this page for a somewhat more in-depth overview of testing with OpenLDAP.

Compatibility

While our stated goal for GLAuth is to provide the simplest possible authentication server, we keep finding an increasing number of client appliances that are asking fairly "existential" questions of the server. We have been working on providing answers these clients will find satisfactory.

Root DSE

RFC 4512: "An LDAP server SHALL provide information about itself and other information that is specific to each server. This is represented as a group of attributes located in the root DSE"

Test: ldapsearch -LLL -H ldap://localhost:3893 -D cn=serviceuser,ou=svcaccts,dc=glauth,dc=com -w mysecret -x -s base "(objectclass=*)"

Subschema Discovery

RFC 4512: "To read schema attributes from the subschema (sub)entry, clients MUST issue a Search operation [RFC4511] where baseObject is the DN of the subschema (sub)entry..."

Test: ldapsearch -LLL -o ldif-wrap=no -H ldap://localhost:3893 -D cn=serviceuser,ou=svcaccts,dc=glauth,dc=com -w mysecret -x -bcn=schema -s base

By default, this query will return a very minimal schema (~5 objects) -- you can ask GLAuth to return more comprehensive schemas by unpacking, in the schema/ directory, the OpenLDAP or FreeIPA schema archives found in the assets/ directory.

LDAP Backend: "1.1" attribute

RFC 4511: "A list containing only the OID "1.1" indicates that no attributes are to be returned."

Stargazers over time

Stargazers over time

Owner
GLAuth
Lightweight LDAP Server in Golang
GLAuth
Comments
  • Add TLS options for running both with TLS and without on the same time

    Add TLS options for running both with TLS and without on the same time

    This commit expands on the settings available for using TLS. It puts TLS settings under the [frontend.tls] section and adds a new setting to [frontend] called TLSExclusive (bool). TLSExclusive specifies whether or not to only run TLS when it is enabled, and is 'true' by default. Setting it to 'false' and having TLS enabled, causes the server to start both a LDAP and LDAPS server, and therefore requires two seperate 'listen' options (to run on different ports) - the Frontend.Listen and the Frontend.TLS.Listen. If TLSExclusive is set to 'true' and no Frontend.TLS.Listen is specified, it will use the Frontend.Listen.

    sample-simple.cfg is updated with example and comments

  • LDAP Result Code 49 - BindDN should have only one or two parts

    LDAP Result Code 49 - BindDN should have only one or two parts

    I working on the integration with GLAuth in https://github.com/greenpau/caddy-security/issues/32

    The LDAP library used is github.com/go-ldap/ldap/v3 v3.4.1.

    Working with the sample-simple.cfg provided in the getting started.

    The binding does not quite work.

    As user. I get: LDAP Result Code 49 "Invalid Credentials":

    In GLAuth logs I see: BindDN should have only one or two parts

    18:11:40.997631 Bind ▶ DEBU 023  "level"=6 "msg"="Bind request"  "basedn"="dc=glauth,dc=com" "binddn"="cn=serviceuser,ou=svcaccts,dc=glauth,dc=com" "src"={"IP":"127.0.0.1","Port":56898,"Zone":""}
    18:11:40.997681 Bind ▶ DEBU 024  "level"=6 "msg"="Bind success"  "binddn"="cn=serviceuser,ou=svcaccts,dc=glauth,dc=com" "src"={"IP":"127.0.0.1","Port":56898,"Zone":""}
    18:11:40.998060 Search ▶ DEBU 025  "level"=6 "msg"="Search request"  "basedn"="dc=glauth,dc=com" "binddn"="cn=serviceuser,ou=svcaccts,dc=glauth,dc=com" "filter"="(\u0026(|(uid=johndoe)(mail=johndoe))(objectClass=posixAccount))" "scope"=2 "searchbasedn"="dc=glauth,dc=com" "src"={"IP":"127.0.0.1","Port":56898,"Zone":""}
    18:11:40.998076 searchMaybeTopLevelNodes ▶ DEBU 026  "level"=6 "msg"="Search request"  "special case"="top-level browse"
    18:11:40.998131 searchMaybeTopLevelNodes ▶ DEBU 027  "level"=6 "msg"="AP: Top-Level Browse OK"  "filter"="(\u0026(|(uid=johndoe)(mail=johndoe))(objectClass=posixAccount))"
    18:11:40.998388 Bind ▶ DEBU 028  "level"=6 "msg"="Bind request"  "basedn"="dc=glauth,dc=com" "binddn"="cn=johndoe,ou=superheros,ou=users,dc=glauth,dc=com" "src"={"IP":"127.0.0.1","Port":56898,"Zone":""}
    18:11:40.998404 findUser ▶ WARN 029  "level"=2 "msg"="BindDN should have only one or two parts"  "binddn"="cn=johndoe,ou=superheros,ou=users,dc=glauth,dc=com" "numparts"=3
    

    Please assist.

  • Additional Backends

    Additional Backends

    From @benyanke on April 19, 2018 1:21

    This thread is for requests of additional backends.

    MySQL seems the first obvious one. Feel free to chime in if anyone has other ideas. I'll implement as I'm able or accept PRs.

    Currently tracked backends:

    • MySQL
    • Postgres
    • CockroachDB (would likely be the same as postgres)
    • Etcd
    • Amazon Cognito REST API

    Before implementing these backends, perhaps it would be useful to add an interface layer to cleanly specify the contract between a backend provider and glauth, and also move backend providers into their own directory.

  • Database plugins

    Database plugins

    Me again!

    Following your feedback, things are now much lighter: CGO dependencies are gone and, more importantly, I am now using Go's plugin mechanism so that the database backends are not compiled in GLAuth by default.

    I added 3 simple targets so that either of them can be easily compiled to a dynamically loadable plugin.

    You will also note that everything is self contained in its own package.

  • macOS native binary run with postgres plugin throwing error:

    macOS native binary run with postgres plugin throwing error: "error"="Unable to load specified backend plugin: plugin: not implemented" "msg"="Could not create server"

    OS: macOS Big Sur (11.16.5) glauth version: v2.1.0 (downloaded from release) plugin: postgres.so

    config:

    [backend]
      datastore = "plugin"
      # If "plugin," uncomment the line below
      # plugin = "bin/sqlite.so"
      # pluginhandler = "NewSQLiteHandler"
      plugin = "postgres.so"
      pluginhandler = "NewPostgresHandler"
    

    files:

    $ ls

    glauth*              glauth.sha256        mysql.so             postgres.so          sample-database.cfg  sqlite.so
    
    ./glauth -c sample-database.cfg
    09:38:20.886567 doConfig ▶ DEBU 001  "level"=6 "msg"="Debugging enabled"
    09:38:20.886598 startService ▶ DEBU 002  "level"=6 "msg"="Web API enabled"
    09:38:20.886635 startService ▶ ERRO 003  "error"="Unable to load specified backend plugin: plugin: not implemented" "msg"="Could not create server"
    
  • Push current images to docker hub

    Push current images to docker hub

    I really like glauth /w cockraochdb and it works fine with my own built docker image. But is there a way, that the latest glauth(-plugins) will be pushed to the glauth/glauth docker hub? Seems very outdated. Thanks.

  • Support for LDAP with TLS?

    Support for LDAP with TLS?

    Not to be confused with LDAP over SSL (LDAPS), does glauth support LDAP with TLS (StartTLS over ldap scheme)? I unfortunately couldn't find any documentation on the subject (sorry if I'm blind) and couldn't get it to work... Configuration problem or simply trying to use a feature that doesn't exist?

  • ldap filter `memberOf` does not work

    ldap filter `memberOf` does not work

    I use glauth w/ ldap backend. The filter using memberOf doesn't seem to work. Example:

    ldapsearch -H ldaps://ldap-proxy.example.com:636 -b dc=example,dc=com -D uid=abc,cn=users,dc=example,dc=com -x -w PASS '(memberOf=cn=admin,cn=groups,dc=example,dc=com)'
    

    The same query works with the ldap backend.

  • Unable to integrate it with PAM

    Unable to integrate it with PAM

    I have enough services in my home lab to have a LDAP to try to centralize users but now enough to mount a full pledge LDAP like slapd or whatsever.

    I was doing a test on some VMs to test this and worked with some services like next cloud and nginx-ldap but now I'm trying to integrated with Linux at PAM level.

    I think Glauth is correctly configured:

    [ldap]
      enabled = true
      listen = "0.0.0.0:3893"
    [ldaps]
      enabled = false
    [api]
      enabled = true
      tls = false # enable TLS for production!!
      listen = "0.0.0.0:5555"
      cert = "cert.pem"
      key = "key.pem"
    
    debug = true
    
    [backend]
      datastore = "config"
      baseDN = "dc=h"
    
    ################# USERS #################
    [[users]]
      name = "root"
      givenname = "root"
      unixID = 0
      primaryGroup = 5501
      otherGroups = [ 5503 ]
      loginShell = "/bin/bash"
      homeDir = "/root"
      passsha256 = REDACTED
    
    # Home users
    [[users]]
      name = "kang"
      unixID = 10000
      primaryGroup = 5501
      otherGroups = [ 5503 ]
      loginShell = "/bin/bash"
      homeDir = "/home/kang"
      passsha256 = REDACTED
    
    ################# GROUPS #################
    [[groups]]
      name = "home"
      unixid = 5501
    

    % ldapsearch -x -H ldap://glauth.s -D cn=root,ou=home,dc=h -w "$pass" -b dc=h cn=kang

    # extended LDIF
    #
    # LDAPv3
    # base <dc=h> with scope subtree
    # filter: cn=kang
    # requesting: ALL
    #
    
    # kang, home, h
    dn: cn=kang,ou=home,dc=h
    cn: kang
    uid: kang
    ou: home
    uidNumber: 10000
    accountStatus: active
    objectClass: posixAccount
    objectClass: shadowAccount
    loginShell: /bin/bash
    homeDirectory: /home/kang
    description: kang
    gecos: kang
    gidNumber: 5501
    memberOf: cn=home,ou=groups,dc=h
    shadowExpire: -1
    shadowFlag: 134538308
    shadowInactive: -1
    shadowLastChange: 11000
    shadowMax: 99999
    shadowMin: -1
    shadowWarning: 7
    
    # search result
    search: 2
    result: 0 Success
    
    # numResponses: 2
    # numEntries: 1
    

    So I configure PAM: # cat /etc/nsswitch.conf

    passwd:         files ldap
    group:          files ldap
    shadow:         files ldap
    gshadow:        files ldap
    

    # cat /etc/libnss-ldap.conf

    host glauth.s
    base dc=h
    ldap_version 3
    
    rootbinddn cn=root,ou=home,dc=h
    bindpw secret
    

    # cat /etc/libnss-ldap.secret

    REDACTED
    

    It seems to work: # getent passwd | grep kang

    kang:x:10000:5501:kang:/home/kang:/bin/bash
    

    # getent group | grep kang

    home:*:5501:kang,root,kang,root
    

    But when I try to the a passwd with getent passwd o simply su it fails. # getent shadow | grep kang | wc -l

    0
    

    These are the errors I find in the logs:

    2020/12/09 20:10:53 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(&(objectClass=shadowAccount)(uid=kang))]
    2020/12/09 20:10:53 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(&(objectClass=shadowAccount)(uid=kang))]
    2020/12/09 20:10:54 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(&(objectClass=shadowAccount)(uid=kang))]
    2020/12/09 20:13:02 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(objectClass=shadowAccount)]
    2020/12/09 20:13:58 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(objectClass=shadowAccount)]
    2020/12/09 20:15:39 handleSearchRequest error LDAP Result Code 1 "Operations Error": Search Error: unhandled filter type: shadowaccount [(objectClass=shadowAccount)]
    

    Any hint of when to start to debug to see if I can help?

    OS: Debian 10 Simply install libnss-ldap and libpam-ldapd on a fresh machine and change the files I mentioned to reproduce this bug/feature request.

  •  Space in search BaseDN causes request to fail

    Space in search BaseDN causes request to fail

    I wanted to try out GLAuth instead of OpenLDAP for use with Authelia. GLAuth works perfectly with ldaptools, but with Authelia I always get "Authentication failed", so I started to debug the requests and found out Authelia puts a space between the request BaseDN so instead of dc=example,dc=com it sends dc=example, dc=com which causes the request to fail. I wasn't sure whether to submit this to GLAuth or to Authelia, so I'll just submit it to both.

    https://github.com/clems4ever/authelia/issues/306

    Example of working request (done with ldapsearch):

    14:13:12.879190 Bind ▶ DEBU 054 Bind request: bindDN: cn=admin,ou=admins,dc=example,dc=com, BaseDN: dc=example,dc=com, source: 192.168.0.68:54638
    14:13:12.879279 Bind ▶ DEBU 055 Bind success as %s from %s cn=admin,ou=admins,dc=example,dc=com 192.168.0.68:54638
    14:13:12.879753 Search ▶ DEBU 056 Search request as %s from %s for %s cn=admin,ou=admins,dc=example,dc=com 192.168.0.68:54638 (objectclass=*)
    14:13:12.879955 Search ▶ DEBU 057 AP: Search OK: %s (objectclass=*)
    

    Example of broken request

    
    14:13:27.437198 Bind ▶ DEBU 058 Bind request: bindDN: cn=admin,ou=admins,dc=example,dc=com, BaseDN: dc=example,dc=com, source: 192.168.0.68:54642
    14:13:27.437283 Bind ▶ DEBU 059 Bind success as %s from %s cn=admin,ou=admins,dc=example,dc=com 192.168.0.68:54642
    14:13:27.437730 Search ▶ DEBU 05a Search request as %s from %s for %s cn=admin,ou=admins,dc=example,dc=com 192.168.0.68:54642 (objectclass=*)
    2018/12/15 14:13:27 handleSearchRequest error LDAP Result Code 50 "Insufficient Access Rights": Search Error: search BaseDN dc=example, dc=com is not in our BaseDN dc=example,dc=com
    
  • v2.0.0 sql backend is not working, ldaps must be explicitly enabled and v2.0.0 docker image probably contains wrong version of glauth

    v2.0.0 sql backend is not working, ldaps must be explicitly enabled and v2.0.0 docker image probably contains wrong version of glauth

    hey 👋 have few problems with glauth, see my docker-compose.yaml and problems below:

    version: '3'
    services:
      glauth-config:
        image: hairyhenderson/gomplate:v3.10.0-alpine
        container_name: glauth-config
        entrypoint: ["/bin/sh","-c"]
        environment:
          POSTGRES_PASSWORD: glauth
          CONFIG: |
            debug = true
            [ldap]
              enabled = true
              listen = "0.0.0.0:3893"
            [ldaps]
              enabled = false
            [backend]
              datastore = "plugin"
              plugin = "/app/config/postgres.go"
              database = "host=glauth-postgres port=5432 dbname=glauth user=glauth password={{ .Env.POSTGRES_PASSWORD }} sslmode=disable"
            [api]
              enabled = false
        command:
          - gomplate -i '{{ tmpl.Inline .Env.CONFIG }}' -o /app/config/config.cfg
        volumes:
          - glauth-config:/app/config/
        restart: on-failure:5
    
      glauth-init:
        image: alpine
        container_name: glauth-init
        entrypoint: ["/bin/sh","-c"]
        command:
          - |
             apk add unzip
             wget https://github.com/glauth/glauth/releases/download/v2.0.0/plugins_linux_amd64.zip -O /tmp/plugins_linux_amd64.zip 
             unzip /tmp/plugins_linux_amd64.zip -d /app/config/
        volumes:
          - glauth-config:/app/config/
        restart: on-failure:5
    
      glauth:
        image: glauth/glauth:v2.0.0
        container_name: glauth
        restart: always
        depends_on: 
         - glauth-config
         - glauth-init
        ports:
          - 389:389
          - 3893:3893
          - 636:636
        volumes:
          - glauth-config:/app/config/
        networks:
          - production-network
    
      glauth-postgres:
        image: postgres:13.1-alpine
        container_name: glauth-postgres
        environment:
          POSTGRES_USER: glauth
          POSTGRES_PASSWORD: glauth
          POSTGRES_DB: glauth
        networks:
          - production-network
    
    volumes:
      glauth-config:
    
    networks:
      production-network:
        external:
          name: production-network
    

    problem1 - its not possible to use plugin backend, fails to:

    07:44:19.524873 startService ▶ ERRO 002  "error"="Unable to load specified backend plugin: plugin: not implemented" "msg"="Could not create server"
    

    problem2 - without explicitly disabled ldaps:

    [ldaps]
      enabled = false
    

    glauth fails to to:

    07:41:06.886454 main ▶ ERRO 001  "error"="LDAPS was enabled but no certificate or key were specified: please disable LDAPS or use the 'cert' and 'key' options" "msg"="Configuration file error"
    

    problem3 - not sure if its problem, but docker image glauth/glauth:v2.0.0 ( glauth/glauth@sha256:75004ee975658724599f7acc4bb8a0018274b502b2e47a1462aa965d30d8fdea ) reports wrong version, or its not actual stable v2.0.0

    Non-release build from branch master, based on tag v2.0.0-RC1
    

    Btw, would be totally awesome to pack sql backend plugins with glauth.

    Thanks

  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi glauth/glauth!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

  • Config file printed out to the standard output

    Config file printed out to the standard output

    Hi,

    I am testing Glauth in my home lab. I am deploying it in a k3s cluster. I would like to have the configuration file defined in secrets. To accomplish this, I am injecting the configuration from Vault. But the process is printing the whole config file to the standard output!!

    I'm not 100% sure, but I think the culprit is:

    https://github.com/glauth/glauth/blob/7da3859af0fda17c5ef85d0ec0178eeeb958d503/v2/glauth.go#L350

    Is this behavior something desired? Isn't it better to put it as a trace/debug log statement so it can be disabled?

  • bcrypt implementation?

    bcrypt implementation?

    I have problems understanding the bcrypt implementation. :( A password I generated has the following structure: $2y$2^<number of rounds>$<salt>$<hash>

    e.g: $2a$12$vXQCX9zGGAj22vNazNrBz.pBCWsUuLH.QBLImlra61i70D/MFDhKa

    But it does not match the one in one of the commis or the documentation:

    # bcrypt format: hex($2y$2^<number of rounds>$<salt>$<hash>)
      passappbcrypt = [
        "243261243130244B62463462656F7265504F762E794F324957746D656541326B4B46596275674A79336A476845764B616D65446169784E41384F4432" # dogood
      ]
    

    When I integrate my (standard) bcrypt string, a client cannot connect glauth. :(

    What kind of witchcraft do I have to throw at my bcrypt string to make it work?

  • standard for the released artefacts?

    standard for the released artefacts?

    Is it possible to establish a standard for the artefacts?

    Zip archives are offered for download for 2.1.0

    For 2.2.0-RC only the binaries.

    It will be difficult to get a meaningful automation here. :)

  • passbcrypt broken with MySQL backend

    passbcrypt broken with MySQL backend

    Using a mysql backend passbcrypt VARCHAR(64) DEFAULT is not enough to contain a hexadecimal bcrypt password (120 chars long, I suggest using VARCHAR(128) instead)

  • Update sample-simple.cfg

    Update sample-simple.cfg

    Fix typo

    Thank you for making a pull request!

    A few things to be aware of as you're working on your PR:

    WIP Tag

    Incomplete PRs are more than welcome - it can be useful to collaborate before implementation of an idea is complete. However, if your PR is not ready for merge, please add [WIP] to the end of the title (work-in-progress).

    Tests

    Before committing, you are encouraged to run the small but growing test suite. This is accomplished by make test. Additionally, if you are adding new functionality, consider adding tests covering your feature.

    CI

    Each push to a branch connected to a PR will be run through GLAuth's CI system. Please use these to your advantage. In particular, the Github Actions integration tests rely on the LDAP queries returning with a set result, so if your changes will change the output, CI will likely fail.

    To update, run make fast && make updatetest && make test. This will delete the output snapshots provided and make new ones. You can then inspect the changes and commit them.

    Similarly, check codeclimate and try to fix what you find there if it fails.

Authelia: an open-source authentication and authorization server providing two-factor authentication
Authelia: an open-source authentication and authorization server providing two-factor authentication

Authelia is an open-source authentication and authorization server providing two

Jan 5, 2022
Go (lang) HTTP session authentication

Go Session Authentication See git tags/releases for information about potentially breaking change. This package uses the Gorilla web toolkit's session

Dec 22, 2022
Goauth - Basic username password cookie based authentication with Go Lang

goauth [WIP] Basic username password cookie based authentication with Go Lang Overview Use a Postgres DB to store Sign-in and Sign-up info Redis for c

Jan 4, 2022
A simple passwordless authentication middleware that uses only email as the authentication provider
A simple passwordless authentication middleware that uses only email as the authentication provider

email auth A simple passwordless authentication middleware that uses only email as the authentication provider. Motivation I wanted to restrict access

Jul 27, 2022
Authorization and authentication. Learning go by writing a simple authentication and authorization service.

Authorization and authentication. Learning go by writing a simple authentication and authorization service.

Aug 5, 2022
Fast, secure and efficient secure cookie encoder/decoder

Encode and Decode secure cookies This package provides functions to encode and decode secure cookie values. A secure cookie has its value ciphered and

Dec 9, 2022
JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..
JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..

loginsrv loginsrv is a standalone minimalistic login server providing a JWT login for multiple login backends. ** Attention: Update to v1.3.0 for Goog

Dec 24, 2022
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.

sessions gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends. The key features are: Simple API: us

Dec 28, 2022
JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd

login-service login-service is a standalone minimalistic login server providing a (JWT)[https://jwt.io/] login for multiple login backends. Abstract l

Feb 12, 2022
HTTP-server-with-auth# HTTP Server With Authentication

HTTP-server-with-auth# HTTP Server With Authentication Introduction You are to use gin framework package and concurrency in golang and jwt-go to imple

Nov 9, 2022
Authentication server for Docker Registry 2

The original Docker Registry server (v1) did not provide any support for authentication or authorization. Access control had to be performed externally, typically by deploying Nginx in the reverse proxy mode with Basic or other type of authentication. While performing simple user authentication is pretty straightforward, performing more fine-grained access control was cumbersome.

Jan 2, 2023
Server bridging Google's OAuth and service using Radius for authentication

Fringe Fringe is an easy workaround for Google Workplace users who need a Radius server to perform authentication on behalf of other services (e.g. 80

Mar 7, 2022
Example of a simple application which is powered by a third-party oAuth 2.0 server for it's authentication / authorization. Written in Golang.

go mod init github.com/bartmika/osin-thirdparty-example go get github.com/spf13/cobra go get github.com/openshift/osin go get github.com/openshift/osi

Jan 4, 2022
Blog-mongodb - this repository for educational purpose, learn how to use mongodb and use mongodb with go

ENDPOINT ENDPOINT METHOD ACCESS /register POST all /login POST all /articles GET all /articles POST all /articles/{articleId} GET all /articles/{artic

Jan 4, 2022
Go-Guardian is a golang library that provides a simple, clean, and idiomatic way to create powerful modern API and web authentication.

❗ Cache package has been moved to libcache repository Go-Guardian Go-Guardian is a golang library that provides a simple, clean, and idiomatic way to

Dec 23, 2022
Go login handlers for authentication providers (OAuth1, OAuth2)
Go login handlers for authentication providers (OAuth1, OAuth2)

gologin Package gologin provides chainable login http.Handler's for Google, Github, Twitter, Facebook, Bitbucket, Tumblr, or any OAuth1 or OAuth2 auth

Dec 30, 2022
Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications.

Goth: Multi-Provider Authentication for Go Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applic

Dec 29, 2022
HTTP Authentication middlewares

goji/httpauth httpauth currently provides HTTP Basic Authentication middleware for Go. It is compatible with Go's own net/http, goji, Gin & anything t

Dec 23, 2022
[DEPRECATED] Go package authcookie implements creation and verification of signed authentication cookies.

Package authcookie import "github.com/dchest/authcookie" Package authcookie implements creation and verification of signed authentication cookies. Co

Dec 22, 2022