-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpg-sync
More file actions
executable file
·30 lines (22 loc) · 941 Bytes
/
gpg-sync
File metadata and controls
executable file
·30 lines (22 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#echo "early version, edit script and be sure to have a backup of .gnupg!!"
#exit 1
if [ $# -eq 0 ] || [ "$1" == "-h" ]; then
echo "sync gpg keyring 2-way over ssh
usage: gpg-sync user@targethost [sshopts]"
exit
fi
GPG="gpg"
EXPORT_SEC="--export-secret-keys --export-options=export-local-sigs,export-sensitive-revkeys"
EXPORT_PUB="--export --export-options=export-local-sigs,export-sensitive-revkeys"
IMPORT="--import --allow-non-selfsigned-uid --import-options=import-local-sigs -"
EXPORT_OWNERTRUST="--export-ownertrust"
IMPORT_OWNERTRUST="--import-ownertrust"
$GPG $EXPORT_SEC | ssh $@ $GPG $IMPORT
ssh $@ $GPG $EXPORT_SEC | $GPG $IMPORT
$GPG $EXPORT_PUB | ssh $@ $GPG $IMPORT
ssh $@ $GPG $EXPORT_PUB | $GPG $IMPORT
$GPG $EXPORT_OWNERTRUST | grep -v "^#" | ssh $@ $GPG $IMPORT_OWNERTRUST
ssh $@ $GPG $EXPORT_OWNERTRUST \| grep -v "^#" | $GPG $IMPORT_OWNERTRUST
$GPG --check-trustdb
ssh $@ $GPG --check-trustdb