#! /bin/bash /folder/setup_volumes.sh
# Gcrypt - clean setup to staged data and snapshot backup volumes
## Install
apt install sudo git gpg
cat >>.bashrc <<END_gpg-pinentry-agent
GPG_TTY=\$(tty)
export GPG_TTY
END_gpg-pinentry-agent
source .bashrc
#git clone https://git.spwhitton.name/git-remote-gcrypt
#python docutils for rst2man
#./git-remote-gcrypt/install.sh
## Remove previous setup - start again
#sudo -i
cd /root
rm -rf .gnupg/ .git test/cryptremote
ssh nrb@server.consulting -- rm -rf cryptremote
## New keypair
gpg --gen-key
## Initialise local
git init
chmod -R u=Xrw,g=,o= .git
git add keyfiles # my data
git commit -a -m "clean setup of staged data and snapshot backup volumes"
## Initialise remote
ssh nrb@server.consulting -- git init --bare cryptremote
git remote add cryptremote gcrypt::nrb@server.consulting:cryptremote
git config user.signingkey my.name@provider.com
git config remote.sharedencrypted.gcryt-participants my.name@provider.com
git push cryptremote master
## Test
mkdir -p test; cd test
git clone gcrypt::nrb@server.consulting:cryptremote
: <<END_Transcript
setup_volumes.sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'gnupg' instead of 'gpg'
gnupg is already the newest version (2.1.15-1ubuntu7).
git is already the newest version (1:2.11.0-2ubuntu0.3).
sudo is already the newest version (1.8.19p1-1ubuntu1.2).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
nrb@server.consulting's password:
gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: directory '/root/.gnupg' created
gpg: new configuration file '/root/.gnupg/dirmngr.conf' created
gpg: new configuration file '/root/.gnupg/gpg.conf' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
Note: Use "gpg --full-gen-key" for a full featured key generation dialogue.
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: My Name
E-mail address: my.name@provider.com
You selected this USER-ID:
"My Name <my.name@provider.com>"
Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilise the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilise the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key FD3D36B2AE69B008 marked as ultimately trusted
gpg: directory '/root/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/root/.gnupg/openpgp-revocs.d/6FF30D740F1766D332E95FA4FD3D36B2AE69B008.rev'
public and secret key created and signed.
pub rsa2048 2017-11-07 [SC]
6FF30D740F1766D332E95FA4FD3D36B2AE69B008
uid My Name <my.name@provider.com>
sub rsa2048 2017-11-07 [E]
Initialised empty Git repository in /root/.git/
[master (root-commit) d85fcea] clean setup of staged data and snapshot backup volumes
39 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 keyfiles/012b1cc9-dfcd-496e-83d3-2cdb333f0041
create mode 100644 keyfiles/026fdfa2-acbf-4c37-aca0-be36faa9c6c1
create mode 100644 keyfiles/e955daec-1d14-4963-a799-414394862aa5
create mode 100644 keyfiles/ec75b9a8-4c36-4da6-9bc3-e64118b64527
create mode 100644 keyfiles/eeeb9ece-d7f1-4397-98ed-ff531cd4df3e
nrb@server.consulting's password:
Initialized empty Git repository in /home/nrb/cryptremote/
nrb@server.consulting's password:
gcrypt: Repository not found: nrb@server.consulting:cryptremote
gcrypt: Setting up new repository
nrb@server.consulting's password:
gcrypt: Remote ID is :id:ygMfNKZJt6I8PUCxhZYD
Counting objects: 42, done.
Compressing objects: 100% (41/41), done.
Total 42 (delta 0), reused 0 (delta 0)
gcrypt: Encrypting to: --throw-keyids --default-recipient-self
gcrypt: Requesting manifest signature
nrb@server.consulting's password:
To server.consulting:cryptremote
* [new branch] master -> master
Cloning into 'cryptremote'...
nrb@server.consulting's password:
gcrypt: Decrypting manifest
gpg: decryption failed: No secret key
gcrypt: Failed to decrypt manifest!
END_Transcript