create the private key file chmod'ed 600

This commit is contained in:
Vinicius Mello 2016-07-29 10:39:08 -03:00
parent 30de13b4df
commit 39e0191c1b

12
acme.sh
View File

@ -337,6 +337,18 @@ _createkey() {
_info "Using ec name: $eccname"
fi
# to prevent the key file from being world-readable
# create an empty file and chmod 600 before saving the key contents
if ! touch "$f"; then
_err "unable to create empty file '$f' for private key"
return 1
fi
if ! chmod 600 "$f"; then
_err "unable to chmod 600 key file $f"
return 1
fi
#generate account key
if [ "$isec" ] ; then
openssl ecparam -name $eccname -genkey 2>/dev/null > "$f"