-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate secrets when container is started #138
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ packs | |
packs.dev | ||
*.pyc | ||
conf | ||
ssh | ||
ssl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,14 @@ | |
git clone [email protected]:stackstorm/st2-docker | ||
cd st2-docker | ||
make env | ||
make gen-ssh | ||
make gen-ssl | ||
docker-compose up -d | ||
docker-compose exec stackstorm bash | ||
``` | ||
|
||
Please see the section below regarding SSH key and SSL certificates. | ||
|
||
Open `https://localhost` in your browser. StackStorm Username/Password can be found in: `cat conf/stackstorm.env` | ||
|
||
Running on Kubernetes? See [runtime/kubernetes-1ppc](./runtime/kubernetes-1ppc) | ||
|
@@ -49,6 +53,12 @@ The default container configuration is as follows: | |
- postgres | ||
- redis | ||
|
||
### SSH Keys and SSL Certificates | ||
|
||
If you do not already have ssh key and ssl certificates, you can generate them using `make gen-ssh` | ||
and `make gen-ssl`. By default, the secrets are found in the default `ssh` and `ssl` directories at the top | ||
of the `st2-docker` workspace. If you already have ssh keys and ssl certificates, define the `ST2_SSH_DIR` and | ||
`ST2_SSL_DIR` environment variables respectively. The secrets will be available in the stackstorm container. | ||
|
||
### Step by step instructions | ||
|
||
|
@@ -71,6 +81,22 @@ As an example, if you want to change the username and password used by StackStor | |
`ST2_USER` and `ST2_PASSWORD` variables in `conf/stackstorm.env` prior to bringing up your docker | ||
environment. | ||
|
||
``` | ||
make gen-ssh | ||
``` | ||
|
||
NOTE: `make gen-ssh` only needs to be run once. | ||
|
||
This generates the ssh key and `authorized_keys` file available in the container at `~stanley/.ssh`. | ||
|
||
``` | ||
make gen-ssl | ||
``` | ||
|
||
NOTE: `make gen-ssl` only needs to be run once. | ||
|
||
This generates the `st2.key` and `st2.crt` files required by nginx (st2web). | ||
|
||
Second, start the docker environment. execute | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
SSL_DIR=ssl | ||
|
||
ST2_KEY=${SSL_DIR}/st2.key | ||
ST2_CRT=${SSL_DIR}/st2.crt | ||
|
||
mkdir -p ${SSL_DIR} | ||
openssl req -x509 -newkey rsa:2048 -keyout ${ST2_KEY} -out ${ST2_CRT} -days 3650 -nodes -subj '/O=st2 self signed/CN=localhost' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
SSH_DIR=ssh | ||
AUTHORIZED_KEYS=${SSH_DIR}/authorized_keys | ||
|
||
SSH_PRIV_KEY=${SSH_DIR}/stanley_rsa | ||
SSH_PUB_KEY=${SSH_PRIV_KEY}.pub | ||
|
||
mkdir -p ${SSH_DIR} | ||
|
||
if [ ! -f ${SSH_PRIV_KEY} ]; then | ||
ssh-keygen -f ${SSH_PRIV_KEY} -P "" | ||
fi | ||
|
||
if ! grep -s -q -f ${SSH_PUB_KEY} ${AUTHORIZED_KEYS}; then | ||
cat ${SSH_PUB_KEY} >> ${AUTHORIZED_KEYS} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to make a positive test?