diff --git a/Dockerfile b/Dockerfile index b9994dc..c5471c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.9 +FROM alpine:3.11 RUN set -eu \ && cecho() { echo "\033[1;32m$1\033[0m"; } \ @@ -17,6 +17,7 @@ ENV LDAPAUTHD_LOGLEVEL=INFO \ LDAPAUTHD_PORT=80 \ LDAPAUTHD_REALM=Authorization\ required \ LDAPAUTHD_SESSION_STORAGE=memcached \ + LDAPAUTHD_SESSION_PREFIX= \ LDAPAUTHD_SESSION_DOMAIN= \ LDAPAUTHD_SESSION_HOST=sessiondb:11211 \ LDAPAUTHD_SESSION_TTL=900 \ diff --git a/Makefile b/Makefile index 897dbc0..e617e8a 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,21 @@ MAJOR ?= 1 -MINOR ?= 2 -PATCH ?= 3 +MINOR ?= 3 +PATCH ?= 0 TAG = g0dscookie/ldapauthd TAGLIST = -t ${TAG}:${MAJOR} -t ${TAG}:${MAJOR}.${MINOR} -t ${TAG}:${MAJOR}.${MINOR}.${PATCH} BUILDARGS = --build-arg VERSION=${MAJOR}.${MINOR}.${PATCH} -.PHONY: nothing -nothing: - @echo "No job given." - @exit 1 - -.PHONY: all -all: alpine3.9 - -.PHONY: all-latest -all-latest: alpine3.9-latest - -.PHONY: alpine3.9 -alpine3.9: +build: docker build ${BUILDARGS} ${TAGLIST} . -.PHONY: alpine3.9-latest -alpine3.9-latest: - docker build ${BUILDARGS} -t ${TAG}:latest ${TAGLIST} . +latest: TAGLIST := -t ${TAG}:latest ${TAGLIST} +latest: build -.PHONY: clean clean: - docker rmi -f $(shell docker images -aq ${TAG}) + docker rmi -f $(shell docker images -qt ${TAG}) -.PHONY: push push: - docker push $(TAG) \ No newline at end of file + docker push ${TAG} + +.PHONY: build latest clean push \ No newline at end of file diff --git a/README.md b/README.md index 85bf989..ad273b0 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Configuration for this daemon is read from the current environment. Available co | LDAPAUTHD_USER | User the daemon should be run with. | nobody | | LDAPAUTHD_REALM | String to set in WWW-Authenticate. | Authorization required | | LDAPAUTHD_SESSION_STORAGE | Choose session storage backend. Available: memcached | memcached | +| LDAPAUTHD_SESSION_PREFIX | Key prefix to avoid collisions inside memcache when running multiple ldapauthd instances | | | LDAPAUTHD_SESSION_DOMAIN | Set domain for your session cookie. | | | LDAPAUTHD_SESSION_HOST | Host address of your session storage. | localhost:11211 | | LDAPAUTHD_SESSION_TTL | Maximum TTL for sessions in seconds. | 900 | diff --git a/docker-compose.yml b/docker-compose.yml index 6ce2019..78751e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,8 @@ services: #- LDAPAUTHD_REALM=Authorization required # Choose session storage backend. Available: memcached #- LDAPAUTHD_SESSION_STORAGE=memcached + # Key prefix to avoid collisions inside memcache when running multiple ldapauthd instances + #- LDAPAUTHD_SESSION_PREFIX= # Set domain for your session cookie. #- LDAPAUTHD_SESSION_DOMAIN= # Host address of your session storage. diff --git a/ldapauthd.py b/ldapauthd.py index c193cff..bdc409d 100755 --- a/ldapauthd.py +++ b/ldapauthd.py @@ -230,7 +230,7 @@ def __init__(self): "connect_timeout": 10, "timeout": 10, "no_delay": True, - "key_prefix": b"lad_sess_", + "key_prefix": b"lad_sess_" + os.getenv("LDAPAUTHD_SESSION_PREFIX", "").encode("utf8"), } self._client = base.Client(host, **_opts) self._retryCount = int(os.getenv("LDAPAUTHD_SESSION_RETRY", 1))