mirror of
https://github.com/PurpleComputing/scim-examples.git
synced 2026-06-11 07:10:30 +01:00
Merge pull request #3 from 1Password/connor/docker
Added instructions for deploying the SCIM bridge using Docker
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
Here you can find configuration files and best practice instructions for deploying the 1Password SCIM Bridge on various public and priavte clouds.
|
||||
|
||||
To deply on Kubernetes, read the [Kubernetes example](https://github.com/1Password/scim-examples/tree/master/kubernetes)
|
||||
To streamline your setup, it is suggested to have Docker installed on your local machine.
|
||||
|
||||
More deployment examples are coming soon, including AWS, Docker Compose/Swarm, and bare metal.
|
||||
To deply on Kubernetes, read the [Kubernetes example](https://github.com/1Password/scim-examples/tree/master/kubernetes)
|
||||
To deply with Docker Compose, read the [Docker example](https://github.com/1Password/scim-examples/tree/master/docker)
|
||||
|
||||
More deployment examples are coming soon, including AWS and bare metal.
|
||||
32
docker-compose/README.md
Normal file
32
docker-compose/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Deploying the 1Password SCIM Bridge using Docker Compose
|
||||
|
||||
This example describes the simplest method of deploying the 1Password SCIM bridge, using Docker Compose. These instructions require a remote Docker host be set up and configured to be accessed by the Docker CLI.
|
||||
|
||||
Note that this deployment strategy is very useful for testing, but it is not reccomended for use in a production environment. The scimsession file is passed into the container via an environment variable, which is less secure than Docker Swarm secrets or Kubernetes secrets, both of which are supported, and reccomended.
|
||||
|
||||
## Create your DNS record
|
||||
|
||||
The 1Password SCIM bridge requires SSL/TLS in order to communicate with your IdP. You must create a DNS record that points to your Docker node. _Do not attempt to perform a provisioning sync before the DNS records have been propogated_. The record must exist and the SCIM bridge server must be running in order for LetsEncrypt to issue a certificate.
|
||||
|
||||
## Create your scimsession file
|
||||
|
||||
Use the [create-session-file.sh](https://github.com/1Password/scim-examples/tree/master/session) script while connected to the Docker host on your local machine to create a scimsession file. This script uses a Docker container to run the `op-scim init` command and writes the scimsession file back to your local machine using a mounted volume. Your bearer token will be printed to the console. Save your bearer token, as it will be needed to authenticate with your IdP.
|
||||
|
||||
The scimsession file is equivalent to your Master Password and Secret Key when combined with the bearer token, therefore they should never be stored in the same place.
|
||||
|
||||
Example:
|
||||
```
|
||||
create-session-file.sh
|
||||
[account sign-in]
|
||||
Bearer token: jafewnqrrupcnoiqj0829fe209fnsoudbf02efsdo
|
||||
```
|
||||
|
||||
## Deploy the SCIM bridge
|
||||
|
||||
Once your scimsession file has been created, copy it into this directory (next to docker-compose.yml), as we need to populate some ENV variables in the container. `generate-env.sh` will create a `scim.env` file, allowing docker-compose to pass the scimsession file into the container without writing it to the container filesystem, leading to insecure storage of the file. The scimsession is base64 encoded before being put into the .env file.
|
||||
|
||||
Next, edit `docker-compose.yml`, replacing `{YOUR-DOMAIN-HERE}` with the domain name indicated by the DNS record created for your SCIM bridge. This will configure LetsEncrypt to automatically issue a certificate for your bridge.
|
||||
|
||||
Running `docker-compose up --build` will now create a container from the `onepassword/scim` image. A redis container will also be started automatically to be used by the SCIM bridge. _After the DNS record has been propogated_, you can continue setting up your IdP with the SCIM bridge Administration Guide while monitoring the logs from the bridge on your local machine.
|
||||
|
||||
Once you have tested the configuration, the bridge can be exited using ctrl/cmd-c, and restarted in daemon mode using `docker-compose up -d, or deployed for production use with Docker Swarm or Kubernetes. You can access logs using `docker-compose logs` at any point in the future.
|
||||
14
docker-compose/docker-compose.yml
Normal file
14
docker-compose/docker-compose.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
scim:
|
||||
image: onepassword/scim:v0.4.4
|
||||
ports:
|
||||
- "80:8080"
|
||||
- "443:8443"
|
||||
links:
|
||||
- redis
|
||||
entrypoint: ["/op-scim/op-scim", "--letsencrypt-domain={YOUR-DOMAIN-HERE}"]
|
||||
env_file: scim.env
|
||||
redis:
|
||||
image: redis:latest
|
||||
8
docker-compose/generate-env.sh
Normal file
8
docker-compose/generate-env.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script generates a file called `scim.env` using the contents of a scimsession file in the PWD.
|
||||
# This env file is used to populate the scimsession env var in the container to prevent copying the sensitive file into a container layer.
|
||||
|
||||
SESSION=$(cat scimsession | base64 | tr -d "\n")
|
||||
|
||||
echo "OPSCIM_SESSION=$SESSION" > scim.env
|
||||
28
docker-swarm/README.md
Normal file
28
docker-swarm/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Deploying the 1Password SCIM Bridge using Docker Swarm
|
||||
|
||||
This example describes deploying the 1Password SCIM bridge using Docker Swarm. These instructions require a remote Docker Swarm cluster be set up and configured to be accessed by the Docker CLI.
|
||||
|
||||
## Create your DNS record
|
||||
|
||||
The 1Password SCIM bridge requires SSL/TLS in order to communicate with your IdP. You must create a DNS record that points to your Docker cluster. _Do not attempt to perform a provisioning sync before the DNS records have been propogated_. The record must exist and the SCIM bridge server must be running in order for LetsEncrypt to issue a certificate.
|
||||
|
||||
## Create your scimsession file
|
||||
|
||||
Use the [create-session-file.sh](https://github.com/1Password/scim-examples/tree/master/session) script while connected to the Docker host on your local machine to create a scimsession file. This script uses a Docker container to run the `op-scim init` command and writes the scimsession file back to your local machine using a mounted volume. Your bearer token will be printed to the console. Save your bearer token, as it will be needed to authenticate with your IdP.
|
||||
|
||||
The scimsession file is equivalent to your Master Password and Secret Key when combined with the bearer token, therefore they should never be stored in the same place.
|
||||
|
||||
Example:
|
||||
```
|
||||
create-session-file.sh
|
||||
[account sign-in]
|
||||
Bearer token: jafewnqrrupcnoiqj0829fe209fnsoudbf02efsdo
|
||||
```
|
||||
|
||||
## Deploy the SCIM bridge
|
||||
|
||||
Once your scimsession file has been created, copy it into this directory (next to docker-compose.yml), as we need to populate a Docker Swarm secret in order to securely deploy your scimsession. `generate-secret.sh` will create a secret called `scimsession`, which the op-scim container will then read from `/run/secrets`, as defined in docker-compose.yml.
|
||||
|
||||
Next, edit `docker-compose.yml`, replacing `{YOUR-DOMAIN-HERE}` with the domain name indicated by the DNS record created for your SCIM bridge. This will configure LetsEncrypt to automatically issue a certificate for your bridge.
|
||||
|
||||
Running `docker stack deploy -c docker-compose.yml op-scim` will now create a container from the `onepassword/scim` image. A redis container will also be started automatically to be used by the SCIM bridge. _After the DNS record has been propogated_, you can continue setting up your IdP with the SCIM bridge Administration Guide while monitoring the logs from the bridge on your local machine using `docker service logs -f op-scim_scim`.
|
||||
32
docker-swarm/docker-compose.yml
Normal file
32
docker-swarm/docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
scim:
|
||||
image: onepassword/scim:v0.4.4
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
networks:
|
||||
- op-scim
|
||||
ports:
|
||||
- "80:8080"
|
||||
- "443:8443"
|
||||
secrets:
|
||||
- scimsession
|
||||
entrypoint: ["/op-scim/op-scim", "--letsencrypt-domain={YOUR-DOMAIN-HERE}", "--session=/run/secrets/scimsession"]
|
||||
redis:
|
||||
image: redis:latest
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
networks:
|
||||
- op-scim
|
||||
|
||||
networks:
|
||||
op-scim:
|
||||
|
||||
secrets:
|
||||
scimsession:
|
||||
external: true
|
||||
5
docker-swarm/generate-secret.sh
Executable file
5
docker-swarm/generate-secret.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script creates a Docker Swarm secret using the scimsession file in the PWD
|
||||
|
||||
cat ./scimsession | docker secret create scimsession -
|
||||
@@ -20,7 +20,7 @@ This will deploy a single redis instance listening on Kubernetes internal DNS `r
|
||||
|
||||
## Create your `scimsession` Kubernetes secret
|
||||
|
||||
Firstly, use the `create-session-file.sh` script on your local machine to create a scimsession file. This script uses a Docker container to run the `op-scim init` command and writes the scimsession file back to your local machine using a mounted volume. Your bearer token will be printed to the console.
|
||||
Firstly, use the [create-session-file.sh](https://github.com/1Password/scim-examples/tree/master/session) script on your local machine to create a scimsession file. This script uses a Docker container to run the `op-scim init` command and writes the scimsession file back to your local machine using a mounted volume. Your bearer token will be printed to the console.
|
||||
|
||||
The scimsession file is equivalent to your account key and master password when combined with the bearer token, therefore they should never be stored in the same place.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: op-scim
|
||||
image: onepassword/scim:latest
|
||||
image: onepassword/scim:v0.4.4
|
||||
command: ["./op-scim"]
|
||||
args: ["--session=/secret/scimsession", "--letsencrypt-domain={YOUR-DOMAIN-HERE}"]
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user