aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-07-26 01:44:31 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-07-26 01:44:31 +0300
commitb9f350ee20251746c540ff352e7082e66b9c5ac8 (patch)
tree7a828b33eec8efa8cde06792ea7c92ba075e254a
parent00f3e970c39adb28e24a6ac0cdbfffc8bac8ac67 (diff)
downloadarching-kaos-tools-b9f350ee20251746c540ff352e7082e66b9c5ac8.tar.gz
arching-kaos-tools-b9f350ee20251746c540ff352e7082e66b9c5ac8.tar.bz2
arching-kaos-tools-b9f350ee20251746c540ff352e7082e66b9c5ac8.zip
ak-gpg: new flag --verify-file <file>
-rwxr-xr-xbin/ak-cjdns4
-rwxr-xr-xbin/ak-clean1
-rwxr-xr-xbin/ak-config4
-rwxr-xr-xbin/ak-gpg17
-rwxr-xr-xbin/ak-log4
-rwxr-xr-xbin/ak-network4
-rwxr-xr-xbin/ak-node-info2
-rwxr-xr-xbin/ak-profile5
-rwxr-xr-xbin/ak-sblock1
-rwxr-xr-xbin/ak-schain2
-rwxr-xr-xbin/ak-settings2
-rwxr-xr-xbin/ak-zchain11
-rwxr-xr-xlib/_ak_gpg17
-rwxr-xr-xlib/_ak_zblock2
-rwxr-xr-xmodules/categories/main.sh4
-rwxr-xr-xmodules/comments/main.sh3
-rwxr-xr-xmodules/folders/main.sh2
-rwxr-xr-xmodules/follow/main.sh3
-rwxr-xr-xmodules/mixtapes/main.sh2
-rwxr-xr-xmodules/news/main.sh8
-rwxr-xr-xmodules/smfiles/main.sh4
-rwxr-xr-xmodules/todos/main.sh4
22 files changed, 20 insertions, 86 deletions
diff --git a/bin/ak-cjdns b/bin/ak-cjdns
index cff1589..3abc254 100755
--- a/bin/ak-cjdns
+++ b/bin/ak-cjdns
@@ -5,13 +5,9 @@
## Usage:
##
## -h, --help Prints this help message
-##
## --check Check for binaries
-##
## --install Install cjdns
-##
## --connect Connect to ak cjdns nodes
-##
## --ip Returns your cjdns IPv6
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-clean b/bin/ak-clean
index 2411190..8d28d74 100755
--- a/bin/ak-clean
+++ b/bin/ak-clean
@@ -10,7 +10,6 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -c, --clean Removes all /tmp/aktmp* directories
##
diff --git a/bin/ak-config b/bin/ak-config
index 49eec45..4418ba3 100755
--- a/bin/ak-config
+++ b/bin/ak-config
@@ -3,13 +3,9 @@
## Usage: ak-config [ -h | --help | --show | --publish | --get-published ]
##
## -h, --help Show this help screen
-##
## --show Show current configuration (from FileSystem)
-##
## --publish Publish current configuration
-##
## --get-published Get published ak-config (from IPFS)
-##
## --get-ipns-key Get the ak-config IPNS key
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-gpg b/bin/ak-gpg
index 23c3726..2c8bbdc 100755
--- a/bin/ak-gpg
+++ b/bin/ak-gpg
@@ -5,39 +5,25 @@
## Usage:
##
## -h, --help Prints this help message
-##
## --get-key-self-as-ipfs Returns your key as an IPFS hash
-##
## --get-key-self-as-fingerprint Returns the fingerprint of your key
-##
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
-##
## --export-key-self-to-file Exports self public key as 'self.pub'
-##
## --clear-sign <file> <output> Sign a file clearly
-##
+## --verify-file <file> Verify a clear signed file
## -l, --list-keys Returns a list of known GPG keys
-##
## -lp, --list-keys-plain Returns a list of known GPG keys as
## plain GPG output
-##
## -ll, --list-keys-long Returns a list of known GPG keys with
## their 1st uid
-##
## -ls, --list-secret-keys Returns a list of secret GPG keys
-##
## -lsp, --list-secret-keys-plain Returns a list of secret GPG keys as
## plain GPG output
-##
## -lsl, --list-secret-keys-long Returns a list of secret GPG keys with
## their 1st uid
-##
## -c, --create-key <email> Creates a GPG key with a label <email>
-##
## -s, --select-key Selects the GPG key you want to use
-##
## -d, --delete-key Delete GPG keys from your keyring
-##
## -ds, --delete-secret-key <fingerprint>
## Delete GPG keys from your keyring
##
@@ -62,6 +48,7 @@ if [ ! -z $1 ]; then
--get-key-fingerprint-from-ipfs) _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
+ --verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
--list-keys-long | -ll) _ak_gpg_list_keys_long; exit;;
--list-keys-plain | -lp) _ak_gpg_list_keys_plain; exit;;
diff --git a/bin/ak-log b/bin/ak-log
index d22da70..3e7f8b6 100755
--- a/bin/ak-log
+++ b/bin/ak-log
@@ -5,15 +5,11 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -f, --follow Follows the log file as its appended with new
## messages
-##
## -m, --message <program> <type> <message>
## Adds a log message to the log
-##
## -r, --rotate Cleans up log files after archiving them
-##
## -g, --grep Select a script to view only logs from that
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-network b/bin/ak-network
index 02bee20..5cafd86 100755
--- a/bin/ak-network
+++ b/bin/ak-network
@@ -5,17 +5,13 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -c, --connect [ipfs|cjdns] Connect to network(s)
-##
## -p, --peers [ipfs|cjdns|stellar] Outputs peers found
-##
## -s, --scan [ipfs|cjdns|stellar] Scan network(s) for peers
##
## Bonus: CJDNS network scanning modes
##
## -s, --scan cjdns [-w|--whole] Scan using HIA's knowledge
-##
## -s, --scan cjdns [-d|--dump] Scan using CJDNS' dumpLinks (default)
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-node-info b/bin/ak-node-info
index 42f6822..b3933c1 100755
--- a/bin/ak-node-info
+++ b/bin/ak-node-info
@@ -5,9 +5,7 @@
## Usage:
##
## -h, --help Prints this help message
-##
## --ipfs
-##
## --ipns
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-profile b/bin/ak-profile
index 67b67d1..a595080 100755
--- a/bin/ak-profile
+++ b/bin/ak-profile
@@ -6,14 +6,10 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -l, --local-index Show current status
-##
## --show <data IPFS CIDv0> Show profile entry from specified DATA
## IPFS CIDv0
-##
## -s, --set <property> <value> Sets a profile value
-##
## -g, --get <property> Gets a profile value from the on-disk
## file.
##
@@ -22,7 +18,6 @@
## -a, --add <file> Creates a data file from the profile file
## you point (file should already be in
## ZPROFILEDIR).
-##
## -i, --import <folder> Import a folder to zchain #TODO
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-sblock b/bin/ak-sblock
index 68e6870..3766b96 100755
--- a/bin/ak-sblock
+++ b/bin/ak-sblock
@@ -5,7 +5,6 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -s, --show <sblock-hash> Show a particular SBLOCK
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-schain b/bin/ak-schain
index 5d4a442..3164eeb 100755
--- a/bin/ak-schain
+++ b/bin/ak-schain
@@ -5,9 +5,7 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -c, --crawl Crawl an schain or latest known
-##
## -l, --get-latest Returns latest sblock from saved sblocks. The
## latest sblock would belong to the longest
## schain if more than one schains found.
diff --git a/bin/ak-settings b/bin/ak-settings
index 45fca1e..d2c87fb 100755
--- a/bin/ak-settings
+++ b/bin/ak-settings
@@ -5,10 +5,8 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -g, --get [key] Gets all the settings or, in case key is set,
## returns only the key-value specified
-##
## -s, --set <key> <value> Sets the settings.key to value
##
fullprogrampath="$(realpath $0)"
diff --git a/bin/ak-zchain b/bin/ak-zchain
index 73d38ba..eabd9a4 100755
--- a/bin/ak-zchain
+++ b/bin/ak-zchain
@@ -5,7 +5,6 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -r, --reset Reset zchain
## Backs up your latest block into IPFS
## filesystem, replaces it with an empty file
@@ -15,7 +14,6 @@
## This program, does NOT delete anything from
## your IPFS repository, neither denies access to
## previously created blocks.
-##
## --rebase <zblock> Rebase zchain to a zblock
## Backs up your latest block into IPFS
## filesystem, replaces it with a zblock and
@@ -25,24 +23,15 @@
## This program, does NOT delete anything from
## your IPFS repository, neither denies access to
## previously created blocks.
-##
## --rebase-back-one Rebase zchain one zblock back
-##
## --extract-cids Extracts IPFS CIDv0 links of a zchain
-##
## --extract-data-cids Extracts data IPFS CIDv0 links from a zchain
-##
## --calculate-size Calculates the size of a zchain
-##
## --crawl Crawls zchains ( --crawl --help for more
## options)
-##
## --crawl-self Crawls the local zchain
-##
## --crawl-remote-ipfs Crawls a remote zchain
-##
## --crawl-remote-ipns Crawls a remote zchain from ipns key
-##
## --get-latest Returns the latest zblock from your zchain
##
fullprogrampath="$(realpath $0)"
diff --git a/lib/_ak_gpg b/lib/_ak_gpg
index af65fcb..b381067 100755
--- a/lib/_ak_gpg
+++ b/lib/_ak_gpg
@@ -149,6 +149,23 @@ _ak_gpg_encrypt_for_self(){
fi
}
+_ak_gpg_verify_clear_signature(){
+ if [ ! -z $1 ] && [ -n "$1" ] && [ -f "$1" ]
+ then
+ fingerprint="$(cat $1 | _ak_gpg 2>&1 | grep RSA | awk '{print $5}')"
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "Could not verify signature"
+ exit 1
+ fi
+ _ak_log_debug "$1 signed with $fingerprint"
+ cat $1 | _ak_gpg 2> /dev/null
+ else
+ _ak_log_error "Failed to verify detached signature $1 against $2"
+ exit 1
+ fi
+}
+
_ak_gpg_verify_signature(){
if [ ! -z $1 ] && [ -n "$1" ] && [ -f "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ -f "$2" ]
then
diff --git a/lib/_ak_zblock b/lib/_ak_zblock
index 73f5f9e..6657c25 100755
--- a/lib/_ak_zblock
+++ b/lib/_ak_zblock
@@ -685,7 +685,7 @@ _ak_zblock_repack(){
}
_ak_zblock_pack(){
- if [ ! -z $2 ];
+ if [ ! -z $2 ]
then
MESSAGE="$2"
ACTION="$1"
diff --git a/modules/categories/main.sh b/modules/categories/main.sh
index 089b6d7..f8beb8a 100755
--- a/modules/categories/main.sh
+++ b/modules/categories/main.sh
@@ -1,13 +1,9 @@
#!/bin/bash
##
## -h, --help Prints this help message"
-##
## index Prints an indexed table of your news files"
-##
## import <file> #TODO"
-##
## add <file> Creates a data file from the news file you point to"
-##
## create Vim is going to pop up, you will write and save your"
## newsletter and it's going to be saved"
##
diff --git a/modules/comments/main.sh b/modules/comments/main.sh
index 925bf90..59fb46f 100755
--- a/modules/comments/main.sh
+++ b/modules/comments/main.sh
@@ -1,11 +1,8 @@
#!/bin/bash
##
## -h, --help Prints this help message"
-##
## index Prints an indexed table of your comments files"
-##
## add <file> <refer_to> Creates a data file from the comments file you point to"
-##
## create <refer_to> Vim is going to pop up, you will write and save your"
## commentsletter and it's going to be saved"
##
diff --git a/modules/folders/main.sh b/modules/folders/main.sh
index a87881d..462c5e5 100755
--- a/modules/folders/main.sh
+++ b/modules/folders/main.sh
@@ -3,8 +3,6 @@
##
##
## -h, --help Prints this help message
-##
-##
## add <folder> Try ak-folders add <folder>
##
fullprogrampath="$(realpath $0)"
diff --git a/modules/follow/main.sh b/modules/follow/main.sh
index 75be507..b5097a9 100755
--- a/modules/follow/main.sh
+++ b/modules/follow/main.sh
@@ -5,11 +5,8 @@
## Usage:
##
## -h, --help Prints this help message
-##
## -f, --follow Adds a ... to your follow list
-##
## -l, --list Shows a list of your followings
-##
## -u, --unfollow Unfollows a ...
##
fullprogrampath="$(realpath $0)"
diff --git a/modules/mixtapes/main.sh b/modules/mixtapes/main.sh
index 4456009..9748cd3 100755
--- a/modules/mixtapes/main.sh
+++ b/modules/mixtapes/main.sh
@@ -5,9 +5,7 @@
## Usage:
##
## -a <artist> <title> <file> Adds a file with tags artist and title
-##
## -h , --help
-##
## -s , --specs
##
# We can extend it by calling the _ak_zblock_pack.sh mixtape/add data ## ORIGINAL LINE
diff --git a/modules/news/main.sh b/modules/news/main.sh
index d19813c..94860ed 100755
--- a/modules/news/main.sh
+++ b/modules/news/main.sh
@@ -1,25 +1,17 @@
#!/bin/bash
##
## -h, --help Prints this help message
-##
## -l, --local-index Prints an indexed table of your news files
-##
## -i, --import <file> TODO
-##
## -a, --add <file> Creates a data file from the news file you
## point to
-##
## -r, --read <zblock> Reads a zblock as a news data
-##
## -r, --read local_latest Reads the latest zblock found on your local
## zchain
-##
## -c, --create Vim is going to pop up, you will write and
## save your newsletter and it's going to bei
## saved
-##
## -s, --specs Print specs of data block
-##
## -x, --html <zblock> Returns an appropriate html element from a
## NEWS zblock
##
diff --git a/modules/smfiles/main.sh b/modules/smfiles/main.sh
index f7662c3..0a063c9 100755
--- a/modules/smfiles/main.sh
+++ b/modules/smfiles/main.sh
@@ -2,13 +2,9 @@
## sm files
##
## -h, --help Prints this help message
-##
## --add <file> Adds file to zchain as a zblock
-##
## --index List files
-##
## --full-index List all files
-##
## --ls-map-files List map files
##
ZFILESDIR="$AK_WORKDIR/files"
diff --git a/modules/todos/main.sh b/modules/todos/main.sh
index a9786a1..4b9e580 100755
--- a/modules/todos/main.sh
+++ b/modules/todos/main.sh
@@ -5,13 +5,9 @@
## Usage:
##
## -h, --help Prints this help message
-##
## index Prints an indexed table of your todos files
-##
## import <file> #TODO
-##
## add <file> Creates a data file from the todos file you point to
-##
## create Vim is going to pop up, you will write and save your
## todosletter and it's going to be saved
##