aboutsummaryrefslogtreecommitdiff
path: root/debian/etc
diff options
context:
space:
mode:
Diffstat (limited to 'debian/etc')
-rw-r--r--debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services48
-rw-r--r--debian/etc/gnunet.conf8
-rw-r--r--debian/etc/skel/.config/gnunet.conf10
-rw-r--r--debian/etc/skel/.config/systemd/gnunet-user-gns-proxy.service10
-rw-r--r--debian/etc/skel/.config/systemd/gnunet-userpeer.service9
5 files changed, 85 insertions, 0 deletions
diff --git a/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services b/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services
new file mode 100644
index 000000000..aff1dd78c
--- /dev/null
+++ b/debian/etc/X11/xinit/xinitrc.d/80-gnunet-user-services
@@ -0,0 +1,48 @@
1#!/bin/bash
2user=$(whoami)
3gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES')
4
5# Enable GNS proxy for new users informed by /etc/skel.
6if [ "$gnunet_proxy" ]; then
7
8 # Calculate user specific port
9 port=$((8000+$(id -u "$user")))
10
11 gnunet-config -c "$HOME/.config/gnunet.conf" \
12 --rewrite \
13 --section=gns-proxy \
14 --option=OPTIONS \
15 --value="-p $port"
16
17 # Firefox
18 defaultprofile=$(ls "$HOME/.mozilla/firefox/*.default")
19 if [ ! "$defaultprofile" ];then
20 timeout 3s firefox --headless # dirty: create profile if not existent
21 fi
22 for ffprofile in "$HOME"/.mozilla/firefox/*.*/; do
23 js=$ffprofile/user.js
24 if [ -f "$js" ]; then
25 sed -i '/Preferences for using the GNU Name System/d' "$js"
26 sed -i '/network.proxy.socks/d' "$js"
27 sed -i '/network.proxy.socks_port/d' "$js"
28 sed -i '/network.proxy.socks_remote_dns/d' "$js"
29 sed -i '/network.proxy.type/d' "$js"
30 fi
31 echo "// Preferences for using the GNU Name System" >> "$js"
32 echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js"
33 echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js"
34 echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js"
35 echo "user_pref(\"network.proxy.type\", 1);" >> "$js"
36 done
37
38 # Chromium
39 profile="$HOME/.profile"
40 if [ -f "$profile" ]; then
41 sed -i '/CHROMIUM_USER_FLAGS/d' "$profile"
42 fi
43 echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \
44 >> "$profile"
45fi
46
47# Create/Renew GNS certificate authority (CA) per user.
48gnunet-gns-proxy-setup-ca
diff --git a/debian/etc/gnunet.conf b/debian/etc/gnunet.conf
new file mode 100644
index 000000000..c14ab5918
--- /dev/null
+++ b/debian/etc/gnunet.conf
@@ -0,0 +1,8 @@
1[path]
2GNUNET_HOME = /var/lib/gnunet/
3GNUNET_DATA_HOME = /var/lib/gnunet/data/
4GNUNET_RUNTIME_DIR = /var/run/gnunet/
5
6[arm]
7START_SYSTEM_SERVICES = YES
8START_USER_SERVICES = NO
diff --git a/debian/etc/skel/.config/gnunet.conf b/debian/etc/skel/.config/gnunet.conf
new file mode 100644
index 000000000..c5a982139
--- /dev/null
+++ b/debian/etc/skel/.config/gnunet.conf
@@ -0,0 +1,10 @@
1# Sample configuration for $HOME/.config/gnunet.conf in
2# a multi-user setup. This configuration should be installed
3# in the $HOME directory of each normal user (and in
4# /etc/skel/).
5[arm]
6SYSTEM_ONLY = NO
7USER_ONLY = YES
8
9[gns-proxy]
10IMMEDIATE_START = YES
diff --git a/debian/etc/skel/.config/systemd/gnunet-user-gns-proxy.service b/debian/etc/skel/.config/systemd/gnunet-user-gns-proxy.service
new file mode 100644
index 000000000..475e16fe8
--- /dev/null
+++ b/debian/etc/skel/.config/systemd/gnunet-user-gns-proxy.service
@@ -0,0 +1,10 @@
1[Unit]
2Description=GNUnet user based GNS proxy
3
4[Service]
5Type=oneshot
6ExecStart=/usr/lib/x86_64-linux-gnu/gnunet/libexec/gnunet-gns-proxy -p 9000+%U
7
8[Install]
9WantedBy=default.target
10
diff --git a/debian/etc/skel/.config/systemd/gnunet-userpeer.service b/debian/etc/skel/.config/systemd/gnunet-userpeer.service
new file mode 100644
index 000000000..79dac97ed
--- /dev/null
+++ b/debian/etc/skel/.config/systemd/gnunet-userpeer.service
@@ -0,0 +1,9 @@
1[Unit]
2Description=GNUnet User peer
3
4[Service]
5Type=oneshot
6ExecStart=/usr/bin/gnunet-arm -s
7
8[Install]
9WantedBy=default.target