summaryrefslogtreecommitdiffstats
path: root/scripts/ldadp-setperms
blob: 51b9e59781f992688b1e0efb2e6bb8f03ce80ed8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

BASE="/opt/ldadp/configs"

[ -z "$1" ] && exit 11
echo "$1" | grep -q -E '^[0-9]+$' || exit 12

FILE="${BASE}/${1}"

[ -e "${FILE}.cfg" ] || exit 9
[ -e "${FILE}.crt.pem" ] || exit 8
[ -e "${FILE}.key.pem" ] || exit 7

for ext in cfg crt.pem key.pem ca-bundle.pem; do
	file="${FILE}.${ext}"
	[ -e "$file" ] || continue
	/bin/chown taskmanager:ldadp "$file" || exit 6
	/bin/chmod 0640 "$file" || exit 5
done