Add script to listfriends and to import friends

This commit is contained in:
Nico Schottelius 2019-09-10 02:03:49 +09:00
parent 3b8e2bff86
commit 5e7312aca3
4 changed files with 55 additions and 9 deletions

View file

@ -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,22 +124,46 @@ 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) <ipv6@nico.ungleich.cloud>
Nico Schottelius (myself) (RIF https://nico2.ungleich.cloud) <nico@nico.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

5
rif-checkfriends.sh Normal file → Executable file
View file

@ -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/')
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
curl -6 -s "$url" > /dev/null && online=online
echo $name is $online
done
)

15
rif-importfriends.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
# 2019-09-10, Nico Schottelius, Seoul
if [ $# -lt 1 ]; then
echo "$0: <URL> [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

4
rif-listfriends.sh Executable file
View file

@ -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/:/'