forked from asb/spindle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwheezy-stage4-lepidopter
executable file
·80 lines (66 loc) · 1.95 KB
/
wheezy-stage4-lepidopter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
# Works with spindle http://asbradbury.org/projects/spindle
# See LICENSE.spindle file for copyright and license details
# See README for building details
set -ex
. ./common
CURIMG=stage4-lepidopter.$IMGFORMAT
install_packages() {
# we may want to break out DEBIAN_FRONTEND=noninteractive
ssh_in_to_qemu chroot /mnt sh -l -ex - <<EOF
apt-get update
apt-get install -y git-core rpi-update lsb-release debconf-utils
EOF
}
configure_hostname() {
onvm_chroot sh -l -e - <<EOF
hostname lepidopter
EOF
}
configure_ooniprobe() {
onvm_chroot sh -l -e <<EOF
git clone https://git.torproject.org/ooni-probe.git /root/ooni-probe
cd /root/ooni-probe
tee -a /etc/apt/sources.list <<EOF2
deb http://deb.torproject.org/torproject.org wheezy main
deb-src http://deb.torproject.org/torproject.org wheezy main
EOF2
# Install script
./setup-dependencies.sh -y -p
python setup.py install
EOF
}
configure_ssh_torhs() {
onvm_chroot sh -l -e <<EOF
mkdir -p /var/lib/tor/ssh/
chown debian-tor:debian-tor /var/lib/tor/ssh/
echo "HiddenServiceDir /var/lib/tor/ssh/" >> /etc/tor/torrc
echo "HiddenServicePort 22 127.0.0.1:22" >> /etc/tor/torrc
EOF
}
test_run_ooniprobe() {
onvm_chroot sh -l -e - <<EOF
mkdir /root/.ooni/
awk '{gsub("geoip_data_dir: /usr/share/ooni/", "geoip_data_dir: /usr/share/GeoIP/"); print $0}' /usr/share/ooni/ooniprobe.conf.sample > /root/.ooni/ooniprobe.conf
echo "0 0 * * * ooniprobe -i /usr/share/ooni/decks/basic.deck" | crontab -
ooniprobe -i /usr/share/ooni/decks/basic.deck
EOF
}
configure_local_mode() {
onvm_chroot sh -l -e <<EOF
EOF
}
cd $WORKDIR
dotask branch_image ../$OUTDIR/stage3.$IMGFORMAT $CURIMG
dotask run_qemu $CURIMG
dotask mount_apt_cache
dotask disable_starting_services
dotask install_packages
dotask configure_hostname
dotask configure_ooniprobe
dotask configure_ssh_torhs
dotask save_space_using_hardlink
dotask allow_starting_services
dotask update_issue
dotask fingerprint_debian
dotask shutdown_qemu