You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-panel/tools/ngcp-api.inc

31 lines
541 B

#!/bin/bash
set -e
importcreds () {
local CREDS=$1
if [ -z "${CREDS}" ]; then
echo "Error: missing mandatory file name to read" >&2
exit 1
fi
if [ ! -f "${CREDS}" ]; then
return
fi
if [ ! -r "${CREDS}" ]; then
echo "Error: cannot read ${CREDS}" >&2
exit 1
fi
echo "${CREDS} present, checking perms"
if stat "${CREDS}" | grep -q 'Access: (0600' 1>/dev/null ; then
echo "${CREDS} permissions ok"
. "${CREDS}"
else
echo "Error: ${CREDS} must have permissions 600" >&2
exit 1
fi
}