Fix #6 checking for groups
This commit is contained in:
parent
e273f12a92
commit
c60463dd0b
10
Dockerfile
10
Dockerfile
|
@ -2,13 +2,15 @@ FROM golang:alpine
|
|||
|
||||
COPY . /go/src/github.com/tiagoapimenta/nginx-ldap-auth
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
RUN cd /go/src/github.com/tiagoapimenta/nginx-ldap-auth && \
|
||||
apk add --no-cache git && \
|
||||
go get -u gopkg.in/yaml.v2 && \
|
||||
go get -u gopkg.in/ldap.v2 && \
|
||||
go build -ldflags='-s -w' -v -o /go/bin/nginx-ldap-auth ./main
|
||||
go build -a -x -ldflags='-s -w -extldflags -static' -v -o /go/bin/nginx-ldap-auth ./main
|
||||
|
||||
FROM alpine
|
||||
FROM scratch
|
||||
|
||||
MAINTAINER Tiago A. Pimenta <tiagoapimenta@gmail.com>
|
||||
|
||||
|
@ -20,6 +22,6 @@ VOLUME /etc/nginx-ldap-auth
|
|||
|
||||
EXPOSE 5555
|
||||
|
||||
USER nobody
|
||||
USER 65534:65534
|
||||
|
||||
CMD [ "nginx-ldap-auth", "--config", "/etc/nginx-ldap-auth/config.yaml" ]
|
||||
CMD [ "/usr/local/bin/nginx-ldap-auth", "--config", "/etc/nginx-ldap-auth/config.yaml" ]
|
||||
|
|
2
build
2
build
|
@ -3,7 +3,7 @@
|
|||
set -e
|
||||
|
||||
base='docker.io/tpimenta/nginx-ldap-auth'
|
||||
version='v1.0.3'
|
||||
version='v1.0.4'
|
||||
image="$base:$version"
|
||||
|
||||
atexit() {
|
||||
|
|
|
@ -8,22 +8,22 @@ kind: Role
|
|||
metadata:
|
||||
name: nginx-ldap-auth
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
- "nginx-ldap-auth"
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- "nginx-ldap-auth"
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
- "nginx-ldap-auth"
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
resourceNames:
|
||||
- "nginx-ldap-auth"
|
||||
verbs:
|
||||
- get
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: RoleBinding
|
||||
|
@ -66,12 +66,12 @@ spec:
|
|||
spec:
|
||||
serviceAccountName: nginx-ldap-auth
|
||||
containers:
|
||||
- image: docker.io/tpimenta/nginx-ldap-auth:v1.0.3
|
||||
- image: docker.io/tpimenta/nginx-ldap-auth:v1.0.4
|
||||
name: nginx-ldap-auth
|
||||
command:
|
||||
- "nginx-ldap-auth"
|
||||
- "--config"
|
||||
- "/etc/nginx-ldap-auth/config.yaml"
|
||||
- "/usr/local/bin/nginx-ldap-auth"
|
||||
- "--config"
|
||||
- "/etc/nginx-ldap-auth/config.yaml"
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 5555
|
||||
|
|
8
k8s.yaml
8
k8s.yaml
|
@ -26,12 +26,12 @@ spec:
|
|||
app: nginx-ldap-auth
|
||||
spec:
|
||||
containers:
|
||||
- image: docker.io/tpimenta/nginx-ldap-auth:v1.0.3
|
||||
- image: docker.io/tpimenta/nginx-ldap-auth:v1.0.4
|
||||
name: nginx-ldap-auth
|
||||
command:
|
||||
- "nginx-ldap-auth"
|
||||
- "--config"
|
||||
- "/etc/nginx-ldap-auth/config.yaml"
|
||||
- "/usr/local/bin/nginx-ldap-auth"
|
||||
- "--config"
|
||||
- "/etc/nginx-ldap-auth/config.yaml"
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 5555
|
||||
|
|
|
@ -54,7 +54,7 @@ func (p *Service) validate(username, password string) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
if ok || p.required == nil || len(p.required) == 0 {
|
||||
if !ok || p.required == nil || len(p.required) == 0 {
|
||||
return err == nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -41,4 +41,4 @@ docker run \
|
|||
-v '/tmp/config.yaml:/etc/nginx-ldap-auth/config.yaml:ro' \
|
||||
--name ldap-test-client \
|
||||
-d \
|
||||
docker.io/tpimenta/nginx-ldap-auth:v1.0.3
|
||||
docker.io/tpimenta/nginx-ldap-auth:v1.0.4
|
||||
|
|
Reference in a new issue