-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Here is my problem, it is stored in the install.sh:
echo "Generating certificat for MAC $mac"
echo -e "\033[33mIf this is a diyhue reinstallation process then you will need to reinstall official Hue apps from PC and phone in order to wipe old certificate.\033[0m"
serial="${mac:0:2}${mac:3:2}${mac:6:2}fffe${mac:9:2}${mac:12:2}${mac:15:2}"
dec_serial=python3 -c "print(int(\"$serial\", 16))"
faketime '2017-01-01 00:00:00' openssl req -new -config openssl.conf -nodes -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -subj "/C=NL/O=Philips Hue/CN=$serial" -keyout private.key -out public.crt -set_serial $dec_serial -days 7670
if [ $? -ne 0 ] ; then
echo -e "\033[31m ERROR!! Local certificate generation failed! Attempting remote server generation\033[0m"
### test is server for certificate generation is reachable
if ! nc -z mariusmotea.go.ro 9002 2>/dev/null; then
echo -e "\033[31m ERROR!! Certificate generation service is down. Please try again later.\033[0m"
exit 1
fi
curl "http://mariusmotea.go.ro:9002/gencert?mac=$mac" > /opt/hue-emulator/cert.pem
else
touch /opt/hue-emulator/cert.pem
cat private.key > /opt/hue-emulator/cert.pem
cat public.crt >> /opt/hue-emulator/cert.pem
rm private.key public.crt
fi
if [ ! -d "/opt/hue-emulator/config/" ]; then
mkdir /opt/hue-emulator/config/ -p
fi
cp /opt/hue-emulator/cert.pem /opt/hue-emulator/config/