-
Notifications
You must be signed in to change notification settings - Fork 12
[ADD] Initial version of CFSSL container #1
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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,56 @@ | ||
| FROM golang:alpine | ||
| MAINTAINER Dave Lasley <dave@laslabs.com> | ||
|
|
||
| # Install Build Dependencies | ||
|
|
||
| ENV buildDeps "build-base \ | ||
| gcc \ | ||
| git \ | ||
| libtool \ | ||
| sqlite-dev" | ||
|
|
||
| RUN apk add --no-cache $buildDeps | ||
|
|
||
| # Install CFSSL | ||
|
|
||
| RUN git clone --depth=1 https://github.com/cloudflare/cfssl.git $GOPATH/src/github.com/cloudflare/cfssl | ||
|
|
||
| WORKDIR $GOPATH/src/github.com/cloudflare/cfssl | ||
|
|
||
| RUN set -x \ | ||
| && go get github.com/GeertJohan/go.rice/rice \ | ||
| && rice embed-go -i=./cli/serve \ | ||
| && cp -R $GOPATH/src/github.com/cloudflare/cfssl/vendor/github.com/cloudflare/cfssl_trust /etc/cfssl \ | ||
| && go build -o /usr/bin/cfssl ./cmd/cfssl \ | ||
| && go build -o /usr/bin/cfssljson ./cmd/cfssljson \ | ||
| && go build -o /usr/bin/mkbundle ./cmd/mkbundle \ | ||
| && go build -o /usr/bin/multirootca ./cmd/multirootca \ | ||
| && apk del $buildDeps \ | ||
| && rm -rf $GOPATH/src \ | ||
| && echo "Build complete." | ||
|
|
||
| # Create and Change to PKI Dir | ||
| RUN mkdir -p /var/pki | ||
| WORKDIR /var/pki | ||
|
|
||
| # Setup Environment | ||
| ENV CFSSL_DATA=/var/pki | ||
|
|
||
| ENV CFSSL_CERT=$CFSSL_DATA/ca.pem \ | ||
| CFSSL_KEY=$CFSSL_DATA/ca_key.pem \ | ||
| CFSSL_CSR=$CFSSL_DATA/csr_ca.json | ||
|
|
||
| COPY ./docker-entrypoint.sh / | ||
|
|
||
| # Create root certs & Init CA | ||
| COPY ./etc/csr_ca.json $CFSSL_DATA/ | ||
|
|
||
| # Entrypoint & Command | ||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
|
||
| CMD ["cfssl", \ | ||
| "serve", \ | ||
| "-address=0.0.0.0", \ | ||
| "-port=8080", \ | ||
| "-ca='/var/pki/ca.pem'", \ | ||
| "-ca-key='/var/pki/ca-key.pem'"] | ||
This file contains hidden or 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 hidden or 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,22 @@ | ||
| #!/bin/ash | ||
| # Copyright 2016 LasLabs Inc. | ||
| # # License MIT (https://opensource.org/licenses/MIT). | ||
|
|
||
| set -e | ||
|
|
||
| if [ ! -f $CFSSL_DATA/csr_ca.json ]; | ||
| then | ||
|
|
||
| cfssl gencert -initca $CFSSL_DATA/csr_ca.json | cfssljson -bare ca | ||
|
|
||
| fi | ||
|
|
||
| # Add cfssl as command if needed | ||
| if [ "${1:0:1}" = '-' ]; then | ||
| set -- cfssl "$@" | ||
| fi | ||
|
|
||
| # As argument is not related to cfssl, | ||
| # then assume that user wants to run their own process, | ||
| # for example a `bash` shell to explore this image | ||
| exec "$@" |
This file contains hidden or 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,16 @@ | ||
| { | ||
| "CN": "My Awesome CA", | ||
| "key": { | ||
| "algo": "rsa", | ||
| "size": 4096 | ||
| }, | ||
| "names": [ | ||
| { | ||
| "C": "US", | ||
| "L": "Las Vegas", | ||
| "O": "LasLabs Inc.", | ||
| "OU": "CA Services", | ||
| "ST": "Nevada" | ||
| } | ||
| ] | ||
| } |
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.
-pis not necessarily required because/varwill always exist but it also isn't hurting anything :)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.
This is also to guard from it already existing. It's good practice in the automation to use
-pThere 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.
Agree, saved me many times in the past during Clouder development