2021-08-10 18:12:54 +02:00
|
|
|
#!/bin/sh
|
|
|
|
if [ "$(id -u)" = "0" ]; then
|
|
|
|
DISTRIB=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
|
|
|
echo "Detected $DISTRIB"
|
|
|
|
CRT="/tmp/syscid-ca.crt"
|
|
|
|
URL="https://web.syscid.com/syscid-ca.crt"
|
2022-09-29 10:08:08 +02:00
|
|
|
FP_TRUST="SHA512 Fingerprint=1F:64:B2:B8:2D:C8:AB:5E:66:A1:DB:AA:6A:C6:38:5F:AE:01:39:1A:FF:B9:74:B1:AF:48:7D:34:16:82:C1:C2:31:34:9A:23:3E:21:A2:4C:35:C4:75:37:10:F0:27:96:EF:45:CF:29:78:11:CB:14:FE:49:30:89:2B:C8:03:F5"
|
2021-08-10 18:12:54 +02:00
|
|
|
if [ "${DISTRIB}" = '"openSUSE Leap"' ] || [ "${DISTRIB}" = '"openSUSE Tumbleweed"' ]; then
|
|
|
|
STORE="/etc/pki/trust/anchors/"
|
|
|
|
/usr/bin/curl -kso $CRT $URL
|
|
|
|
FP_CRT=$(/usr/bin/openssl x509 -fingerprint -sha512 -noout -in $CRT)
|
|
|
|
if [ "$FP_CRT" = "$FP_TRUST" ]; then
|
|
|
|
echo "OK, installing..."
|
|
|
|
mv $CRT $STORE
|
|
|
|
/usr/sbin/update-ca-certificates
|
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "Fingerpring mismatch. Operation aborted."
|
|
|
|
rm -f $CRT
|
|
|
|
fi
|
|
|
|
elif [ "${DISTRIB}" = '"Arch Linux"' ]; then
|
|
|
|
OS="Arch"
|
|
|
|
echo $OS
|
|
|
|
/usr/bin/curl -kso $CRT $URL
|
|
|
|
FP_CRT=$(/usr/bin/openssl x509 -fingerprint -sha512 -noout -in $CRT)
|
|
|
|
if [ "$FP_CRT" = "$FP_TRUST" ]; then
|
|
|
|
echo "OK, installing..."
|
2021-09-08 06:17:35 +02:00
|
|
|
/usr/bin/trust anchor --store $CRT
|
2021-08-10 18:12:54 +02:00
|
|
|
rm $CRT
|
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "Fingerpring mismatch. Operation aborted."
|
|
|
|
rm -f $CRT
|
2021-08-20 15:50:20 +02:00
|
|
|
fi
|
2021-08-10 18:12:54 +02:00
|
|
|
else
|
|
|
|
echo "Unsupported operating system."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "This script must be run with root privileges."
|
|
|
|
fi
|