Scp refactor (#3206)

This commit is contained in:
Deverick 2022-09-29 13:56:23 -05:00 committed by GitHub
parent cfa0ffa505
commit 01ab62514b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 51 deletions

View File

@ -479,7 +479,7 @@ Will need to pay through a peer which supports the onion messages which means yo
* If there is no such file and you have not funded the CLN wallet yet can reset the wallet and the next wallet will be created with a seed.
### How to display the hsm_secret in a human-readable format?
* If there is no seed available it is best to save the hsm_secret as a file with `scp` or note down the alphanumeric characters in the two line displayed with:
* If there is no seed available it is best to save the hsm_secret as a file with `sftp` or note down the alphanumeric characters in the two line displayed with:
```
sudo xxd /home/bitcoin/.lightning/bitcoin/hsm_secret
```

View File

@ -25,7 +25,7 @@ Your screen should look similar to this:
* (3) this should be reflected in the preview Window
* (4) save your changes
The next step is to transfer (use scp or WinSCP) the updated `home.ui` to the RaspiBlitz.
The next step is to transfer (use sftp or WinSCP) the updated `home.ui` to the RaspiBlitz.
Login to your RaspiBlitz as **admin** (Password A) and change the directory to `~/raspiblitz/home.admin/BlitzTUI`.

View File

@ -465,27 +465,27 @@ do
fi
fi
# check if a SCP backup target is set
# check if a SFTP backup target is set
# parameter in raspiblitz.conf:
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
# optionally a custom option string for the scp command can be set with
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
# sftpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
# optionally a custom option string for the sftp command can be set with
# sftpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
# https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
if [ ${#scpBackupTarget} -gt 0 ]; then
echo "--> Offsite-Backup SCP Server"
if [ "${scpBackupOptions}" == "" ]; then
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
if [ ${#sftpBackupTarget} -gt 0 ]; then
echo "--> Offsite-Backup SFTP Server"
if [ "${sftpBackupOptions}" == "" ]; then
sftpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
fi
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
# but its more likely that without ignoring known host, script might not run thru and that way: no offsite channel backup
scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
sftp ${sftpBackupOptions} ${localBackupPath} ${sftpBackupTarget}/
sftp ${sftpBackupOptions} ${localTimestampedPath} ${sftpBackupTarget}/
result=$?
if [ ${result} -eq 0 ]; then
echo "OK - SCP Backup exited with 0"
echo "OK - SFTP Backup exited with 0"
else
echo "FAIL - SCP Backup exited with ${result}"
echo "FAIL - SFTP Backup exited with ${result}"
fi
fi

View File

@ -141,7 +141,7 @@ if [ "$1" = "target" ]; then
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
echo ""
echo "COPY, PASTE & EXECUTE the following command on your Windows computer terminal:"
echo "scp -r ./chainstate ./blocks bitcoin@${internet_localip}:/mnt/hdd/bitcoin"
echo "sftp -r ./chainstate ./blocks bitcoin@${internet_localip}:/mnt/hdd/bitcoin"
echo ""
echo "If asked for a password use PASSWORD A (or 'raspiblitz')."
fi

View File

@ -26,21 +26,21 @@ defaultUploadPath="/mnt/hdd/temp/migration"
# get local ip
source <(/home/admin/config.scripts/internet.sh status local)
# SCP download and upload links
scpDownloadUnix="scp -r 'bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz' ./"
scpDownloadWin="scp -r bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz ."
scpUploadUnix="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
scpUploadWin="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
# SFTP download and upload links
sftpDownloadUnix="sftp -r 'bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz' ./"
sftpDownloadWin="sftp -r bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz ."
sftpUploadUnix="sftp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
sftpUploadWin="sftp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
# output status data & exit
if [ "$1" = "status" ]; then
echo "# RASPIBLITZ Data Import & Export"
echo "localip=\"${localip}\""
echo "defaultUploadPath=\"${defaultUploadPath}\""
echo "scpDownloadUnix=\"${scpDownloadUnix}\""
echo "scpUploadUnix=\"${scpUploadUnix}\""
echo "scpDownloadWin=\"${scpDownloadWin}\""
echo "scpUploadWin=\"${scpUploadWin}\""
echo "sftpDownloadUnix=\"${sftpDownloadUnix}\""
echo "sftpUploadUnix=\"${sftpUploadUnix}\""
echo "sftpDownloadWin=\"${sftpDownloadWin}\""
echo "sftpUploadWin=\"${sftpUploadWin}\""
exit 1
fi
@ -433,8 +433,8 @@ if [ "$1" = "export" ]; then
rm ~/.exclude.temp
rm ~/.include.temp
echo "scpDownloadUnix=\"${scpDownloadUnix}\""
echo "scpDownloadWin=\"${scpDownloadWin}\""
echo "sftpDownloadUnix=\"${sftpDownloadUnix}\""
echo "sftpDownloadWin=\"${sftpDownloadWin}\""
echo "# OK - Export done"
exit 0
fi
@ -492,9 +492,9 @@ if [ "$1" = "export-gui" ]; then
echo "*******************************"
echo
echo "On your Linux or MacOS Laptop - RUN IN NEW TERMINAL:"
echo "${scpDownloadUnix}"
echo "${sftpDownloadUnix}"
echo "On Windows use command:"
echo "${scpDownloadWin}"
echo "${sftpDownloadWin}"
echo ""
echo "Use password A to authenticate file transfer."
echo

View File

@ -2,7 +2,7 @@
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# use to prepare & check scp or web file upload to RaspiBlitz"
echo "# use to prepare & check sftp or web file upload to RaspiBlitz"
echo "# blitz.upload.sh prepare-upload"
echo "# blitz.upload.sh check-upload ?[scb|lnd-rescue|migration]"
exit 0

View File

@ -180,7 +180,7 @@ if [ ${mode} = "cl-export-gui" ]; then
# get local ip info
source <(/home/admin/config.scripts/internet.sh status local)
# offer SCP for download
# offer SFTP for download
clear
echo
echo "*******************************************"
@ -188,9 +188,9 @@ if [ ${mode} = "cl-export-gui" ]; then
echo "*******************************************"
echo
echo "ON YOUR MAC & LINUX LAPTOP - RUN IN NEW TERMINAL:"
echo "scp '${fileowner}@${localip}:${filename}' ./"
echo "sftp '${fileowner}@${localip}:${filename}' ./"
echo "ON WINDOWS USE:"
echo "scp ${fileowner}@${localip}:${filename} ."
echo "sftp ${fileowner}@${localip}:${filename} ."
echo
echo "Use password A to authenticate file transfer."
echo "Check for correct file size after transfer: ${size} byte"
@ -291,7 +291,7 @@ if [ ${mode} = "cl-import-gui" ]; then
echo "To make upload open a new terminal on your laptop,"
echo "change into the directory where your cl-rescue file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./cl-rescue-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "sftp -r ./cl-rescue-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo
echo "Use ${passwordInfo} to authenticate file transfer."
echo "PRESS ENTER when upload is done"

View File

@ -190,7 +190,7 @@ if [ ${mode} = "lnd-export-gui" ]; then
# get local ip info
source <(/home/admin/config.scripts/internet.sh status local)
# offer SCP for download
# offer SFTP for download
clear
echo
echo "********************************"
@ -198,9 +198,9 @@ if [ ${mode} = "lnd-export-gui" ]; then
echo "********************************"
echo
echo "ON YOUR MAC & LINUX LAPTOP - RUN IN NEW TERMINAL:"
echo "scp '${fileowner}@${localip}:${filename}' ./"
echo "sftp '${fileowner}@${localip}:${filename}' ./"
echo "ON WINDOWS USE:"
echo "scp ${fileowner}@${localip}:${filename} ."
echo "sftp ${fileowner}@${localip}:${filename} ."
echo "Use password A to authenticate file transfer."
echo
echo "Check for correct file size after transfer: ${size} byte"
@ -299,7 +299,7 @@ if [ ${mode} = "lnd-import-gui" ]; then
echo "To make upload open a new terminal on your laptop,"
echo "change into the directory where your lnd-rescue file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./lnd-rescue-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "sftp -r ./lnd-rescue-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo
echo "Use ${passwordInfo} to authenticate file transfer."
echo "PRESS ENTER when upload is done"
@ -413,7 +413,7 @@ if [ ${mode} = "scb-export-gui" ]; then
echo "**************************************"
echo
echo "RUN THE FOLLOWING COMMAND ON YOUR LAPTOP IN NEW TERMINAL:"
echo "scp -r ${fileuser}@${localip}:${filename} ./"
echo "sftp -r ${fileuser}@${localip}:${filename} ./"
echo ""
echo "Use password A to authenticate file transfer."
echo
@ -492,7 +492,7 @@ if [ ${mode} = "scb-import-gui" ]; then
echo "To make upload open a new terminal and change,"
echo "into the directory where your lnd-rescue file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp ./channel.backup ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "sftp ./channel.backup ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo ""
echo "Use ${passwordInfo} to authenticate file transfer."
echo "PRESS ENTER when upload is done."

View File

@ -3,7 +3,8 @@
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "tool to export macaroons & tls.cert"
echo "lnd.export.sh [hexstring|scp|http|btcpay] [?key-value]"
echo "lnd.export.sh [hexstring|sftp|http|btcpay] [?key-value]"
exit 1
fi
@ -20,7 +21,7 @@ exportType=$1
# interactive choose type of export if not set
if [ "$1" = "" ] || [ $# -eq 0 ]; then
OPTIONS=()
OPTIONS+=(SCP "SSH Download (Commands)")
OPTIONS+=(SFTP "SSH Download (Commands)")
OPTIONS+=(HTTP "Browserdownload (bit risky)")
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
OPTIONS+=(STR "BTCPay Connection String")
@ -39,8 +40,8 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
STR)
exportType='btcpay';
;;
SCP)
exportType='scp';
SFTP)
exportType='sftp';
;;
HTTP)
exportType='http';
@ -142,21 +143,21 @@ elif [ "${exportType}" = "btcpay" ]; then
echo ""
###########################
# SHH / SCP File Download
# SHH / SFTP File Download
###########################
elif [ "${exportType}" = "scp" ]; then
elif [ "${exportType}" = "sftp" ]; then
local_ip=$(hostname -I | awk '{print $1}')
clear
echo "###### DOWNLOAD BY SCP ######"
echo "###### DOWNLOAD BY SFTP ######"
echo "Copy, paste and execute these commands in your client terminal to download the files."
echo "The password needed during download is your Password A."
echo ""
echo "Macaroons:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/data/chain/${network}/${chain}net/\*.macaroon ./"
echo "sftp bitcoin@${local_ip}:/home/bitcoin/.lnd/data/chain/${network}/${chain}net/\*.macaroon ./"
echo ""
echo "TLS Certificate:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/tls.cert ./"
echo "sftp bitcoin@${local_ip}:/home/bitcoin/.lnd/tls.cert ./"
echo ""
###########################

View File

@ -19,9 +19,9 @@ cp ./*.proto ./protobuffs
*NOTE: If LND master branch is already a version ahead .. use the rpc.proto from the version tagged branch.*
Now copy the generated RPC libs per SCP over to your Laptop and add them to the `/home/admin/config.scripts/lndlibs`.
Now copy the generated RPC libs per SFTP over to your Laptop and add them to the `/home/admin/config.scripts/lndlibs`.
scp -r admin@192.168.X.X:/home/admin/protobuffs ./protobuffs
sftp -r admin@192.168.X.X:/home/admin/protobuffs ./protobuffs
Make sure the first lines (ignore comments) of the `lightning_pb2_grpc.py` look like the following for python3 compatibility:
```

View File

@ -55,7 +55,7 @@ if [ "${migrationOS}" == "raspiblitz" ]; then
echo "ON YOUR LAPTOP open a new terminal and change into"
echo "the directory where your migration file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./raspiblitz-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "sftp -r ./raspiblitz-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo ""
echo "Use password 'raspiblitz' to authenticate file transfer."
echo "PRESS ENTER when upload is done."