Skip to content

Commit

Permalink
refactor: change utils to keys generate (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
luismayta committed May 3, 2021
1 parent f6d2f8b commit 4b7b659
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 32 deletions.
42 changes: 42 additions & 0 deletions provision/make/keys.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# See ./docs/contributing.md
#

## show keys.help
.PHONY: keys.help
keys.help:
@echo ' keys:'
@echo ''
@echo ' keys help keys'
@echo ' keys.openssl make key openssl by stage'
@echo ' keys.pem make key openssl by stage'
@echo ''

## show help keys commands
.PHONY: keys
keys:
make keys.help

## show keys make
.PHONY: keys.openssl
keys.openssl:
@if [ -z "${stage}" ]; then \
echo "is neccesary add a stage"; \
exit 2; \
fi
mkdir -p ${KEYBASE_PATH}/${stage}/openssl/
openssl genrsa -out ${PROJECT}-${stage}.pem 2048
openssl rsa -in ${PROJECT}-${stage}.pem -pubout -out ${PROJECT}-${stage}.public.pem
mv ${PROJECT}-${stage}.pem ${KEYBASE_PATH}/${stage}/openssl/${PROJECT}-${stage}.pem
mv ${PROJECT}-${stage}.public.pem ${KEYBASE_PATH}/${stage}/openssl/${PROJECT}-${stage}.pem

## Generate key rsa pem
.PHONY: keys.pem
keys.pem:
@if [ -z "${stage}" ]; then \
echo "is neccesary add a stage"; \
exit 2; \
fi
@ssh-keygen -q -m PEM -t rsa -b 4096 -C "admin@${PROJECT}-${stage}.com" -f ${PROJECT}-${stage} -P ""
@openssl rsa -in ${PROJECT}-${stage} -outform pem > ${PROJECT}-${stage}.pem
@chmod 0600 ${PROJECT}-${stage}.pem
32 changes: 0 additions & 32 deletions provision/make/utils.mk

This file was deleted.

0 comments on commit 4b7b659

Please sign in to comment.