- Let's encrypt a file
conf/config.json
from current directory - Create a file named
Makefile
with following contents:
.PHONY: _pwd_prompt decrypt_conf encrypt_conf
CONF_FILE=conf/config.json
# 'private' task for echoing instructions
_pwd_prompt:
@echo "Contact foo@example.com for the password."
# to create conf/config.json
decrypt_conf: _pwd_prompt
openssl cast5-cbc -d -in ${CONF_FILE}.cast5 -out ${CONF_FILE}
chmod 600 ${CONF_FILE}
# for updating conf/config.json
encrypt_conf: _pwd_prompt
openssl cast5-cbc -e -in ${CONF_FILE} -out ${CONF_FILE}.cast5
- Now, for encrypting the
conf/config.json
, run following command from current directory:
make encrypt_conf
- And to decrypt it, run:
make decrypt_conf
Reference: http://ejohn.org/blog/keeping-passwords-in-source-control/