2 # This shell-script will import some GNS authorities into your GNS
5 LOCATION=$(which gnunet-config)
8 LOCATION="gnunet-config"
10 $LOCATION --version 1> /dev/null
13 echo "GNUnet command line tools not found, check environmental variables PATH and GNUNET_PREFIX"
17 gnunet-arm -I 1> /dev/null 2>/dev/null
20 echo "GNUnet is not running, please start GNUnet before running import"
26 while getopts "c:" opt; do
29 options="$options -c $OPTARG"
32 echo "Invalid option: -$OPTARG" >&2
36 echo "Option -$OPTARG requires an argument." >&2
42 # By default, we create two GNS zones:
43 gnunet-identity -C master-zone $options
44 gnunet-identity -C private-zone $options
46 # Additionally, we create the FS SKS zone
47 gnunet-identity -C sks-zone $options
49 #### Integrate those with the respective subsystems ####
51 # Zone for shortening by gns-proxy,
52 # (remove this entry to disable shortening)
53 gnunet-identity -e short-zone -s gns-short $options
55 # Default zone for 'gnunet-gns' lookups
56 gnunet-identity -e master-zone -s gns-master $options
58 # Default zone for 'gnunet-namestore' operations
59 gnunet-identity -e master-zone -s namestore $options
61 # Use master-zone for GNS proxy lookups
62 gnunet-identity -e master-zone -s gns-proxy $options
64 # Use master-zone for intercepted DNS queries
65 # (remove this entry to disable DNS interception by GNS service)
66 gnunet-identity -e master-zone -s gns-intercept $options
68 # Use master-zone for DNS2GNS proxy.
69 gnunet-identity -e master-zone -s dns2gns $options
71 # 'gns-private' is not yet used (!)
72 gnunet-identity -e private-zone -s gns-private $options
74 # 'fs-sks' default ego for gnunet-fs-gtk namespace operations
75 gnunet-identity -e sks-zone -s fs-sks $options
77 # Get the public keys as strings (so we can create PKEY records)
78 MASTER=`gnunet-identity -d $options | grep master-zone | awk '{print $3}'`
79 SHORT=`gnunet-identity -d $options | grep short-zone | awk '{print $3}'`
80 PRIVATE=`gnunet-identity -d $options | grep private-zone | awk '{print $3}'`
81 PIN=DWJASSPE33MRN8T6Q0PENRNBTQY0E6ZYGTRCDP5DGPBF2CRJMJEG
83 # Link short and private zones into master zone
84 if (gnunet-namestore -z master-zone -D -n private -t PKEY | grep "PKEY: $PRIVATE" 1>/dev/null)
86 echo "Private zone link exists, skipping"
88 gnunet-namestore -z master-zone -a -e never -n private -p -t PKEY -V $PRIVATE $options
90 if (gnunet-namestore -z master-zone -D -n short -t PKEY | grep "PKEY: $SHORT" 1>/dev/null)
92 echo "Shorten zone link exists, skipping"
94 gnunet-namestore -z master-zone -a -e never -n short -p -t PKEY -V $SHORT $options
97 # Link GNUnet's FCFS zone into master zone under label "pin"
98 if (gnunet-namestore -z master-zone -D -n pin -t PKEY | grep "PKEY: $PIN" 1>/dev/null)
100 echo "Pin zone link exists, skipping"
102 gnunet-namestore -z master-zone -a -e never -n pin -p -t PKEY -V $PIN $options