Browse Source

Beginning of cjdns tools

Bob Mottram 10 years ago
parent
commit
ae5b977b18
1 changed files with 40 additions and 1 deletions
  1. 40
    1
      install-freedombone.sh

+ 40
- 1
install-freedombone.sh View File

@@ -593,6 +593,16 @@ function get_cjdns_port {
593 593
   fi
594 594
 }
595 595
 
596
+function get_cjdns_password {
597
+  if [ -f /home/$MY_USERNAME/README ]; then
598
+      if grep -q "cjdns password" /home/$MY_USERNAME/README; then
599
+          if [ ! $CJDNS_PASSWORD ]; then
600
+              CJDNS_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "cjdns password" | awk -F ':' '{print $2}' | sed 's/^ *//')
601
+          fi
602
+      fi
603
+  fi
604
+}
605
+
596 606
 function install_cjdns {
597 607
   if grep -Fxq "install_cjdns" $COMPLETION_FILE; then
598 608
       return
@@ -607,6 +617,7 @@ function install_cjdns {
607 617
   get_cjdns_public_key
608 618
   get_cjdns_private_key
609 619
   get_cjdns_port
620
+  get_cjdns_password
610 621
 
611 622
   if [ ! -d /etc/cjdns ]; then
612 623
       git clone https://github.com/cjdelisle/cjdns.git /etc/cjdns
@@ -773,13 +784,40 @@ function install_cjdns {
773 784
       echo "cjdns IPv6 address: $CJDNS_IPV6" >> /home/$MY_USERNAME/README
774 785
       echo "cjdns public key: $CJDNS_PUBLIC_KEY" >> /home/$MY_USERNAME/README
775 786
       echo "cjdns private key: $CJDNS_PRIVATE_KEY" >> /home/$MY_USERNAME/README
787
+      echo "cjdns password: $CJDNS_PASSWORD" >> /home/$MY_USERNAME/README
776 788
       echo "cjdns port: $CJDNS_PORT" >> /home/$MY_USERNAME/README
777
-      chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
789
+      echo '' >> /home/$MY_USERNAME/README
790
+      echo "Forward port $CJDNS_PORT from your internet router to the Freedombone" >> /home/$MY_USERNAME/README
791
+      echo '' >> /home/$MY_USERNAME/README
792
+      echo 'Below is an example of your connection credentials' >> /home/$MY_USERNAME/README
793
+      echo 'that you can give to other people so they can connect' >> /home/$MY_USERNAME/README
794
+      echo 'to you using your default password' >> /home/$MY_USERNAME/README
795
+      echo 'Adding a unique password for each user is advisable' >> /home/$MY_USERNAME/README
796
+      echo 'so that leaks can be isolated.' >> /home/$MY_USERNAME/README
797
+      echo '' >> /home/$MY_USERNAME/README
798
+      echo "\"your.external.ip.goes.here:$CJDNS_PORT\":{\"password\":\"$CJDNS_PASSWORD\",\"publicKey\":\"$CJDNS_PUBLIC_KEY\"}" >> /home/$MY_USERNAME/README
799
+	  chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
778 800
   fi
779 801
 
780 802
   echo 'install_cjdns' >> $COMPLETION_FILE
781 803
 }
782 804
 
805
+function install_cjdns_tools {
806
+  if grep -Fxq "install_cjdns_tools" $COMPLETION_FILE; then
807
+      return
808
+  fi
809
+  if [[ $ENABLE_CJDNS != "yes" ]]; then
810
+      return
811
+  fi
812
+  if [ ! -d /etc/cjdns ]; then
813
+	  install_cjdns
814
+  fi
815
+
816
+
817
+
818
+  echo 'install_cjdns_tools' >> $COMPLETION_FILE
819
+}
820
+
783 821
 function check_hwrng {
784 822
   # If hardware random number generation was enabled then make sure that the device exists.
785 823
   # if /dev/hwrng is not found then any subsequent cryptographic key generation would
@@ -7384,6 +7422,7 @@ time_synchronisation
7384 7422
 configure_internet_protocol
7385 7423
 create_git_project
7386 7424
 install_cjdns
7425
+install_cjdns_tools
7387 7426
 backup_github_projects
7388 7427
 configure_ssh
7389 7428
 check_hwrng