|
|
@ -490,8 +490,35 @@ PGPcheck="BD599672C804AF2770869A048B80CD2BB8BD8132" |
|
|
|
# get LND resources |
|
|
|
cd /home/admin/download |
|
|
|
|
|
|
|
# get lndOSversion and lndSHA256 for the corresponding platform |
|
|
|
# download lnd binary checksum manifest |
|
|
|
sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt |
|
|
|
|
|
|
|
# check if checksums are signed by lnd dev team |
|
|
|
sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig |
|
|
|
sudo -u admin wget -N -O "pgp_keys.asc" ${PGPpkeys} |
|
|
|
gpg ./pgp_keys.asc |
|
|
|
fingerprint=$(sudo gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPcheck}" -c) |
|
|
|
if [ ${fingerprint} -lt 1 ]; then |
|
|
|
echo "" |
|
|
|
echo "!!! BUILD WARNING --> LND PGP author not as expected" |
|
|
|
echo "Should contain PGP: ${PGPcheck}" |
|
|
|
echo "PRESS ENTER to TAKE THE RISK if you think all is OK" |
|
|
|
read key |
|
|
|
fi |
|
|
|
gpg --import ./pgp_keys.asc |
|
|
|
sleep 3 |
|
|
|
verifyResult=$(gpg --verify manifest-v${lndVersion}.txt.sig 2>&1) |
|
|
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) |
|
|
|
echo "goodSignature(${goodSignature})" |
|
|
|
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${GPGcheck}" -c) |
|
|
|
echo "correctKey(${correctKey})" |
|
|
|
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then |
|
|
|
echo "" |
|
|
|
echo "!!! BUILD FAILED --> LND PGP Verify not OK / signature(${goodSignature}) verify(${correctKey})" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
# get the lndSHA256 for the corresponding platform from manifest file |
|
|
|
if [ ${isARM} -eq 1 ] ; then |
|
|
|
lndOSversion="armv7" |
|
|
|
lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) |
|
|
@ -508,6 +535,7 @@ if [ ${isX86_32} -eq 1 ] ; then |
|
|
|
lndOSversion="386" |
|
|
|
lndSHA256=$(grep -i "linux-$lndOSversion" manifest-v$lndVersion.txt | cut -d " " -f1) |
|
|
|
fi |
|
|
|
|
|
|
|
echo "" |
|
|
|
echo "*** LND v${lndVersion} for ${lndOSversion} ***" |
|
|
|
echo "SHA256 hash: $lndSHA256" |
|
|
@ -518,37 +546,12 @@ binaryName="lnd-linux-${lndOSversion}-v${lndVersion}.tar.gz" |
|
|
|
sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/${binaryName} |
|
|
|
|
|
|
|
# check binary was not manipulated (checksum test) |
|
|
|
sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndVersion}/manifest-v${lndVersion}.txt.sig |
|
|
|
sudo -u admin wget -N -O "pgp_keys.asc" ${PGPpkeys} |
|
|
|
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) |
|
|
|
if [ "${binaryChecksum}" != "${lndSHA256}" ]; then |
|
|
|
echo "!!! FAIL !!! Downloaded LND BINARY not matching SHA256 checksum: ${lndSHA256}" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
# check gpg finger print |
|
|
|
gpg ./pgp_keys.asc |
|
|
|
fingerprint=$(sudo gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPcheck}" -c) |
|
|
|
if [ ${fingerprint} -lt 1 ]; then |
|
|
|
echo "" |
|
|
|
echo "!!! BUILD WARNING --> LND PGP author not as expected" |
|
|
|
echo "Should contain PGP: ${PGPcheck}" |
|
|
|
echo "PRESS ENTER to TAKE THE RISK if you think all is OK" |
|
|
|
read key |
|
|
|
fi |
|
|
|
gpg --import ./pgp_keys.asc |
|
|
|
sleep 3 |
|
|
|
verifyResult=$(gpg --verify manifest-v${lndVersion}.txt.sig 2>&1) |
|
|
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) |
|
|
|
echo "goodSignature(${goodSignature})" |
|
|
|
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${GPGcheck}" -c) |
|
|
|
echo "correctKey(${correctKey})" |
|
|
|
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then |
|
|
|
echo "" |
|
|
|
echo "!!! BUILD FAILED --> LND PGP Verify not OK / signature(${goodSignature}) verify(${correctKey})" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
# install |
|
|
|
sudo -u admin tar -xzf ${binaryName} |
|
|
|
sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-${lndOSversion}-v${lndVersion}/* |
|
|
|