Skip to content

Commit

Permalink
Merge pull request #8 from g0dsCookie/docker
Browse files Browse the repository at this point in the history
Added new option LDAPAUTHD_SESSION_PREFIX
  • Loading branch information
g0dsCookie authored Apr 14, 2020
2 parents de3f002 + 6b33c61 commit 7e8b65a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.9
FROM alpine:3.11

RUN set -eu \
&& cecho() { echo "\033[1;32m$1\033[0m"; } \
Expand All @@ -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 \
Expand Down
31 changes: 9 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
docker push ${TAG}

.PHONY: build latest clean push
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ldapauthd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 7e8b65a

Please sign in to comment.