diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/jryland-gpg2-public.key.gpg b/backups/jryland-gpg2-public.key.gpg new file mode 100644 index 0000000..6053967 --- /dev/null +++ b/backups/jryland-gpg2-public.key.gpg Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/jryland-gpg2-public.key.gpg b/backups/jryland-gpg2-public.key.gpg new file mode 100644 index 0000000..6053967 --- /dev/null +++ b/backups/jryland-gpg2-public.key.gpg Binary files differ diff --git a/backups/jryland-gpg2-secret.key.gpg b/backups/jryland-gpg2-secret.key.gpg index 60c9b87..3d6140b 100644 --- a/backups/jryland-gpg2-secret.key.gpg +++ b/backups/jryland-gpg2-secret.key.gpg Binary files differ diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/jryland-gpg2-public.key.gpg b/backups/jryland-gpg2-public.key.gpg new file mode 100644 index 0000000..6053967 --- /dev/null +++ b/backups/jryland-gpg2-public.key.gpg Binary files differ diff --git a/backups/jryland-gpg2-secret.key.gpg b/backups/jryland-gpg2-secret.key.gpg index 60c9b87..3d6140b 100644 --- a/backups/jryland-gpg2-secret.key.gpg +++ b/backups/jryland-gpg2-secret.key.gpg Binary files differ diff --git a/backups/restore.sh b/backups/restore.sh index 69e9414..0246e91 100755 --- a/backups/restore.sh +++ b/backups/restore.sh @@ -1,7 +1,7 @@ #!/bin/bash -USER=jryland -SOURCE="${USER}@invertedlogic.com:/home/${USER}/backups" +BACKUP_USER=jryland +SOURCE="${BACKUP_USER}@invertedlogic.com:/home/${BACKUP_USER}/backups" DESTINATION=restored echo "*********************************" @@ -20,9 +20,11 @@ read # Import the keys needed for decryption -gpg2 --decrypt "backups/${USER}-gpg2-secret.key.gpg" > "backups/${USER}-gpg2-secret.key" -gpg2 --import "backups/${USER}-gpg2-secret.key" -gpg2 --import-ownertrust "backups/${USER}-gpg2-ownertrust.txt" +#gpg2 --decrypt "backups/${BACKUP_USER}-gpg2-secret.key.gpg" > "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import-ownertrust "backups/${BACKUP_USER}-gpg2-ownertrust.txt" +gpg2 -d "backups/${BACKUP_USER}-gpg2-public.key.gpg" | gpg2 --import +gpg2 -d "backups/${BACKUP_USER}-gpg2-secret.key.gpg" | gpg2 --import --allow-secret-key-import echo "Passphase is the password like this: 'a******5* ' replacing '*' as appropriate with trailing spaces" echo "Press enter to continue or Ctrl-C to cancel" diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/jryland-gpg2-public.key.gpg b/backups/jryland-gpg2-public.key.gpg new file mode 100644 index 0000000..6053967 --- /dev/null +++ b/backups/jryland-gpg2-public.key.gpg Binary files differ diff --git a/backups/jryland-gpg2-secret.key.gpg b/backups/jryland-gpg2-secret.key.gpg index 60c9b87..3d6140b 100644 --- a/backups/jryland-gpg2-secret.key.gpg +++ b/backups/jryland-gpg2-secret.key.gpg Binary files differ diff --git a/backups/restore.sh b/backups/restore.sh index 69e9414..0246e91 100755 --- a/backups/restore.sh +++ b/backups/restore.sh @@ -1,7 +1,7 @@ #!/bin/bash -USER=jryland -SOURCE="${USER}@invertedlogic.com:/home/${USER}/backups" +BACKUP_USER=jryland +SOURCE="${BACKUP_USER}@invertedlogic.com:/home/${BACKUP_USER}/backups" DESTINATION=restored echo "*********************************" @@ -20,9 +20,11 @@ read # Import the keys needed for decryption -gpg2 --decrypt "backups/${USER}-gpg2-secret.key.gpg" > "backups/${USER}-gpg2-secret.key" -gpg2 --import "backups/${USER}-gpg2-secret.key" -gpg2 --import-ownertrust "backups/${USER}-gpg2-ownertrust.txt" +#gpg2 --decrypt "backups/${BACKUP_USER}-gpg2-secret.key.gpg" > "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import-ownertrust "backups/${BACKUP_USER}-gpg2-ownertrust.txt" +gpg2 -d "backups/${BACKUP_USER}-gpg2-public.key.gpg" | gpg2 --import +gpg2 -d "backups/${BACKUP_USER}-gpg2-secret.key.gpg" | gpg2 --import --allow-secret-key-import echo "Passphase is the password like this: 'a******5* ' replacing '*' as appropriate with trailing spaces" echo "Press enter to continue or Ctrl-C to cancel" diff --git a/backups/setup.sh b/backups/setup.sh new file mode 100755 index 0000000..aa4d251 --- /dev/null +++ b/backups/setup.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +BACKUP_USER=jryland + +echo "*********************************" +echo "********* IMPORTANT *********" +echo "*********************************" +echo "This will change your ~/.gnupg directory, however it will" +echo "make a backup to ~/.gnupg-bak. Do you still want to proceed?" +echo "Press enter to continue or Ctrl-C to cancel" +read + +if [ -d ~/.gnupg-bak ] +then + echo "Backup of ~/.gnupg directory already exists, bailing out" + exit +fi +if [ -d ~/.gnupg ] +then + mv ~/.gnupg ~/.gnupg-bak +fi +if [ -d ~/.gnupg ] +then + echo "Still a ~/.gnupg directory exists, bailing out" + exit +fi + +if [ ! -f "${BACKUP_USER}-gpg2-secret.key.gpg" ] +then + cat | gpg2 --verbose --batch --full-gen-key << EOF + %echo Generating a basic OpenPGP key + Key-Type: RSA + Key-Length: 4096 + Subkey-Type: RSA + Subkey-Length: 4096 + Name-Real: John Ryland + Name-Comment: ${BACKUP_USER} + Name-Email: jryland@xiaofrog.com + Expire-Date: 0 + +EOF + gpg2 --export-secret-keys ${BACKUP_USER} | gpg2 --symmetric --cipher-algo AES256 > ${BACKUP_USER}-gpg2-secret.key.gpg + gpg2 --export ${BACKUP_USER} | gpg2 --symmetric --cipher-algo AES256 > ${BACKUP_USER}-gpg2-public.key.gpg +fi + +gpg2 --batch -d "${BACKUP_USER}-gpg2-public.key.gpg" | gpg2 --import +gpg2 --batch -d "${BACKUP_USER}-gpg2-secret.key.gpg" | gpg2 --import --allow-secret-key-import + + diff --git a/backups/Code.git.bundle b/backups/Code.git.bundle new file mode 100644 index 0000000..c80c347 --- /dev/null +++ b/backups/Code.git.bundle Binary files differ diff --git a/backups/JenkinsConfig.git.bundle b/backups/JenkinsConfig.git.bundle new file mode 100644 index 0000000..495d9ec --- /dev/null +++ b/backups/JenkinsConfig.git.bundle Binary files differ diff --git a/backups/README.md b/backups/README.md index fe6855d..dc8de5c 100644 --- a/backups/README.md +++ b/backups/README.md @@ -2,16 +2,28 @@ README ====== +Setup Instructions +------------------ + +Run the ./setup.sh script to initialize the backup system. This is interactive +and needed to construct the secret keys needed for the encryption. + + Backup Instructions ------------------- Run the ./backup.sh script which will find the repos, bundle, encrypt and then copy them to the server. +This is designed to be non-interactive so that it can be run from a jenkins +job or cron-job etc. + Restore Instructions -------------------- +This is interactive and requires entering passwords to decrpyt the backups. + On a local machine run the following: ``` diff --git a/backups/WickedDocs.git.bundle b/backups/WickedDocs.git.bundle new file mode 100644 index 0000000..529ad49 --- /dev/null +++ b/backups/WickedDocs.git.bundle Binary files differ diff --git a/backups/backup.sh b/backups/backup.sh index 4c7958e..03cbef9 100755 --- a/backups/backup.sh +++ b/backups/backup.sh @@ -1,48 +1,26 @@ #!/bin/bash -USER=jryland -SERVER=http://gitbucket.localdomain -DESTINATION="${USER}@invertedlogic.com:/home/${USER}/backups/" - -# Save encryption keys for later decryption (keys are encrypted, will prompt) -# if [ ! -f "${USER}-gpg2-secret.key.gpg" ] -# then -# gpg2 -a --export-secret-keys ${USER}@xiaofrog.com > "${USER}-gpg2-secret.key" -# gpg2 --symmetric jryland-gpg2-secret.key -# fi -# if [ ! -f "${USER}-gpg2-ownertrust.txt" ] -# then -# gpg2 --export-ownertrust > "${USER}-gpg2-ownertrust.txt" -# fi - -# Import the keys needed for decryption -# gpg2 --batch --import "${USER}-gpg2-secret.key" -# gpg2 --batch --import-ownertrust "${USER}-gpg2-ownertrust.txt" - -# Save to server -rsync -v "README.md" "${DESTINATION}" -rsync -v "restore.sh" "${DESTINATION}" -rsync -v "${USER}-gpg2-secret.key.gpg" "${DESTINATION}" -rsync -v "${USER}-gpg2-ownertrust.txt" "${DESTINATION}" - +BACKUP_USER=jryland +REPO_SERVER=http://gitbucket.localdomain # Get list of repos -curl -s "${SERVER}/api/v3/users/${USER}/repos" | jq -r '.[] | .name' | while read REPO +curl -s "${REPO_SERVER}/api/v3/users/${BACKUP_USER}/repos" | jq -r '.[] | .name' | while read REPO do # Copy and compress up the repo echo "Backing up $REPO" - git clone --mirror "${SERVER}/git/${USER}/${REPO}.git" + git clone --mirror "${REPO_SERVER}/git/${BACKUP_USER}/${REPO}.git" cd "${REPO}.git" git bundle create "../${REPO}.git.bundle" --all cd .. # Encrypt and copy to destination echo "Encrypting backup of $REPO" - gpg2 --yes -er "${USER}" "${REPO}.git.bundle" - rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" + gpg2 --yes -er "${BACKUP_USER}" "${REPO}.git.bundle" + +# rsync -v "${REPO}.git.bundle.gpg" "${DESTINATION}" # Cleanup any temporary files created - rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" +# rm -rf "${REPO}.git" "${REPO}.git.bundle" "${REPO}.git.bundle.gpg" done diff --git a/backups/invertedlogic.git.bundle b/backups/invertedlogic.git.bundle new file mode 100644 index 0000000..eb25f0f --- /dev/null +++ b/backups/invertedlogic.git.bundle Binary files differ diff --git a/backups/jryland-gpg2-ownertrust.txt b/backups/jryland-gpg2-ownertrust.txt deleted file mode 100644 index 887176a..0000000 --- a/backups/jryland-gpg2-ownertrust.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of assigned trustvalues, created Sun 10 Nov 2019 23:38:55 AEST -# (Use "gpg --import-ownertrust" to restore them) -449CECBAB6924CDEC4533986876096FDF46AC543:6: -8054E0482B068FEA6D882C5C9AA33C67D0281B5E:6: diff --git a/backups/jryland-gpg2-public.key.gpg b/backups/jryland-gpg2-public.key.gpg new file mode 100644 index 0000000..6053967 --- /dev/null +++ b/backups/jryland-gpg2-public.key.gpg Binary files differ diff --git a/backups/jryland-gpg2-secret.key.gpg b/backups/jryland-gpg2-secret.key.gpg index 60c9b87..3d6140b 100644 --- a/backups/jryland-gpg2-secret.key.gpg +++ b/backups/jryland-gpg2-secret.key.gpg Binary files differ diff --git a/backups/restore.sh b/backups/restore.sh index 69e9414..0246e91 100755 --- a/backups/restore.sh +++ b/backups/restore.sh @@ -1,7 +1,7 @@ #!/bin/bash -USER=jryland -SOURCE="${USER}@invertedlogic.com:/home/${USER}/backups" +BACKUP_USER=jryland +SOURCE="${BACKUP_USER}@invertedlogic.com:/home/${BACKUP_USER}/backups" DESTINATION=restored echo "*********************************" @@ -20,9 +20,11 @@ read # Import the keys needed for decryption -gpg2 --decrypt "backups/${USER}-gpg2-secret.key.gpg" > "backups/${USER}-gpg2-secret.key" -gpg2 --import "backups/${USER}-gpg2-secret.key" -gpg2 --import-ownertrust "backups/${USER}-gpg2-ownertrust.txt" +#gpg2 --decrypt "backups/${BACKUP_USER}-gpg2-secret.key.gpg" > "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import "backups/${BACKUP_USER}-gpg2-secret.key" +#gpg2 --import-ownertrust "backups/${BACKUP_USER}-gpg2-ownertrust.txt" +gpg2 -d "backups/${BACKUP_USER}-gpg2-public.key.gpg" | gpg2 --import +gpg2 -d "backups/${BACKUP_USER}-gpg2-secret.key.gpg" | gpg2 --import --allow-secret-key-import echo "Passphase is the password like this: 'a******5* ' replacing '*' as appropriate with trailing spaces" echo "Press enter to continue or Ctrl-C to cancel" diff --git a/backups/setup.sh b/backups/setup.sh new file mode 100755 index 0000000..aa4d251 --- /dev/null +++ b/backups/setup.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +BACKUP_USER=jryland + +echo "*********************************" +echo "********* IMPORTANT *********" +echo "*********************************" +echo "This will change your ~/.gnupg directory, however it will" +echo "make a backup to ~/.gnupg-bak. Do you still want to proceed?" +echo "Press enter to continue or Ctrl-C to cancel" +read + +if [ -d ~/.gnupg-bak ] +then + echo "Backup of ~/.gnupg directory already exists, bailing out" + exit +fi +if [ -d ~/.gnupg ] +then + mv ~/.gnupg ~/.gnupg-bak +fi +if [ -d ~/.gnupg ] +then + echo "Still a ~/.gnupg directory exists, bailing out" + exit +fi + +if [ ! -f "${BACKUP_USER}-gpg2-secret.key.gpg" ] +then + cat | gpg2 --verbose --batch --full-gen-key << EOF + %echo Generating a basic OpenPGP key + Key-Type: RSA + Key-Length: 4096 + Subkey-Type: RSA + Subkey-Length: 4096 + Name-Real: John Ryland + Name-Comment: ${BACKUP_USER} + Name-Email: jryland@xiaofrog.com + Expire-Date: 0 + +EOF + gpg2 --export-secret-keys ${BACKUP_USER} | gpg2 --symmetric --cipher-algo AES256 > ${BACKUP_USER}-gpg2-secret.key.gpg + gpg2 --export ${BACKUP_USER} | gpg2 --symmetric --cipher-algo AES256 > ${BACKUP_USER}-gpg2-public.key.gpg +fi + +gpg2 --batch -d "${BACKUP_USER}-gpg2-public.key.gpg" | gpg2 --import +gpg2 --batch -d "${BACKUP_USER}-gpg2-secret.key.gpg" | gpg2 --import --allow-secret-key-import + + diff --git a/queue.xml b/queue.xml index 54b7746..0a24774 100644 --- a/queue.xml +++ b/queue.xml @@ -1,5 +1,5 @@ - 770 + 774 \ No newline at end of file