Skip to content

Commit 7e8b65a

Browse files
authored
Merge pull request #8 from g0dsCookie/docker
Added new option LDAPAUTHD_SESSION_PREFIX
2 parents de3f002 + 6b33c61 commit 7e8b65a

File tree

5 files changed

+15
-24
lines changed

5 files changed

+15
-24
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.9
1+
FROM alpine:3.11
22

33
RUN set -eu \
44
&& cecho() { echo "\033[1;32m$1\033[0m"; } \
@@ -17,6 +17,7 @@ ENV LDAPAUTHD_LOGLEVEL=INFO \
1717
LDAPAUTHD_PORT=80 \
1818
LDAPAUTHD_REALM=Authorization\ required \
1919
LDAPAUTHD_SESSION_STORAGE=memcached \
20+
LDAPAUTHD_SESSION_PREFIX= \
2021
LDAPAUTHD_SESSION_DOMAIN= \
2122
LDAPAUTHD_SESSION_HOST=sessiondb:11211 \
2223
LDAPAUTHD_SESSION_TTL=900 \

Makefile

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,21 @@
11
MAJOR ?= 1
2-
MINOR ?= 2
3-
PATCH ?= 3
2+
MINOR ?= 3
3+
PATCH ?= 0
44

55
TAG = g0dscookie/ldapauthd
66
TAGLIST = -t ${TAG}:${MAJOR} -t ${TAG}:${MAJOR}.${MINOR} -t ${TAG}:${MAJOR}.${MINOR}.${PATCH}
77
BUILDARGS = --build-arg VERSION=${MAJOR}.${MINOR}.${PATCH}
88

9-
.PHONY: nothing
10-
nothing:
11-
@echo "No job given."
12-
@exit 1
13-
14-
.PHONY: all
15-
all: alpine3.9
16-
17-
.PHONY: all-latest
18-
all-latest: alpine3.9-latest
19-
20-
.PHONY: alpine3.9
21-
alpine3.9:
9+
build:
2210
docker build ${BUILDARGS} ${TAGLIST} .
2311

24-
.PHONY: alpine3.9-latest
25-
alpine3.9-latest:
26-
docker build ${BUILDARGS} -t ${TAG}:latest ${TAGLIST} .
12+
latest: TAGLIST := -t ${TAG}:latest ${TAGLIST}
13+
latest: build
2714

28-
.PHONY: clean
2915
clean:
30-
docker rmi -f $(shell docker images -aq ${TAG})
16+
docker rmi -f $(shell docker images -qt ${TAG})
3117

32-
.PHONY: push
3318
push:
34-
docker push $(TAG)
19+
docker push ${TAG}
20+
21+
.PHONY: build latest clean push

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Configuration for this daemon is read from the current environment. Available co
8080
| LDAPAUTHD_USER | User the daemon should be run with. | nobody |
8181
| LDAPAUTHD_REALM | String to set in WWW-Authenticate. | Authorization required |
8282
| LDAPAUTHD_SESSION_STORAGE | Choose session storage backend. Available: memcached | memcached |
83+
| LDAPAUTHD_SESSION_PREFIX | Key prefix to avoid collisions inside memcache when running multiple ldapauthd instances | |
8384
| LDAPAUTHD_SESSION_DOMAIN | Set domain for your session cookie. | |
8485
| LDAPAUTHD_SESSION_HOST | Host address of your session storage. | localhost:11211 |
8586
| LDAPAUTHD_SESSION_TTL | Maximum TTL for sessions in seconds. | 900 |

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ services:
1919
#- LDAPAUTHD_REALM=Authorization required
2020
# Choose session storage backend. Available: memcached
2121
#- LDAPAUTHD_SESSION_STORAGE=memcached
22+
# Key prefix to avoid collisions inside memcache when running multiple ldapauthd instances
23+
#- LDAPAUTHD_SESSION_PREFIX=
2224
# Set domain for your session cookie.
2325
#- LDAPAUTHD_SESSION_DOMAIN=
2426
# Host address of your session storage.

ldapauthd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __init__(self):
230230
"connect_timeout": 10,
231231
"timeout": 10,
232232
"no_delay": True,
233-
"key_prefix": b"lad_sess_",
233+
"key_prefix": b"lad_sess_" + os.getenv("LDAPAUTHD_SESSION_PREFIX", "").encode("utf8"),
234234
}
235235
self._client = base.Client(host, **_opts)
236236
self._retryCount = int(os.getenv("LDAPAUTHD_SESSION_RETRY", 1))

0 commit comments

Comments
 (0)