Add simple integrity check for authorized_keys file, in case you put something interesting in your BORG_SERVE_ARGS
This commit is contained in:
parent
590d6712fb
commit
5d0d13c42a
|
@ -78,6 +78,13 @@ for keyfile in $(find "${SSH_KEY_DIR}/clients" ! -regex '.*/\..*' -a -type f); d
|
||||||
cat ${keyfile} >> ${AUTHORIZED_KEYS_PATH}
|
cat ${keyfile} >> ${AUTHORIZED_KEYS_PATH}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo " * Validating structure of generated ${AUTHORIZED_KEYS_PATH}..."
|
||||||
|
ERROR=$(ssh-keygen -lf ${AUTHORIZED_KEYS_PATH} 2>&1 >/dev/null)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: ${ERROR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
chown -R borg:borg ${BORG_DATA_DIR}
|
chown -R borg:borg ${BORG_DATA_DIR}
|
||||||
chown borg:borg ${AUTHORIZED_KEYS_PATH}
|
chown borg:borg ${AUTHORIZED_KEYS_PATH}
|
||||||
chmod 600 ${AUTHORIZED_KEYS_PATH}
|
chmod 600 ${AUTHORIZED_KEYS_PATH}
|
||||||
|
|
Loading…
Reference in a new issue