From 5e7312aca321c8fee753f0734144923f1d8f55ad Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 10 Sep 2019 02:03:49 +0900 Subject: Add script to listfriends and to import friends --- README.md | 28 +++++++++++++++++++++++++++- rif-checkfriends.sh | 15 ++++++++------- rif-importfriends.sh | 15 +++++++++++++++ rif-listfriends.sh | 4 ++++ 4 files changed, 54 insertions(+), 8 deletions(-) mode change 100644 => 100755 rif-checkfriends.sh create mode 100755 rif-importfriends.sh create mode 100755 rif-listfriends.sh diff --git a/README.md b/README.md index 0cbcd48..050f0bb 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ To become a real IPv6 friend, you need to do the following things: - Setup a webserver on your computer - Export your key and all real IPv6 friend keys to your webserver as "rifkeys.txt -- For each of your friends, check whether they are online! +- For each of your friends, check whether they are online +- Import the friends of your friends and check whether they are + online, too! ### Example: Generating a key with the right comment @@ -122,21 +124,45 @@ gpg -a --export RIF > /var/www/html/rifkeys ### Example: List your friends +You can use the included rif-listfriends.sh or directly gpg: + ``` [1:40] line:~% gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/' Nico Schottelius (RIF https://nico.ungleich.cloud) Nico Schottelius (myself) (RIF https://nico2.ungleich.cloud) ``` + ### Example: Checking which friends are online Use the included rif-checkfriends.sh script or iterate yourself over above output. ``` +[1:54] line:realipv6friend% sh rif-checkfriends.sh +Checking Nico Schottelius on https://nico.ungleich.cloud ... +Nico Schottelius is online +Checking Nico Schottelius (myself) on https://nico2.ungleich.cloud ... +Nico Schottelius (myself) is offline +[1:54] line:realipv6friend% + +``` + +### Example: Importing friends of my friend +Importing friends of a friend is as simple as importing all the +exported keys! We import friends directly from the URL of a friend: ``` +curl -6 -s https://nico.ungleich.cloud/rifkeys | gpg --import +``` + +You can also use + +### Example: Sending a message to a friend + +Simply use your mail program for that. +And obviously enable signing & encrypting the email. ## To be added diff --git a/rif-checkfriends.sh b/rif-checkfriends.sh old mode 100644 new mode 100755 index af7e4d6..24bb12f --- a/rif-checkfriends.sh +++ b/rif-checkfriends.sh @@ -3,12 +3,13 @@ gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/' | ( while read line - do name=$(echo $line | sed 's/\(.*\)(.*/\1/') - # Assume by default offline - online=offline - url=$(echo $line | sed -e 's/.*(RIF //' -e 's/).*//') - echo "Checking $name on $url ..." - curl -s "$url" > /dev/null && online=online - echo $name is $online + do + name=$(echo $line | sed 's/\(.*\)(.*/\1/') + # Assume by default offline + online=offline + url=$(echo $line | sed -e 's/.*(RIF //' -e 's/).*//') + echo "Checking $name on $url ..." + curl -6 -s "$url" > /dev/null && online=online + echo $name is $online done ) diff --git a/rif-importfriends.sh b/rif-importfriends.sh new file mode 100755 index 0000000..887abc2 --- /dev/null +++ b/rif-importfriends.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# 2019-09-10, Nico Schottelius, Seoul + +if [ $# -lt 1 ]; then + echo "$0: [URL...]" + echo "URL: of your real IPv6 friend(s)" + exit 1 +fi + +while [ $# -ge 1 ]; do + url=$1; shift + fullurl=${url}/rifkeys + + curl -6 -s "${fullurl}" | gpg --import +done diff --git a/rif-listfriends.sh b/rif-listfriends.sh new file mode 100755 index 0000000..f228be5 --- /dev/null +++ b/rif-listfriends.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# 2019-09-10, Nico Schottelius, Seoul + +gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/' -- cgit v1.2.3