Skip to content
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

Add TLS support to http server #332

Merged
merged 4 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#297 create self signed certs
  • Loading branch information
bnfinet committed Dec 8, 2020
commit 81f50c0f29a99ecba42ec3ca5abaf3c7c404f7fa
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config/secret
!config/testing/*
pkg/model/storage-test.db
.vscode/*
certs/*
coverage.out
coverage.html.env_google
.env*
13 changes: 13 additions & 0 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ gosec() {
# segfault's without exec since it would just call this function infinitely :)
exec gosec ./...
}

selfcert() {
# https://stackoverflow.com/questions/63588254/how-to-set-up-an-https-server-with-a-self-signed-certificate-in-golang
set -e
mkdir -p $SDIR/certs
# openssl genrsa -out $SDIR/certs/server.key 2048
openssl ecparam -genkey -name secp384r1 -out $SDIR/certs/server.key
openssl req -new -x509 -sha256 -key $SDIR/certs/server.key -out $SDIR/certs/server.crt -days 3650
echo -e "created self signed certs in '$SDIR/certs'\n"
}

usage() {
cat <<EOF
usage:
Expand All @@ -327,6 +338,7 @@ usage() {
$0 goget - get all dependencies
$0 gofmt - gofmt the entire code base
$0 gosec - gosec security audit of the entire code base
$0 selfcert - calls openssl to create a self signed key and cert
$0 dbuild - build docker container
$0 drun [args] - run docker container
$0 dbuildalpine - build docker container for alpine
Expand Down Expand Up @@ -360,6 +372,7 @@ case "$ARG" in
|'install' \
|'test' \
|'goget' \
|'selfcert' \
|'gogo' \
|'watch' \
|'gobuildstatic' \
Expand Down