From 152421ed2a2f2236ccd0c1b19fd1a760cfed822b Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 3 Apr 2024 09:38:04 -0500 Subject: [PATCH] changed to resticsftp --- restic/restic-sftp/export-etc.sh | 2 +- restic/restic-sftp/export-home-akanealw.sh | 2 +- restic/restic-sftp/export-opt.sh | 2 +- restic/restic-sftp/export-root.sh | 2 +- restic/restic-sftp/install-restic-sftp.sh | 36 +++++++++------------- restic/restic-sftp/restic-sftp-backup.sh | 8 ++--- restic/restic-sftp/restic-sftp-init.sh | 8 ++--- 7 files changed, 27 insertions(+), 33 deletions(-) diff --git a/restic/restic-sftp/export-etc.sh b/restic/restic-sftp/export-etc.sh index 0bf8cb6..e4f0bdd 100755 --- a/restic/restic-sftp/export-etc.sh +++ b/restic/restic-sftp/export-etc.sh @@ -1,4 +1,4 @@ #!/bin/bash export RESTIC_PASSWORD="8ung1e1!" -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc" diff --git a/restic/restic-sftp/export-home-akanealw.sh b/restic/restic-sftp/export-home-akanealw.sh index 4197180..eab1ac8 100755 --- a/restic/restic-sftp/export-home-akanealw.sh +++ b/restic/restic-sftp/export-home-akanealw.sh @@ -1,4 +1,4 @@ #!/bin/bash export RESTIC_PASSWORD="8ung1e1!" -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/home/akanealw" diff --git a/restic/restic-sftp/export-opt.sh b/restic/restic-sftp/export-opt.sh index a8d2773..354ba26 100755 --- a/restic/restic-sftp/export-opt.sh +++ b/restic/restic-sftp/export-opt.sh @@ -1,4 +1,4 @@ #!/bin/bash export RESTIC_PASSWORD="8ung1e1!" -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt" diff --git a/restic/restic-sftp/export-root.sh b/restic/restic-sftp/export-root.sh index 8c4c845..a1ab132 100755 --- a/restic/restic-sftp/export-root.sh +++ b/restic/restic-sftp/export-root.sh @@ -1,4 +1,4 @@ #!/bin/bash export RESTIC_PASSWORD="8ung1e1!" -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root" diff --git a/restic/restic-sftp/install-restic-sftp.sh b/restic/restic-sftp/install-restic-sftp.sh index bb7a3aa..73bbc42 100755 --- a/restic/restic-sftp/install-restic-sftp.sh +++ b/restic/restic-sftp/install-restic-sftp.sh @@ -1,11 +1,5 @@ #!/bin/bash -rm -r /home/akanealw/.config/wrestic > /dev/null 2>&1 -rm -r /root/.config/wrestic > /dev/null 2>&1 -rm -r /usr/local/bin/wrestic > /dev/null 2>&1 -rm /home/akanealw/scripts/wrestic-backup-to-truenas.sh > /dev/null 2>&1 -rm /root/scripts/wrestic-backup-to-truenas.sh > /dev/null 2>&1 - mkdir -p /root/scripts/restic > /dev/null 2>&1 rm /root/scripts/restic/* > /dev/null 2>&1 wget -q http://192.168.1.50/scripts/restic/restic-sftp/restic-sftp-backup.sh -P /root/scripts/restic @@ -22,28 +16,28 @@ if [[ ! -f /root/.ssh/config ]]; then touch /root/.ssh/config fi -isInFile=$(cat /root/.ssh/config | grep -c "truenas") +isInFile=$(cat /root/.ssh/config | grep -c "resticssftp") if [ $isInFile -eq 0 ] then echo "" >> /root/.ssh/config - echo "Host truenas" >> /root/.ssh/config - echo "Hostname 192.168.1.41" >> /root/.ssh/config + echo "Host resticssftp" >> /root/.ssh/config + echo "Hostname 192.168.1.51" >> /root/.ssh/config echo "Port 22" >> /root/.ssh/config - echo "User akanealw" >> /root/.ssh/config - echo "IdentityFile ~/.ssh/truenas" >> /root/.ssh/config + echo "User root" >> /root/.ssh/config + echo "IdentityFile ~/.ssh/resticssftp" >> /root/.ssh/config echo "StrictHostKeyChecking no" >> /root/.ssh/config chmod 600 /root/.ssh/config fi -if [[ ! -f /root/.ssh/truenas ]] > /dev/null 2>&1 +if [[ ! -f /root/.ssh/resticssftp ]] > /dev/null 2>&1 then - echo "-----BEGIN OPENSSH PRIVATE KEY-----" > /root/.ssh/truenas - echo "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW" >> /root/.ssh/truenas - echo "QyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQAAAJhNQ67sTUOu" >> /root/.ssh/truenas - echo "7AAAAAtzc2gtZWQyNTUxOQAAACCDKl0DNjKWKlSpbCGeKjmA3tc0pKDvAiMfWQ83h0JVlQ" >> /root/.ssh/truenas - echo "AAAEBoM2bsFqToHCHKO3F6MvOlObGaiNXw6UPcyBlyfbSAvYMqXQM2MpYqVKlsIZ4qOYDe" >> /root/.ssh/truenas - echo "1zSkoO8CIx9ZDzeHQlWVAAAAEWFrYW5lYWx3QExhcHRvcFBDAQIDBA==" >> /root/.ssh/truenas - echo "-----END OPENSSH PRIVATE KEY-----" >> /root/.ssh/truenas - chown root:root /root/.ssh/truenas - chmod 600 /root/.ssh/truenas + echo "-----BEGIN OPENSSH PRIVATE KEY-----" > /root/.ssh/resticssftp + echo "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW" >> /root/.ssh/resticssftp + echo "QyNTUxOQAAACC1aqAAHasdh+NMiX+v0iatWv/jwq9+nhPUSKs2oTlzkQAAAJBweDwvcHg8" >> /root/.ssh/resticssftp + echo "LwAAAAtzc2gtZWQyNTUxOQAAACC1aqAAHasdh+NMiX+v0iatWv/jwq9+nhPUSKs2oTlzkQ" >> /root/.ssh/resticssftp + echo "AAAEB7kN9ngDVf30Nr/C3f236ml6UiXi07X2szfLvNPvpQp7VqoAAdqx2H40yJf6/SJq1a" >> /root/.ssh/resticssftp + echo "/+PCr36eE9RIqzahOXORAAAACnJlc3RpY3NmdHABAgM=" >> /root/.ssh/resticssftp + echo "-----END OPENSSH PRIVATE KEY-----" >> /root/.ssh/resticssftp + chown root:root /root/.ssh/resticssftp + chmod 600 /root/.ssh/resticssftp fi diff --git a/restic/restic-sftp/restic-sftp-backup.sh b/restic/restic-sftp/restic-sftp-backup.sh index bae0ca0..440f6ba 100755 --- a/restic/restic-sftp/restic-sftp-backup.sh +++ b/restic/restic-sftp/restic-sftp-backup.sh @@ -3,28 +3,28 @@ export RESTIC_PASSWORD="8ung1e1!" # backup /home/akanealw -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/home/akanealw" restic unlock restic backup /home/akanealw --no-cache -v restic unlock restic forget --keep-last 25 --prune # backup /etc -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc" restic unlock restic backup /etc --no-cache -v restic unlock restic forget --keep-last 25 --prune # backup /opt -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt" restic unlock restic backup /opt --no-cache -v restic unlock restic forget --keep-last 25 --prune # backup /root -export RESTIC_REPOSITORY="sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root" +export RESTIC_REPOSITORY="sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root" restic unlock restic backup /root --no-cache -v restic unlock diff --git a/restic/restic-sftp/restic-sftp-init.sh b/restic/restic-sftp/restic-sftp-init.sh index a02e174..4b6346c 100755 --- a/restic/restic-sftp/restic-sftp-init.sh +++ b/restic/restic-sftp/restic-sftp-init.sh @@ -2,7 +2,7 @@ export RESTIC_PASSWORD="8ung1e1!" -restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/home/akanealw init -restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/etc init -restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/opt init -restic -r sftp:akanealw@truenas:/mnt/data/backups/resticbackups/changemepls/root init +restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/home/akanealw init +restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/etc init +restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/opt init +restic -r sftp:root@resticssftp:/mnt/data/backups/resticbackups/changemepls/root init