From 3973ce8db92db2d171c4d2989ed904e4203dc188 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 13 Jul 2015 16:35:12 -0600 Subject: [PATCH] initial commit --- .gitignore | 2 ++ README.md | 53 ++++++++++++++++++++++++++++++++++- etc/letsencrypt/live/.gitkeep | 0 serve.go | 7 +++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 etc/letsencrypt/live/.gitkeep create mode 100644 serve.go diff --git a/.gitignore b/.gitignore index daf913b..e56a532 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +etc + # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a diff --git a/README.md b/README.md index 5bd3bd9..8c51826 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,53 @@ -# golang-https-example +golang-https-example +==================== + A TLS / SSL enabled WebServer in Go with, done right - includes valid https certificates. + +Install +======= + +Install the server and some certificates + +```bash +# Clone this repo +git clone git@github.com:coolaj86/golang-https-example.git +pushd golang-https-example + +# Clone some valid dummy certificates +git clone git@github.com:Daplie/localhost.daplie.com-certificates.git \ + ./etc/letsencrypt/live/localhost.daplie.com/ +``` + +Test +==== + +Run the server + +```bash +# Run the Code +go run serve.go --port 8443 --letsencrypt-dir=./etc/letsencrypt/live/ +``` + +View it in your browser + + + +Test it with `openssl` + +```bash +openssl s_client -showcerts \ + -connect localhost:8443 \ + -servername localhost.daplie.com \ + -CAfile ./etc/letsencrypt/live/localhost.daplie.com/certs/ca/root.pem +``` + +Test it with `curl` + +```bash +# should work +curl https://localhost.daplie.com:8443 + +# if the Root CA isn't in your bundle +curl https://localhost.daplie.com:8443 \ + --cacert=./etc/letsencrypt/live/localhost.daplie.com/certs/ca/root.pem +``` diff --git a/etc/letsencrypt/live/.gitkeep b/etc/letsencrypt/live/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/serve.go b/serve.go new file mode 100644 index 0000000..a3dd973 --- /dev/null +++ b/serve.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +}