Files
glauth/v2/pkg/plugins/Makefile
T
Chris F Ravenscroft 3e2e24cadb Plugin: Unix PAM Authentication (https://github.com/glauth/glauth/pull/263) (#277)
* Plugin: Unix PAM Authentication (#263)

* Add plugin using pam authentication

Adds an additional plugin which us authenticating against
the PAM unix backend and exposing users and groups local
to the machine glauth is running on.

This can be used to expose local users for authentication
in other services which support ldap only.

* plugins: pam: Rewrite Bind() to use ldapopshelper

Modernizes the implementation of Bind() to make use of the helper
functions provided by LDAPOpsHelper.

In order to support custom authentication the existing config.User
has received an additional PassAppCustom property which allows to
specify a custom authentication callback for a user.

In case of the PAM backend this will be used to authenticate against
the local PAM database.

* plugins: pam: Rewrite Search() to use ldapopshelper

Modernizes the implementation of Search() to make use of the helper
functions provided by LDAPOpsHelper.

* plugins: pam: Capability through group membership

Adds a configuration option which decides if a user gets the search
capability or not based on the group memberships of a user.

* plugins: pam: Apply formatting

Runs gofmt and go get on all changes done earlier

* plugins: pam: Address feedback from CodeClimate

- reduce code similarity
- document new exports
- address casing of variables and functions
- reduce complexity of FindPosixGroups()
- reduce complexity of FindPosixAccounts()
- fix else branch in ldapopshelper

Co-authored-by: Marius Zwicker <marius.zwicker@mlba-team.de>

* Updated README for pam plugin

* Updated README for pam plugin

Co-authored-by: Marius Zwicker <marius@mlba-team.de>
Co-authored-by: Marius Zwicker <marius.zwicker@mlba-team.de>
2022-08-14 20:58:36 -07:00

45 lines
1.6 KiB
Makefile

#####################
# Plugins Targets
#####################
# Note: to make a plugin compatible with a binary built in debug mode, add `-gcflags='all=-N -l'`
PLUGIN_OS ?= linux
PLUGIN_ARCH ?= amd64
plugins: plugin_mysql plugin_postgres plugin_sqlite
plugin_mysql: bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/mysql.so
bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/mysql.so: pkg/plugins/mysql.go pkg/plugins/basesqlhandler.go
GOOS=$(PLUGIN_OS) GOARCH=$(PLUGIN_ARCH) go build ${TRIM_FLAGS} -ldflags "${BUILD_VARS}" -buildmode=plugin -o $@ $^
plugin_postgres: bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/postgres.so
bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/postgres.so: pkg/plugins/postgres.go pkg/plugins/basesqlhandler.go
GOOS=$(PLUGIN_OS) GOARCH=$(PLUGIN_ARCH) go build ${TRIM_FLAGS} -ldflags "${BUILD_VARS}" -buildmode=plugin -o $@ $^
plugin_sqlite: bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/sqlite.so
bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/sqlite.so: pkg/plugins/sqlite.go pkg/plugins/basesqlhandler.go
GOOS=$(PLUGIN_OS) GOARCH=$(PLUGIN_ARCH) go build ${TRIM_FLAGS} -ldflags "${BUILD_VARS}" -buildmode=plugin -o $@ $^
plugin_pam: bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/pam.so
bin/$(PLUGIN_OS)$(PLUGIN_ARCH)/pam.so: pkg/plugins/pam_linux.go
GOOS=$(PLUGIN_OS) GOARCH=$(PLUGIN_ARCH) go build ${TRIM_FLAGS} -ldflags "${BUILD_VARS}" -buildmode=plugin -o $@ $^
plugins_darwin: plugins_darwin_amd64 plugins_darwin_arm64
plugins_linux_amd64:
PLUGIN_OS=linux PLUGIN_ARCH=amd64 make plugins plugin_pam
plugins_linux_arm64:
PLUGIN_OS=linux PLUGIN_ARCH=arm64 make plugins
plugins_darwin_amd64:
PLUGIN_OS=darwin PLUGIN_ARCH=amd64 make plugins
plugins_darwin_arm64:
PLUGIN_OS=darwin PLUGIN_ARCH=arm64 make plugins