From bf967bdf12e0430d3b6c2ab8d1b4c7faa6316626 Mon Sep 17 00:00:00 2001 From: jweatherford Date: Mon, 15 Mar 2021 11:58:07 -0400 Subject: [PATCH 1/3] inital commit of dex 2.10 --- Dockerfile | 48 +++++++++ LICENSE | 202 +++++++++++++++++++++++++++++++++++ README.md | 122 ++++++++++++++++++++- hardening_manifest.yaml | 67 ++++++++++++ scripts/config.docker.yaml | 48 +++++++++ scripts/docker-entrypoint.sh | 32 ++++++ 6 files changed, 517 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 hardening_manifest.yaml create mode 100644 scripts/config.docker.yaml create mode 100644 scripts/docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..86142ea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +ARG BASE_REGISTRY=registry1.dso.mil +ARG BASE_IMAGE=ironbank/redhat/ubi/ubi8 +ARG BASE_TAG=8.3 + +FROM coreos/dex:v2.10.0 as base + +FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} + +COPY musl-libc.rpm musl-filesystem.rpm / + +RUN dnf update && dnf upgrade -y && \ + dnf -y localinstall --nogpgcheck musl-libc.rpm musl-filesystem.rpm && \ + dnf clean all && \ + rm -f musl-libc.rpm && \ + rm -rf /var/cache/dnf && \ + groupadd -g 1001 dex && \ + useradd -r -u 1001 -m -s /sbin/nologin -g dex dex + +WORKDIR / + +COPY --from=base /usr/local/bin/dex /usr/local/bin/dex +COPY gomplate /usr/local/bin/gomplate +COPY --from=base /web /web + +RUN mkdir -p /var/dex && \ + chown -R dex:dex /var/dex && \ + chmod a+x /usr/local/bin/gomplate && \ + chmod a+x /usr/local/bin/dex && \ + mkdir -p /etc/dex + +COPY scripts/config.docker.yaml /etc/dex/ +RUN chown -R dex:dex /etc/dex && \ + chown -R dex:dex /web + + +EXPOSE 5556 5558 + +HEALTHCHECK --start-period=1s --interval=10s \ + CMD curl -fs http://127.0.0.1:5556/healthz || curl -fsk https://127.0.0.1:5556/healthz || exit 1 + +COPY scripts/docker-entrypoint.sh /entrypoint.sh +RUN chown dex:dex /entrypoint.sh && chmod u+x /entrypoint.sh + +USER dex + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["dex", "serve", "/etc/dex/config.docker.yaml"] + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 5dc6fa6..781acbc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,121 @@ -# +# dex - A federated OpenID Connect provider -Project template for all Iron Bank container repositories. \ No newline at end of file +[![Travis](https://api.travis-ci.org/coreos/dex.svg)](https://travis-ci.org/coreos/dex) +[![GoDoc](https://godoc.org/github.com/coreos/dex?status.svg)](https://godoc.org/github.com/coreos/dex) +[![Go Report Card](https://goreportcard.com/badge/github.com/coreos/dex)](https://goreportcard.com/report/github.com/coreos/dex) + +![logo](Documentation/logos/dex-horizontal-color.png) + +Dex is an identity service that uses [OpenID Connect][openid-connect] to drive authentication for other apps. + +Dex acts as a portal to other identity providers through ["connectors."](#connectors) This lets dex defer authentication to LDAP servers, SAML providers, or established identity providers like GitHub, Google, and Active Directory. Clients write their authentication logic once to talk to dex, then dex handles the protocols for a given backend. + +## ID Tokens + +ID Tokens are an OAuth2 extension introduced by OpenID Connect and dex's primary feature. ID Tokens are [JSON Web Tokens][jwt-io] (JWTs) signed by dex and returned as part of the OAuth2 response that attest to the end user's identity. An example JWT might look like: + +``` +eyJhbGciOiJSUzI1NiIsImtpZCI6IjlkNDQ3NDFmNzczYjkzOGNmNjVkZDMyNjY4NWI4NjE4MGMzMjRkOTkifQ.eyJpc3MiOiJodHRwOi8vMTI3LjAuMC4xOjU1NTYvZGV4Iiwic3ViIjoiQ2djeU16UXlOelE1RWdabmFYUm9kV0kiLCJhdWQiOiJleGFtcGxlLWFwcCIsImV4cCI6MTQ5Mjg4MjA0MiwiaWF0IjoxNDkyNzk1NjQyLCJhdF9oYXNoIjoiYmk5NmdPWFpTaHZsV1l0YWw5RXFpdyIsImVtYWlsIjoiZXJpYy5jaGlhbmdAY29yZW9zLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJncm91cHMiOlsiYWRtaW5zIiwiZGV2ZWxvcGVycyJdLCJuYW1lIjoiRXJpYyBDaGlhbmcifQ.OhROPq_0eP-zsQRjg87KZ4wGkjiQGnTi5QuG877AdJDb3R2ZCOk2Vkf5SdP8cPyb3VMqL32G4hLDayniiv8f1_ZXAde0sKrayfQ10XAXFgZl_P1yilkLdknxn6nbhDRVllpWcB12ki9vmAxklAr0B1C4kr5nI3-BZLrFcUR5sQbxwJj4oW1OuG6jJCNGHXGNTBTNEaM28eD-9nhfBeuBTzzO7BKwPsojjj4C9ogU4JQhGvm_l4yfVi0boSx8c0FX3JsiB0yLa1ZdJVWVl9m90XmbWRSD85pNDQHcWZP9hR6CMgbvGkZsgjG32qeRwUL_eNkNowSBNWLrGNPoON1gMg +``` + +ID Tokens contains standard claims assert which client app logged the user in, when the token expires, and the identity of the user. + +```json +{ + "iss": "http://127.0.0.1:5556/dex", + "sub": "CgcyMzQyNzQ5EgZnaXRodWI", + "aud": "example-app", + "exp": 1492882042, + "iat": 1492795642, + "at_hash": "bi96gOXZShvlWYtal9Eqiw", + "email": "jane.doe@coreos.com", + "email_verified": true, + "groups": [ + "admins", + "developers" + ], + "name": "Jane Doe" +} +``` + +Because these tokens are signed by dex and [contain standard-based claims][standard-claims] other services can consume them as service-to-service credentials. Systems that can already consume OpenID Connect ID Tokens issued by dex include: + +* [Kubernetes][kubernetes] +* [AWS STS][aws-sts] + +For details on how to request or validate an ID Token, see [_"Writing apps that use dex"_][using-dex]. + +## Kubernetes + dex + +Dex's main production use is as an auth-N addon in CoreOS's enterprise Kubernetes solution, [Tectonic][tectonic]. Dex runs natively on top of any Kubernetes cluster using Third Party Resources and can drive API server authentication through the OpenID Connect plugin. Clients, such as the [Tectonic Console][tectonic-console] and `kubectl`, can act on behalf users who can login to the cluster through any identity provider dex supports. + +More docs for running dex as a Kubernetes authenticator can be found [here](Documentation/kubernetes.md). + +## Connectors + +When a user logs in through dex, the user's identity is usually stored in another user-management system: a LDAP directory, a GitHub org, etc. Dex acts a shim between a client app and the upstream identity provider. The client only needs to understand OpenID Connect to query dex, while dex implements an array of protocols for querying other user-management systems. + +![](Documentation/img/dex-flow.png) + +A "connector" is a strategy used by dex for authenticating a user against another identity provider. Dex implements connectors that target specific platforms such as GitHub, LinkedIn, and Microsoft as well as established protocols like LDAP and SAML. + +Depending on the connectors limitations in protocols can prevent dex from issuing [refresh tokens][scopes] or returning [group membership][scopes] claims. For example, because SAML doesn't provide a non-interactive way to refresh assertions, if a user logs in through the SAML connector dex won't issue a refresh token to its client. Refresh token support is required for clients that require offline access, such as `kubectl`. + +Dex implements the following connectors: + +| Name | supports refresh tokens | supports groups claim | status | notes | +| ---- | ----------------------- | --------------------- | ------ | ----- | +| [LDAP](Documentation/connectors/ldap.md) | yes | yes | stable | | +| [GitHub](Documentation/connectors/github.md) | yes | yes | stable | | +| [SAML 2.0](Documentation/connectors/saml.md) | no | yes | stable | +| [GitLab](Documentation/connectors/gitlab.md) | yes | yes | beta | | +| [OpenID Connect](Documentation/connectors/oidc.md) | yes | no ([#1065][issue-1065]) | beta | Includes Google, Salesforce, Azure, etc. | +| [LinkedIn](Documentation/connectors/linkedin.md) | yes | no | beta | | +| [Microsoft](Documentation/connectors/microsoft.md) | yes | yes | beta | | +| [AuthProxy](Documentation/connectors/authproxy.md) | no | no | alpha | Authentication proxies such as Apache2 mod_auth, etc. | + +Stable, beta, and alpha are defined as: + +* Stable: well tested, in active use, and will not change in backward incompatible ways. +* Beta: tested and unlikely to change in backward incompatible ways. +* Alpha: may be untested by core maintainers and is subject to change in backward incompatible ways. + +All changes or deprecations of connector features will be announced in the [release notes][release-notes]. + +## Documentation + +* [Getting started](Documentation/getting-started.md) +* [Intro to OpenID Connect](Documentation/openid-connect.md) +* [Writing apps that use dex][using-dex] +* [What's new in v2](Documentation/v2.md) +* [Custom scopes, claims, and client features](Documentation/custom-scopes-claims-clients.md) +* [Storage options](Documentation/storage.md) +* [gRPC API](Documentation/api.md) +* [Using Kubernetes with dex](Documentation/kubernetes.md) +* Client libraries + * [Go][go-oidc] + +## Reporting a security vulnerability + +Due to their public nature, GitHub and mailing lists are NOT appropriate places for reporting vulnerabilities. Please refer to CoreOS's [security disclosure][disclosure] process when reporting issues that may be security related. + +## Getting help + +* For feature requests and bugs, file an [issue][issues]. +* For general discussion about both using and developing dex, join the [dex-dev][dex-dev] mailing list. + +[openid-connect]: https://openid.net/connect/ +[standard-claims]: https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims +[scopes]: Documentation/custom-scopes-claims-clients.md#scopes +[using-dex]: Documentation/using-dex.md +[jwt-io]: https://jwt.io/ +[kubernetes]: http://kubernetes.io/docs/admin/authentication/#openid-connect-tokens +[aws-sts]: https://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html +[tectonic]: https://tectonic.com/ +[tectonic-console]: https://tectonic.com/enterprise/docs/latest/usage/index.html#tectonic-console +[go-oidc]: https://github.com/coreos/go-oidc +[issue-1065]: https://github.com/coreos/dex/issues/1065 +[release-notes]: https://github.com/coreos/dex/releases +[issues]: https://github.com/coreos/dex/issues +[dex-dev]: https://groups.google.com/forum/#!forum/dex-dev +[disclosure]: https://coreos.com/security/disclosure/ diff --git a/hardening_manifest.yaml b/hardening_manifest.yaml new file mode 100644 index 0000000..41b1343 --- /dev/null +++ b/hardening_manifest.yaml @@ -0,0 +1,67 @@ +--- +apiVersion: v1 + +# The repository name in registry1, excluding /ironbank/ +name: "opensource/kubeflow-1.0.2/kdef/coreos/dex-v2.10.0" + +# List of tags to push for the repository in registry1 +# The most specific version should be the first tag and will be shown +# on ironbank.dsop.io +tags: +- "v2.10.0" +- "latest" + +# Build args passed to Dockerfile ARGs +args: + BASE_IMAGE: "redhat/ubi/ubi8" + BASE_TAG: "8.3" + +# Docker image labels +labels: + org.opencontainers.image.title: "dex-v2.10.0" + # Human-readable description of the software packaged in the image + org.opencontainers.image.description: "Dex is an identity service that uses OpenID Connect to drive authentication for other apps." + # License(s) under which contained software is distributed + org.opencontainers.image.licenses: "Apache-2.0" + # URL to find more information on the image + org.opencontainers.image.url: "https://github.com/dexidp/dex/tree/v2.10.x" + # Name of the distributing entity, organization or individual + org.opencontainers.image.vendor: "opensource" + org.opencontainers.image.version: "v2.10.0" + # Keywords to help with search (ex. "cicd,gitops,golang") + mil.dso.ironbank.image.keywords: "golang,connector,OIDC,openid,OAuth 2.0,auth" + # This value can be "opensource" or "commercial" + mil.dso.ironbank.image.type: "opensource" + # Product the image belongs to for grouping multiple images + mil.dso.ironbank.product.name: "kubeflow" + +# List of resources to make available to the offline build context +resources: + - url: "docker://quay.io/coreos/dex@sha256:218f898d8f0cbbb190c76404bb13d599ac64c64384a999472e2278ed4e34496f" + tag: "coreos/dex:v2.10.0" + - url: "docker://docker.io/golang@sha256:10f7c75218a877534098e16f44e2fadf5b0a9101859c7caa57c0a65ebc8945bc" + tag: "golang:1.16.0" + - file: musl-libc.rpm + url: https://forensics.cert.org/centos/cert/8/x86_64/musl-libc-1.2.1-1.el8.x86_64.rpm + validation: + type: sha256 + value: 8d08c7481136c1ad45cb1d8fd924392a76c542eddbc9979881a76b2f86e03c37 + - file: musl-filesystem.rpm + url: https://forensics.cert.org/centos/cert/8/x86_64/musl-filesystem-1.2.1-1.el8.x86_64.rpm + validation: + type: sha256 + value: 1bdaedba326dbcbc0f81fb3fd249f514e1d88428d8f329da6997b5258625b9c3 + - file: gomplate + url: https://github.com/hairyhenderson/gomplate/releases/download/v3.9.0/gomplate_linux-amd64 + validation: + type: sha256 + value: 7dbabe30095f822ec38f5f70711ff121c26e588227da4cc05208417cfaf929cd + +# List of project maintainers +maintainers: +- email: "jweatherford@oteemo.com" + # The name of the current container owner + name: "Jeff Weatherford" + # The gitlab username of the current container owner + username: "jweatherford" + cht_member: true diff --git a/scripts/config.docker.yaml b/scripts/config.docker.yaml new file mode 100644 index 0000000..c5d2a47 --- /dev/null +++ b/scripts/config.docker.yaml @@ -0,0 +1,48 @@ +{{- /* NOTE: This configuration file is an example and exists only for development purposes. */ -}} +{{- /* To find more about gomplate formatting, please visit its documentation site - https://docs.gomplate.ca/ */ -}} +issuer: {{ getenv "DEX_ISSUER" "http://127.0.0.1:5556/dex" }} + +storage: + type: sqlite3 + config: + file: {{ getenv "DEX_STORAGE_SQLITE3_CONFIG_FILE" "/var/dex/dex.db" }} + +web: +{{- if getenv "DEX_WEB_HTTPS" "" }} + https: {{ .Env.DEX_WEB_HTTPS }} + tlsKey: {{ getenv "DEX_WEB_TLS_KEY" | required "$DEX_WEB_TLS_KEY in case of web.https is enabled" }} + tlsCert: {{ getenv "DEX_WEB_TLS_CERT" | required "$DEX_WEB_TLS_CERT in case of web.https is enabled" }} +{{- end }} + http: {{ getenv "DEX_WEB_HTTP" "0.0.0.0:5556" }} + +{{- if getenv "DEX_TELEMETRY_HTTP" }} +telemetry: + http: {{ .Env.DEX_TELEMETRY_HTTP }} +{{- end }} + +expiry: + deviceRequests: {{ getenv "DEX_EXPIRY_DEVICE_REQUESTS" "5m" }} + signingKeys: {{ getenv "DEX_EXPIRY_SIGNING_KEYS" "6h" }} + idTokens: {{ getenv "DEX_EXPIRY_ID_TOKENS" "24h" }} + authRequests: {{ getenv "DEX_EXPIRY_AUTH_REQUESTS" "24h" }} + +logger: + level: {{ getenv "DEX_LOG_LEVEL" "info" }} + format: {{ getenv "DEX_LOG_FORMAT" "text" }} + +oauth2: + responseTypes: {{ getenv "DEX_OAUTH2_RESPONSE_TYPES" "[code]" }} + skipApprovalScreen: {{ getenv "DEX_OAUTH2_SKIP_APPROVAL_SCREEN" "false" }} + alwaysShowLoginScreen: {{ getenv "DEX_OAUTH2_ALWAYS_SHOW_LOGIN_SCREEN" "false" }} +{{- if getenv "DEX_OAUTH2_PASSWORD_CONNECTOR" "" }} + passwordConnector: {{ .Env.DEX_OAUTH2_PASSWORD_CONNECTOR }} +{{- end }} + +enablePasswordDB: {{ getenv "DEX_ENABLE_PASSWORD_DB" "true" }} + +connectors: +{{- if getenv "DEX_CONNECTORS_ENABLE_MOCK" }} +- type: mockCallback + id: mock + name: Example +{{- end }} diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh new file mode 100644 index 0000000..bb12d31 --- /dev/null +++ b/scripts/docker-entrypoint.sh @@ -0,0 +1,32 @@ +#!/bin/sh -e + +### Usage: /docker-entrypoint.sh +function main() { + executable=$1 + command=$2 + + if [[ "$executable" != "dex" ]] && [[ "$executable" != "$(which dex)" ]]; then + exec $@ + fi + + if [[ "$command" != "serve" ]]; then + exec $@ + fi + + for tpl_candidate in $@ ; do + case "$tpl_candidate" in + *.tpl|*.tmpl|*.yaml) + tmp_file=$(mktemp /tmp/dex.config.yaml-XXXXXX) + gomplate -f "$tpl_candidate" -o "$tmp_file" + + args="${args} ${tmp_file}" + ;; + *) + args="${args} ${tpl_candidate}" + ;; + esac + done + exec $args +} + +main $@ -- GitLab From 9c7731642f1c4046cf634bc3736a1e52f1a62883 Mon Sep 17 00:00:00 2001 From: jweatherford Date: Mon, 15 Mar 2021 12:00:45 -0400 Subject: [PATCH 2/3] error in manifest --- hardening_manifest.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardening_manifest.yaml b/hardening_manifest.yaml index 41b1343..3ccb264 100644 --- a/hardening_manifest.yaml +++ b/hardening_manifest.yaml @@ -46,12 +46,12 @@ resources: validation: type: sha256 value: 8d08c7481136c1ad45cb1d8fd924392a76c542eddbc9979881a76b2f86e03c37 - - file: musl-filesystem.rpm + - filename: musl-filesystem.rpm url: https://forensics.cert.org/centos/cert/8/x86_64/musl-filesystem-1.2.1-1.el8.x86_64.rpm validation: type: sha256 value: 1bdaedba326dbcbc0f81fb3fd249f514e1d88428d8f329da6997b5258625b9c3 - - file: gomplate + - filename: gomplate url: https://github.com/hairyhenderson/gomplate/releases/download/v3.9.0/gomplate_linux-amd64 validation: type: sha256 -- GitLab From 378f9fdaa90aa9bea9ef991c23331b6a0cdf4a30 Mon Sep 17 00:00:00 2001 From: jweatherford Date: Mon, 15 Mar 2021 12:10:52 -0400 Subject: [PATCH 3/3] error in manifest --- hardening_manifest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardening_manifest.yaml b/hardening_manifest.yaml index 3ccb264..c45d55f 100644 --- a/hardening_manifest.yaml +++ b/hardening_manifest.yaml @@ -41,7 +41,7 @@ resources: tag: "coreos/dex:v2.10.0" - url: "docker://docker.io/golang@sha256:10f7c75218a877534098e16f44e2fadf5b0a9101859c7caa57c0a65ebc8945bc" tag: "golang:1.16.0" - - file: musl-libc.rpm + - filename: musl-libc.rpm url: https://forensics.cert.org/centos/cert/8/x86_64/musl-libc-1.2.1-1.el8.x86_64.rpm validation: type: sha256 -- GitLab