feat: check package hash upon install and update

This commit is contained in:
José Oliveira 2022-08-19 17:29:35 +01:00 committed by Rafael
parent 09df11e7a9
commit b9fb15fa79
8 changed files with 45 additions and 0 deletions

View file

@ -27,6 +27,10 @@ function updateCore (coinRec, isCurrentlyRunning) {
common.logger.info('Updating Bitcoin Core. This may take a minute...')
!isDevMode() && common.es(`sudo supervisorctl stop bitcoin`)
common.es(`curl -#o /tmp/bitcoin.tar.gz ${coinRec.url}`)
if (common.es(`sha256 /tmp/bitcoin.tar.gz | awk '{print $1}'`).trim() !== coinRec.urlHash) {
common.logger.info('Failed to update Bitcoin Core: Package signature do not match!')
return
}
common.es(`tar -xzf /tmp/bitcoin.tar.gz -C /tmp/`)
common.logger.info('Updating wallet...')
@ -63,6 +67,8 @@ function updateCore (coinRec, isCurrentlyRunning) {
common.logger.info('Bitcoin Core is updated!')
}
console.log(typeof common.es(`sha256sum ../../../../../Downloads/monero-linux-x64-v0.18.0.0.tar.bz2 | awk '{print $1}'`).trim())
function buildConfig () {
return `rpcuser=lamassuserver
rpcpassword=${common.randomPass()}