aboutsummaryrefslogtreecommitdiff
path: root/contrib/packages/alpine/gnunet/gnunet.xsession
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/packages/alpine/gnunet/gnunet.xsession')
-rw-r--r--contrib/packages/alpine/gnunet/gnunet.xsession48
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/packages/alpine/gnunet/gnunet.xsession b/contrib/packages/alpine/gnunet/gnunet.xsession
new file mode 100644
index 000000000..944d47a27
--- /dev/null
+++ b/contrib/packages/alpine/gnunet/gnunet.xsession
@@ -0,0 +1,48 @@
1#!/bin/sh
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 (system wide
6# installation decision).
7if [ "$gnunet_proxy" ]; then
8
9 # Calculate user specific port
10 port=$((8000+$(id -u $user)))
11
12 gnunet-config -c /home/$user/.config/gnunet.conf \
13 --rewrite \
14 --section=gns-proxy \
15 --option=OPTIONS \
16 --value="-p $port"
17
18 # Firefox
19 if [ ! -d ~/.mozilla/firefox/*.default ];then
20 timeout 3s firefox --headless # dirty: create profile if not existent
21 fi
22 for ffprofile in ~/.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/$user/.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