Skip to content

Commit

Permalink
pki: make certificates only readable to group and others
Browse files Browse the repository at this point in the history
even though we copy these to hosts it's not a good idea to allow them to
be overwritten by a random user. Openssl database files are also always
recreated, umask should take care of all of that.
Ansible does not use default umask from OS so we need to explicitly set
it. We can use login shell to figure out the effective command-line umask
value.
  • Loading branch information
michalskrivanek committed Jul 27, 2022
1 parent fa581d2 commit 492c68f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packaging/bin/pki-enroll-openssh-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sign() {
}
trap cleanup 0
cat "${PKIDIR}/private/ca.pem" > "${TMPCA}"
umask "$(/bin/sh -l -c umask)"
ssh-keygen \
-s "${TMPCA}" \
-P "" \
Expand Down
1 change: 1 addition & 0 deletions packaging/bin/pki-enroll-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sign() {
[ -e "${CERT_CONF}" ] || die "${CERT_CONF} is missing, Cannot sign certificate"
EXTRA_COMMAND="-extfile ${CERT_CONF} -extensions ${extsection}"
fi
umask "$(/bin/sh -l -c umask)"
OVIRT_KU="${ovirt_ku}" OVIRT_EKU="${ovirt_eku}" OVIRT_SAN="${ovirt_san}" \
openssl ca \
-batch \
Expand Down

0 comments on commit 492c68f

Please sign in to comment.