summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile34
-rw-r--r--conf/br0.in (renamed from conf/interfaces.d_eth0)13
-rw-r--r--conf/dnsmasq.conf.in (renamed from conf/dnsmasq.conf)0
-rw-r--r--conf/eth03
-rwxr-xr-xconf/network_if-up.d_samizdat.in (renamed from conf/network_if-up.d_samizdat)0
-rwxr-xr-xsrc/generate-network-filter.sh18
7 files changed, 59 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 7395836..f187d13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,9 @@ samizdat.disk.img
16build-stamp 16build-stamp
17install-stamp 17install-stamp
18install-submodules-stamp 18install-submodules-stamp
19conf/br0
20conf/dnsmasq.conf
21conf/network_if-up.d_samizdat
19openssh-client-dbgsym_7.9p1-10_amd64.deb 22openssh-client-dbgsym_7.9p1-10_amd64.deb
20openssh-client-udeb_7.9p1-10_amd64.udeb 23openssh-client-udeb_7.9p1-10_amd64.udeb
21openssh-client_7.9p1-10_amd64.deb 24openssh-client_7.9p1-10_amd64.deb
diff --git a/Makefile b/Makefile
index b64cab9..e5a3109 100644
--- a/Makefile
+++ b/Makefile
@@ -40,12 +40,42 @@ install-nested-kvm: conf/kvm.conf
40 install -m0644 conf/kvm.conf ${instdir}/etc/modprobe.d/ 40 install -m0644 conf/kvm.conf ${instdir}/etc/modprobe.d/
41 modprobe -r kvm-intel kvm-amd kvm; modprobe kvm; modprobe kvm-intel; modprobe kvm-amd; true 41 modprobe -r kvm-intel kvm-amd kvm; modprobe kvm; modprobe kvm-intel; modprobe kvm-amd; true
42 42
43install-configuration: 43network_filter := $(shell ./src/generate-network-filter.sh)
44
45conf_files_out = conf/br0 conf/dnsmasq.conf conf/network_if-up.d_samizdat
46conf_files_in = $(addsuffix .in, $(conf_files_out))
47
48$(conf_files_out): $(conf_files_in) ./src/generate-network-filter.sh
49 sed -e '$(network_filter)' < $@.in > $@
50
51static_conf_files = conf/torrc conf/nbd-server conf/postfix_main.cf
52
53.PHONY: install-configuration install-bootserver start-bootserver
54install-bootserver:
55 sudo -E $(MAKE) instdir=/ real-install-bootserver start-bootserver
56
57start-bootserver:
58 ifup --force br0
59 service dnsmasq restart
60 service nbd-server restart
61
62real-install-bootserver: $(conf_files_out) $(static_conf_files)
63ifndef instdir
64 $(error "You must specify instdir, for safety.")
65else
66 install -p -m0644 -DT conf/dnsmasq.conf ${instdir}/etc/dnsmasq.conf
67 install -p -m0644 -DT conf/eth0 ${instdir}/etc/network/interfaces.d/eth0
68 install -p -m0644 -DT conf/br0 ${instdir}/etc/network/interfaces.d/br0
69 install -p -m0644 -DT conf/network_if-up.d_samizdat ${instdir}/etc/network/if-up.d/samizdat
70endif
71
72install-configuration: real-install-bootserver $(conf_files_out) $(static_conf_files)
44ifndef instdir 73ifndef instdir
45 $(error "You must specify instdir, for safety.") 74 $(error "You must specify instdir, for safety.")
46else 75else
47 install -p -m0644 -DT conf/dnsmasq.conf ${instdir}/etc/dnsmasq.conf 76 install -p -m0644 -DT conf/dnsmasq.conf ${instdir}/etc/dnsmasq.conf
48 install -p -m0644 -DT conf/interfaces.d_eth0 ${instdir}/etc/network/interfaces.d/eth0 77 install -p -m0644 -DT conf/eth0 ${instdir}/etc/network/interfaces.d/eth0
78 install -p -m0644 -DT conf/br0 ${instdir}/etc/network/interfaces.d/br0
49 install -p -m0644 -DT conf/network_if-up.d_samizdat ${instdir}/etc/network/if-up.d/samizdat 79 install -p -m0644 -DT conf/network_if-up.d_samizdat ${instdir}/etc/network/if-up.d/samizdat
50 install -p -m0644 -DT conf/postfix_main.cf ${instdir}/etc/postfix/main.cf 80 install -p -m0644 -DT conf/postfix_main.cf ${instdir}/etc/postfix/main.cf
51 install -p -m0644 -DT conf/torrc ${instdir}/etc/tor/torrc 81 install -p -m0644 -DT conf/torrc ${instdir}/etc/tor/torrc
diff --git a/conf/interfaces.d_eth0 b/conf/br0.in
index 3dbf9b4..9d5c17b 100644
--- a/conf/interfaces.d_eth0
+++ b/conf/br0.in
@@ -1,9 +1,4 @@
1# iface eth0 inet static 1auto br0
2# address 192.168.10.1
3# netmask 255.255.255.0
4# # post-up ipsec restart
5
6auto br0 eth0
7 2
8iface br0 inet static 3iface br0 inet static
9# pre-up echo 0 > /proc/sys/net/ipv6/conf/br0/accept_ra_pinfo # disable ipv6 auto-address 4# pre-up echo 0 > /proc/sys/net/ipv6/conf/br0/accept_ra_pinfo # disable ipv6 auto-address
@@ -11,9 +6,7 @@ iface br0 inet static
11 pre-down for n in 0 1 2 3 4; do tunctl -d tap$n; done; true 6 pre-down for n in 0 1 2 3 4; do tunctl -d tap$n; done; true
12 address 192.168.10.1 7 address 192.168.10.1
13 netmask 255.255.255.0 8 netmask 255.255.255.0
14 bridge_ports eth0 tap0 tap1 tap2 tap3 tap4 9 bridge_ports tap0 tap1 tap2 tap3 tap4
15 bridge_maxwait 10 10 bridge_maxwait 10
16 up iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE 11 up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
17 up sysctl -w net.ipv4.ip_forward=1 12 up sysctl -w net.ipv4.ip_forward=1
18
19iface eth0 inet manual
diff --git a/conf/dnsmasq.conf b/conf/dnsmasq.conf.in
index 5ab9008..5ab9008 100644
--- a/conf/dnsmasq.conf
+++ b/conf/dnsmasq.conf.in
diff --git a/conf/eth0 b/conf/eth0
new file mode 100644
index 0000000..364b0a2
--- /dev/null
+++ b/conf/eth0
@@ -0,0 +1,3 @@
1auto eth0
2
3iface eth0 inet dhcp
diff --git a/conf/network_if-up.d_samizdat b/conf/network_if-up.d_samizdat.in
index 4c02c93..4c02c93 100755
--- a/conf/network_if-up.d_samizdat
+++ b/conf/network_if-up.d_samizdat.in
diff --git a/src/generate-network-filter.sh b/src/generate-network-filter.sh
new file mode 100755
index 0000000..a2e49d0
--- /dev/null
+++ b/src/generate-network-filter.sh
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3gen_filter()
4{
5 IFS=. read a b c d
6 [ "$a" -a "$b" -a "$c" -a "$d" ] || return
7 cprime=$((c+1))
8 echo s/$a\\.$b\\.$c\\.\\\([0-9]*\\\)/$a.$b.$cprime.\\\\1/g
9}
10
11get_default()
12{
13 ip route | grep '^default via 192\.168\.[^.]*\.1' |
14 (read default via what ip; [ "$what" ] && echo $what)
15}
16
17get_default | gen_filter
18