Skip to content

Commit

Permalink
Fixed issue with gen certs
Browse files Browse the repository at this point in the history
  • Loading branch information
massenz committed Jul 21, 2024
1 parent 3d45eb3 commit ea4f7d2
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,35 +118,27 @@ check_certs:
echo "$(GREEN)[OK]$(RESET) Certificates found in $(shell pwd)/certs"; \
fi

config_dir := ssl-config
config_dir := ../ssl-config
ca-csr := $(config_dir)/ca-csr.json
ca-config := $(config_dir)/ca-config.json
server-csr := $(config_dir)/localhost-csr.json

cfssl != which cfssl
cfssljson != which cfssljson
ifeq ($(strip $(cfssl)),)
$(error cfssl not installed)
endif
ifeq ($(strip $(cfssljson)),)
$(error cfssljson not installed)
endif

.PHONY: certs
certs: $(ca-csr) $(config) $(server-csr) ## Generates all certificates in the certs directory (requires cfssl, see https://github.com/cloudflare/cfssl#installation)
$(cfssl) gencert \
-initca $(ca-csr) | cfssljson -bare ca
$(cfssl) gencert \
-ca=ca.pem \
-ca-key=ca-key.pem \
-config=$(ca-config) \
-profile=server \
$(server-csr) | $(cfssljson) -bare server
certs: ## Generates all certificates in the certs directory (requires cfssl, see https://github.com/cloudflare/cfssl#installation)
@mkdir -p certs
@mv *.pem certs/
@rm *.csr
@chmod a+r certs/*
@echo "Certificates generated in $(shell pwd)/certs"
@cd certs && \
cfssl gencert \
-initca $(ca-csr) 2>/dev/null | cfssljson -bare ca
@cd certs && \
cfssl gencert \
-ca=ca.pem \
-ca-key=ca-key.pem \
-config=$(ca-config) \
-profile=server \
$(server-csr) 2>/dev/null | cfssljson -bare server
@rm certs/*.csr
@chmod a+r certs/*.pem
@echo "$(GREEN)[SUCCESS]$(RESET) Certificates generated"

.PHONY: clean-cert
clean-cert:
Expand Down

0 comments on commit ea4f7d2

Please sign in to comment.