[tor-commits] [ooni-probe/master] Use debian/jessie instead of precise

art at torproject.org art at torproject.org
Fri Apr 29 09:42:26 UTC 2016


commit 223ba4803e17b25bc4d1a54bafc5b51896a2c14c
Author: Arturo Filastò <arturo at filasto.net>
Date:   Tue Apr 26 15:45:22 2016 +0200

    Use debian/jessie instead of precise
    
    * Make the setup of ooni-backend conditional and do it in a another machine
---
 Vagrantfile | 85 ++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 61 insertions(+), 24 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 16a6ba0..e61bf68 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -1,22 +1,8 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-Vagrant.configure("2") do |config|
-  # All Vagrant configuration is done here. The most common configuration
-  # options are documented and commented below. For a complete reference,
-  # please see the online documentation at vagrantup.com.
-  config.vm.box = "precise32"
-  config.vm.box_url = "http://files.vagrantup.com/precise32.box"
-
-  config.vm.synced_folder ".", "/ooni"
-  # Place the ooni-backend source code in ../ooni-backend to sync it with the vagrant instance
-  config.vm.synced_folder "../ooni-backend", "/backend"
-
-end
-
-$script = <<SCRIPT
-
-echo "deb http://deb.torproject.org/torproject.org precise main" >> /etc/apt/sources.list
+$setup_ooniprobe = <<SCRIPT
+echo "deb http://deb.torproject.org/torproject.org jessie main" >> /etc/apt/sources.list
 
 # Install deb.torproject.org key
 gpg --keyserver keys.gnupg.net --recv 886DDD89
@@ -27,18 +13,69 @@ apt-get update
 apt-get install -y tor deb.torproject.org-keyring
 
 # Setup for sniffer subsystem
-apt-get install -y build-essential libdumbnet-dev python-dumbnet python-pypcap libpcap-dev python-dev python-pip libgeoip-dev libffi-dev
-cd /ooni
+apt-get install -y build-essential libdumbnet-dev libpcap-dev libgeoip-dev libffi-dev python-dev python-pip
+cd /data/ooni-probe
 python setup.py install
-echo "Login using 'vagrant ssh', and don't forget to run ooniprobe as root."
-echo "First run: 'sudo ooniprobe -i /usr/share/ooni/decks/fast.deck'"
+
+echo "Now:"
+echo "1. vagrant ssh probe"
+echo "2. oonideckgen"
+echo "3. ooniprobe -i deck-*/*.deck"
 
 SCRIPT
 
-# TODO: 
-# Somehow, ooniprobe is not capable to connect to tor by default. My current 
-# workaround is to kill tor, and set "start_tor: true" in /root/.ooni/ooniprobe.conf
+$setup_oonibackend = <<SCRIPT
+echo "Installing Tor..."
+
+echo "deb http://deb.torproject.org/torproject.org jessie main" >> /etc/apt/sources.list
+
+gpg --keyserver keys.gnupg.net --recv 886DDD89
+gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
+
+apt-get update
+
+apt-get -y install deb.torproject.org-keyring tor tor-geoipdb
+
+apt-get -y install curl python-pip python-dev libffi-dev
+
+cd /data/ooni-backend
+
+echo "Generating SSL keys"
+
+openssl genrsa -out private.key 4096
+openssl req -new -key private.key -out server.csr -subj '/CN=www.example.com/O=Example/C=AU'
+
+openssl x509 -req -days 365 -in server.csr -signkey private.key -out certificate.crt
+
+cp oonib.conf.example /etc/oonibackend.conf
+
+echo "Installing ooni-backend"
+python setup.py install
+
+echo "Now:"
+echo "1. vagrant ssh"
+echo "2. vi /etc/oonibackend.conf  # possibly"
+echo "3. cd /data/ooni-backend"
+echo "4. sudo ./bin/oonib -c /etc/oonibackend.conf"
+
+SCRIPT
 
 Vagrant.configure("2") do |config|
-    config.vm.provision :shell, :inline => $script
+  # Use Debian jessie with the vboxfs contrib add-on
+  config.vm.box = "debian/contrib-jessie64"
+
+  config.vm.define "probe" do |probe|
+    probe.vm.synced_folder ".", "/data/ooni-probe"
+    probe.vm.provision :shell, :inline => $setup_ooniprobe
+  end
+
+  # If we find a ooni-backend directory in ../ooni-backend we configure a
+  # ooni-backend as well.
+  if File.directory?("../ooni-backend")
+    config.vm.define "backend" do |backend|
+      backend.vm.synced_folder "../ooni-backend", "/data/ooni-backend"
+      backend.vm.provision :shell, :inline => $setup_oonibackend
+    end
+  end
+
 end





More information about the tor-commits mailing list