For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "runtime/pprof" | |
| "sync" | |
| "sync/atomic" | |
| "time" | |
| ) |
| version: '2' | |
| services: | |
| etcd1: | |
| image: quay.io/coreos/etcd:v3.1.7 | |
| restart: always | |
| ports: | |
| - 23791:2379 | |
| - 23801:2380 | |
| environment: |
| {# style 1 - long form #} | |
| {% if filepath == '/var/opt/tomcat_1' %} | |
| {% set tomcat_value = tomcat_1_value %} | |
| {% else %} | |
| {% set tomcat_value = tomcat_2_value %} | |
| {% endif %} | |
| {# style 2 - short form #} | |
| {% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %} |
| #! /usr/bin/env bash | |
| # Create the CA Key and Certificate for signing Client Certs | |
| openssl genrsa -des3 -out ca.key 4096 | |
| openssl req -new -x509 -days 365 -key ca.key -out ca.crt | |
| # Create the Server Key, CSR, and Certificate | |
| openssl genrsa -des3 -out server.key 1024 | |
| openssl req -new -key server.key -out server.csr |
| .SILENT: | |
| .PHONY: help | |
| # Based on https://gist.github.com/prwhite/8168133#comment-1313022 | |
| ## This help screen | |
| help: | |
| printf "Available targets\n\n" | |
| awk '/^[a-zA-Z\-\_0-9]+:/ { \ | |
| helpMessage = match(lastLine, /^## (.*)/); \ |
| # Add the following 'help' target to your Makefile | |
| # And add help text after each target name starting with '\#\#' | |
| help: ## Show this help. | |
| @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | |
| # Everything below is an example | |
| target00: ## This message will show up when typing 'make help' | |
| @echo does nothing |
| # | |
| # Acts as a nginx HTTPS proxy server | |
| # enabling CORS only to domains matched by regex | |
| # /https?://.*\.mckinsey\.com(:[0-9]+)?)/ | |
| # | |
| # Based on: | |
| # * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html | |
| # * http://enable-cors.org/server_nginx.html | |
| # | |
| server { |
| git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n |