wip
This commit is contained in:
@@ -65,7 +65,7 @@ aur:yt-dlp-git # cli downloader - youtube-dl fork
|
||||
#aur:ctpv # lf file previewer
|
||||
#aur:megacmd # mega cli
|
||||
|
||||
fd # user-friendly alternative to find
|
||||
fd # user-friendly alternative to find | https://github.com/sharkdp/fd
|
||||
#zed # code editor
|
||||
ufw # cli tool for managing a netfilter firewall
|
||||
superfile # terminal file manager
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
# klevstul :: 26.02.24
|
||||
|
||||
|
||||
# make sure cryptLocal is mounted and available
|
||||
|
||||
src_dir=/home/poq/.local/share/Cryptomator/mnt/cryptLocal
|
||||
tmp_dir=/tmp
|
||||
trg_dir=/home/poq/syncDir/0_downloads
|
||||
|
||||
# make sure cryptLocal is mounted and available
|
||||
if ! [ -d "$src_dir" ]
|
||||
then
|
||||
echo "missing source directory:"
|
||||
|
||||
@@ -49,7 +49,7 @@ if [[ ${user_input} == "y" ]]; then
|
||||
echo "please, remember the hint: poq.l2"
|
||||
|
||||
for file in ${src_ssh_dir}/*.gpg; do
|
||||
echo "processing '$file'"
|
||||
echo "processing '${file}'"
|
||||
|
||||
filename="${file##*/}" # get basename
|
||||
filename="${filename%.*}" # remove extension
|
||||
|
||||
41
dots/bin/exportGpgKeysToSecrets.sh
Executable file
41
dots/bin/exportGpgKeysToSecrets.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# klevstul :: 26.02.25
|
||||
|
||||
|
||||
src_dir=/home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg
|
||||
tmp_dir=/tmp
|
||||
trg_dir=/home/poq/syncDir/secrets/gnupg
|
||||
|
||||
# make sure the dirs are available
|
||||
if ! [ -d "$src_dir" ]
|
||||
then
|
||||
echo ""
|
||||
echo "ERROR: can not open '$src_dir'! is the cryptLocal vault mounted?"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [ -d "$trg_dir" ]
|
||||
then
|
||||
echo ""
|
||||
echo "ERROR: can not open '$trg_dir'!"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
||||
# zip the content
|
||||
timestamp=$(date +%y%m%d)
|
||||
zip_file=${tmp_dir}/${timestamp}_gnupgKeys.zip
|
||||
zip -r "${zip_file}" "${src_dir}/" -i "*.asc"
|
||||
|
||||
# gpg encrypt the content
|
||||
gpg --encrypt --sign --recipient frode@klevstul.com "${zip_file}"
|
||||
|
||||
# delete the .zip file
|
||||
srm -v "${zip_file}"
|
||||
|
||||
# move the .gpg file to the target dir
|
||||
mv "${zip_file}.gpg" "${trg_dir}/"
|
||||
|
||||
ls -al "${trg_dir}/"
|
||||
@@ -1,31 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# klevstul :: 24.06
|
||||
# klevstul :: 24.06 :: docs: docs/gpg.md
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# how to backup gpg:
|
||||
#
|
||||
# new method:
|
||||
# cp /home/poq/.gnupg/
|
||||
# gpg --armor --export frode@klevstul.com > /home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg/251110_frodeKlevstul_publicKey.asc
|
||||
# gpg --armor --export-secret-keys frode@klevstul.com > /home/poq/.local/share/Cryptomator/mnt/cryptLocal/content/keys/openPgp/.gnupg/251110_frodeKlevstul_privateKey.asc
|
||||
#
|
||||
# old method:
|
||||
# gpg --export --export-options backup --output public.gpg frode@thisworld.is
|
||||
# gpg --export-secret-keys --export-options backup --output private.gpg frode@thisworld.is
|
||||
# ref: https://www.howtogeek.com/816878/how-to-back-up-and-restore-gpg-keys-on-linux/
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
src_dir=/home/poq/syncDir/secrets/gnupg
|
||||
tmp_dir=/tmp
|
||||
|
||||
this_file_name=`basename "$0"`
|
||||
echo "$this_file_name"
|
||||
|
||||
echo "please, remember the hint: poq.l2"
|
||||
|
||||
# location of ssh keys
|
||||
syncdir_env_var=SYNCDIR_${HOSTNAME}
|
||||
src_gnupg_dir=${!syncdir_env_var}/secrets/gnupg
|
||||
# copy .zip.gpg to tmp dir
|
||||
cp ${src_dir}/*.zip.gpg ${tmp_dir}
|
||||
|
||||
gpg --import ${src_gnupg_dir}/*publicKey.asc
|
||||
gpg --import ${src_gnupg_dir}/*privateKey.asc
|
||||
# decrypt .gpg
|
||||
gpg --decrypt --output ${tmp_dir}/gpgKeys.zip ${tmp_dir}/*.zip.gpg
|
||||
|
||||
# extract .zip
|
||||
unzip -j -d ${tmp_dir} ${tmp_dir}/gpgKeys.zip
|
||||
|
||||
# delete decrypted zip file
|
||||
srm -v ${tmp_dir}/gpgKeys.zip
|
||||
|
||||
# import keys
|
||||
for file in ${tmp_dir}/*.asc; do
|
||||
echo "processing '${file}'"
|
||||
|
||||
gpg --import ${file}
|
||||
trash-put ${file}
|
||||
done
|
||||
|
||||
gpg --list-secret-keys --keyid-format LONG
|
||||
|
||||
Reference in New Issue
Block a user