mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 02:46:30 +02:00
Merge pull request #139 from travisgroth/feature/viper-config
deployment: expose config file interface in docker images
This commit is contained in:
commit
794b7996db
10 changed files with 28 additions and 16 deletions
|
@ -15,8 +15,11 @@ RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
# build
|
# build
|
||||||
RUN make
|
RUN make
|
||||||
|
RUN touch /config.yaml
|
||||||
|
|
||||||
FROM gcr.io/distroless/static
|
FROM gcr.io/distroless/static
|
||||||
WORKDIR /pomerium
|
WORKDIR /pomerium
|
||||||
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
||||||
CMD ["/bin/pomerium"]
|
COPY --from=build /config.yaml /pomerium/config.yaml
|
||||||
|
ENTRYPOINT [ "/bin/pomerium" ]
|
||||||
|
CMD ["-config","/pomerium/config.yaml"]
|
||||||
|
|
|
@ -10,8 +10,11 @@ RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
# build
|
# build
|
||||||
RUN make build
|
RUN make build
|
||||||
|
RUN touch /config.yaml
|
||||||
|
|
||||||
FROM gcr.io/distroless/static
|
FROM gcr.io/distroless/static
|
||||||
WORKDIR /pomerium
|
WORKDIR /pomerium
|
||||||
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
||||||
CMD ["/bin/pomerium"]
|
COPY --from=build /config.yaml /pomerium/config.yaml
|
||||||
|
ENTRYPOINT [ "/bin/pomerium" ]
|
||||||
|
CMD ["-config","/pomerium/config.yaml"]
|
|
@ -10,8 +10,11 @@ RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
# build
|
# build
|
||||||
RUN make build
|
RUN make build
|
||||||
|
RUN touch /config.yaml
|
||||||
|
|
||||||
FROM gcr.io/distroless/static
|
FROM gcr.io/distroless/static
|
||||||
WORKDIR /pomerium
|
WORKDIR /pomerium
|
||||||
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
||||||
CMD ["/bin/pomerium"]
|
COPY --from=build /config.yaml /pomerium/config.yaml
|
||||||
|
ENTRYPOINT [ "/bin/pomerium" ]
|
||||||
|
CMD ["-config","/pomerium/config.yaml"]
|
|
@ -9,8 +9,11 @@ RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
# build
|
# build
|
||||||
RUN make build
|
RUN make build
|
||||||
|
RUN touch /config.yaml
|
||||||
|
|
||||||
FROM gcr.io/distroless/static
|
FROM gcr.io/distroless/static
|
||||||
WORKDIR /pomerium
|
WORKDIR /pomerium
|
||||||
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
||||||
CMD ["/bin/pomerium"]
|
COPY --from=build /config.yaml /pomerium/config.yaml
|
||||||
|
ENTRYPOINT [ "/bin/pomerium" ]
|
||||||
|
CMD ["-config","/pomerium/config.yaml"]
|
|
@ -26,7 +26,8 @@ func TestNew(t *testing.T) {
|
||||||
{"bad shared secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
{"bad shared secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
||||||
{"really bad shared secret", "sup", policies, true},
|
{"really bad shared secret", "sup", policies, true},
|
||||||
{"validation error, short secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
{"validation error, short secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
||||||
{"nil options", "", []policy.Policy{}, true}, // special case
|
{"nil options", "", []policy.Policy{}, true}, // special case
|
||||||
|
{"missing policies", "gXK6ggrlIW2HyKyUF9rUO4azrDgxhDPWqw9y+lJU7B8=", []policy.Policy{}, true}, // special case
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
|
@ -22,9 +22,9 @@ Remember to set your identity provider settings and to generate new secret keys!
|
||||||
- Great for testing Pomerium
|
- Great for testing Pomerium
|
||||||
- Routes default to hosted version of httpbin.org
|
- Routes default to hosted version of httpbin.org
|
||||||
|
|
||||||
Customize for your identity provider and run `source ./env && ./bin/pomerium`
|
Customize for your identity provider and run `./bin/pomerium -config config.yaml`
|
||||||
|
|
||||||
<<< @/env.example
|
<<< @/config.example.yaml
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,10 @@ services:
|
||||||
- CERTIFICATE_KEY_FILE=privkey.pem
|
- CERTIFICATE_KEY_FILE=privkey.pem
|
||||||
- AUTHENTICATE_SERVICE_URL=https://authenticate.corp.beyondperimeter.com
|
- AUTHENTICATE_SERVICE_URL=https://authenticate.corp.beyondperimeter.com
|
||||||
- AUTHORIZE_SERVICE_URL=https://authorize.corp.beyondperimeter.com
|
- AUTHORIZE_SERVICE_URL=https://authorize.corp.beyondperimeter.com
|
||||||
- POLICY_FILE=./policy.yaml
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./cert.pem:/pomerium/cert.pem:ro
|
- ./cert.pem:/pomerium/cert.pem:ro
|
||||||
- ./privkey.pem:/pomerium/privkey.pem:ro
|
- ./privkey.pem:/pomerium/privkey.pem:ro
|
||||||
- ./policy.example.yaml:/pomerium/policy.yaml:ro
|
- ./config-policy-only.yaml:/pomerium/config.yaml:ro
|
||||||
ports:
|
ports:
|
||||||
- 443:443
|
- 443:443
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./cert.pem:/pomerium/cert.pem:ro
|
- ./cert.pem:/pomerium/cert.pem:ro
|
||||||
- ./privkey.pem:/pomerium/privkey.pem:ro
|
- ./privkey.pem:/pomerium/privkey.pem:ro
|
||||||
- ./policy.example.yaml:/pomerium/policy.yaml:ro
|
- ./config-policy-only.yaml:/pomerium/config.yaml:ro
|
||||||
expose:
|
expose:
|
||||||
- 443
|
- 443
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./cert.pem:/pomerium/cert.pem:ro
|
- ./cert.pem:/pomerium/cert.pem:ro
|
||||||
- ./privkey.pem:/pomerium/privkey.pem:ro
|
- ./privkey.pem:/pomerium/privkey.pem:ro
|
||||||
- ./policy.example.yaml:/pomerium/policy.yaml:ro
|
- ./config-policy-only.yaml:/pomerium/config.yaml:ro
|
||||||
expose:
|
expose:
|
||||||
- 443
|
- 443
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ Edit the `docker-compose.yml` to match your specific [identity provider]'s setti
|
||||||
|
|
||||||
### Policy configuration
|
### Policy configuration
|
||||||
|
|
||||||
Next, create a policy configuration file which will contain the routes you want to proxy, and their desired access-controls. For example, `policy.example.yaml`:
|
Next, create a configuration file which will contain the routes you want to proxy, and their desired access-controls. For example, `config-policy-only.yaml`:
|
||||||
|
|
||||||
<<< @/policy.example.yaml
|
<<< @/config-policy-only.yaml
|
||||||
|
|
||||||
### Certificates
|
### Certificates
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ kubectl create secret generic -n pomerium certificate-key --from-literal=certifi
|
||||||
echo "=> load TLS to ingress"
|
echo "=> load TLS to ingress"
|
||||||
kubectl create secret tls -n pomerium pomerium-tls --key privkey.pem --cert cert.pem
|
kubectl create secret tls -n pomerium pomerium-tls --key privkey.pem --cert cert.pem
|
||||||
|
|
||||||
echo "=> initiliaze a configmap setting for POLICY frompolicy.example.yaml"
|
echo "=> initiliaze a configmap setting for POLICY from config-policy-only.yaml"
|
||||||
kubectl create configmap -n pomerium policy --from-literal=policy=$(cat policy.example.yaml | base64)
|
kubectl create configmap -n pomerium policy --from-literal=policy=$(cat config-policy-only.yaml | base64)
|
||||||
|
|
||||||
echo "=> settingidp-client-secret, you changed this right? :)"
|
echo "=> settingidp-client-secret, you changed this right? :)"
|
||||||
exit 1 # comment out or delete this line once you change the following two settings
|
exit 1 # comment out or delete this line once you change the following two settings
|
||||||
|
|
Loading…
Add table
Reference in a new issue