aboutsummaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-01 12:26:20 +0200
committerFlorian Dold <florian@dold.me>2021-08-01 12:26:29 +0200
commit2032f3ce3ed0ed7a6c1c6fb9df6222d85758bf70 (patch)
tree075237a82cc24a4f36155eae82e894d76ed3074d /debian
parentf15deffc74ae9cb9ea9b32c14f55e4e125d0f4ba (diff)
downloadgnunet-2032f3ce3ed0ed7a6c1c6fb9df6222d85758bf70.tar.gz
gnunet-2032f3ce3ed0ed7a6c1c6fb9df6222d85758bf70.zip
debian: compat level, removal of user units, tweaks
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rw-r--r--debian/gnunet.postinst178
3 files changed, 65 insertions, 123 deletions
diff --git a/debian/changelog b/debian/changelog
index f27aba2af..b78688984 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1gnunet (0.14.1-12) unstable; urgency=low
2
3 * Lower debhelper compatibility level to 12.
4 * Do not inject user units in postinst for now.
5 * Tweaks to packaging.
6
7 -- Florian Dold <florian@dold.me> Sat, 31 Jul 2021 20:04:42 +0200
8
1gnunet (0.14.1-11) unstable; urgency=low 9gnunet (0.14.1-11) unstable; urgency=low
2 10
3 * Make configuration parsing more permissive. 11 * Make configuration parsing more permissive.
diff --git a/debian/control b/debian/control
index 01b549286..57acc6e1e 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Build-Depends:
6 autoconf (>=2.59), 6 autoconf (>=2.59),
7 automake (>=1.11.1), 7 automake (>=1.11.1),
8 autopoint, 8 autopoint,
9 debhelper-compat (= 13), 9 debhelper-compat (= 12),
10 gettext, 10 gettext,
11 iptables, 11 iptables,
12 libbluetooth-dev, 12 libbluetooth-dev,
diff --git a/debian/gnunet.postinst b/debian/gnunet.postinst
index b6317f5be..091feb223 100644
--- a/debian/gnunet.postinst
+++ b/debian/gnunet.postinst
@@ -108,114 +108,63 @@ case "${1}" in
108 echo " done." 108 echo " done."
109 fi 109 fi
110 110
111 # Install GNUnet configuration for all users provided non exists 111# # Change the proxy settings for Firefox and Chromium if desired
112 userlist=$(awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd) 112# if ${_PROXY}
113 users=($userlist) 113# then
114 homedirlist=$(awk -F ':' '$3>=1000 && $3<2000 {print $6}' /etc/passwd) 114# mkdir -p /etc/X11/xinit/xinitrc.d/
115 homedirs=($homedirlist) 115#cat > "/etc/X11/xinit/xinitrc.d/80-gnunet-user-services" << "EOF"
116 116##!/bin/bash
117 for (( i=0; i<${#users[@]}; i++ )); do 117#systemctl --user daemon-reload
118 usermod -aG gnunet ${users[$i]} 118#systemctl --user start gnunet-user
119 if [ -n "$i" ] && [ -d "${homedirs[$i]}" ]; then 119#systemctl --user enable gnunet-user
120 mkdir -p ${homedirs[$i]}/.config/systemd/user/ 120#user=$(whoami)
121 121#gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES')
122 cat > "${homedirs[$i]}/.config/systemd/user/gnunet-user.service" << EOF
123# Copyright (C) 2019 GNUnet e.V.
124# 122#
125# Copying and distribution of this file, with or without modification, 123## Enable GNS proxy for new users informed by /etc/skel.
126# are permitted in any medium without royalty provided the copyright 124#if [ "$gnunet_proxy" ]; then
127# notice and this notice are preserved. This file is offered as-is, 125#
128# without any warranty. 126# # Calculate user specific port
129 127# port=$((8000+$(id -u $user)))
130[Unit] 128#
131Description=Service that runs a GNUnet for the user gnunet 129# gnunet-config -c $HOME/.config/gnunet.conf \
132After=network.target 130# --section=gns-proxy \
133 131# --option=OPTIONS \
134[Service] 132# --value="-p $port"
135Type=forking 133#
136ExecStart=/usr/bin/gnunet-arm -s -c ${homedirs[$i]}/.config/gnunet.conf 134# # Firefox
137ExecStop=/usr/bin/gnunet-arm -e -c ${homedirs[$i]}/.config/gnunet.conf 135# defaultprofile=$(ls $HOME/.mozilla/firefox/*.default)
138 136# if [ ! "$defaultprofile" ];then
139[Install] 137# timeout 3s firefox --headless # dirty: create profile if not existent
140WantedBy=multi-user.target 138# fi
141EOF 139# for ffprofile in $HOME/.mozilla/firefox/*.*/; do
142 140# js=$ffprofile/user.js
143 chown "${users[$i]}":"${users[$i]}" "${homedirs[$i]}/.config/systemd/user/gnunet-user.service" 141# if [ -f "$js" ]; then
144 if [ ! -f "${homedirs[$i]}/.config/gnunet.conf" ]; then 142# sed -i '/Preferences for using the GNU Name System/d' "$js"
145 mkdir -p ${homedirs[$i]}/.config/ 143# sed -i '/network.proxy.socks/d' "$js"
146 cp /etc/skel/.config/gnunet.conf "${homedirs[$i]}/.config/gnunet.conf" 144# sed -i '/network.proxy.socks_port/d' "$js"
147 chmod 644 "${homedirs[$i]}/.config/gnunet.conf" 145# sed -i '/network.proxy.socks_remote_dns/d' "$js"
148 fi 146# sed -i '/network.proxy.type/d' "$js"
149 fi 147# fi
150 port=$((8000+$(id -u "${users[$i]}"))) 148# echo "// Preferences for using the GNU Name System" >> "$js"
151 gnunet-config -c "${homedirs[$i]}/.config/gnunet.conf" \ 149# echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js"
152 --section=gns-proxy \ 150# echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js"
153 --option=IMMEDIATE_START \ 151# echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js"
154 --value=YES 152# echo "user_pref(\"network.proxy.type\", 1);" >> "$js"
155 gnunet-config -c "${homedirs[$i]}/.config/gnunet.conf" \ 153# done
156 --section=gns-proxy \ 154#
157 --option=OPTIONS \ 155# # Chromium
158 --value="-p $port" 156# profile="$HOME/.profile"
159 chown "${users[$i]}":"${users[$i]}" "${homedirs[$i]}/.config/gnunet.conf" 157# if [ -f "$profile" ]; then
160 done 158# sed -i '/CHROMIUM_USER_FLAGS/d' "$profile"
161 159# fi
162 # Change the proxy settings for Firefox and Chromium if desired 160# echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \
163 if ${_PROXY} 161# >> "$profile"
164 then 162#fi
165 mkdir -p /etc/X11/xinit/xinitrc.d/ 163#
166cat > "/etc/X11/xinit/xinitrc.d/80-gnunet-user-services" << "EOF" 164## Create/Renew GNS certificate authority (CA) per user.
167#!/bin/bash 165#gnunet-gns-proxy-setup-ca
168systemctl --user daemon-reload 166#EOF
169systemctl --user start gnunet-user 167# fi
170systemctl --user enable gnunet-user
171user=$(whoami)
172gnunet_proxy=$(gnunet-config -c /etc/skel/.config/gnunet.conf -s gns-proxy | grep 'IMMEDIATE_START = YES')
173
174# Enable GNS proxy for new users informed by /etc/skel.
175if [ "$gnunet_proxy" ]; then
176
177 # Calculate user specific port
178 port=$((8000+$(id -u $user)))
179
180 gnunet-config -c $HOME/.config/gnunet.conf \
181 --section=gns-proxy \
182 --option=OPTIONS \
183 --value="-p $port"
184
185 # Firefox
186 defaultprofile=$(ls $HOME/.mozilla/firefox/*.default)
187 if [ ! "$defaultprofile" ];then
188 timeout 3s firefox --headless # dirty: create profile if not existent
189 fi
190 for ffprofile in $HOME/.mozilla/firefox/*.*/; do
191 js=$ffprofile/user.js
192 if [ -f "$js" ]; then
193 sed -i '/Preferences for using the GNU Name System/d' "$js"
194 sed -i '/network.proxy.socks/d' "$js"
195 sed -i '/network.proxy.socks_port/d' "$js"
196 sed -i '/network.proxy.socks_remote_dns/d' "$js"
197 sed -i '/network.proxy.type/d' "$js"
198 fi
199 echo "// Preferences for using the GNU Name System" >> "$js"
200 echo "user_pref(\"network.proxy.socks\", \"localhost\");" >> "$js"
201 echo "user_pref(\"network.proxy.socks_port\", $port);" >> "$js"
202 echo "user_pref(\"network.proxy.socks_remote_dns\", true);" >> "$js"
203 echo "user_pref(\"network.proxy.type\", 1);" >> "$js"
204 done
205
206 # Chromium
207 profile="$HOME/.profile"
208 if [ -f "$profile" ]; then
209 sed -i '/CHROMIUM_USER_FLAGS/d' "$profile"
210 fi
211 echo "export CHROMIUM_USER_FLAGS=--proxy-server=socks5://localhost:$port" \
212 >> "$profile"
213fi
214
215# Create/Renew GNS certificate authority (CA) per user.
216gnunet-gns-proxy-setup-ca
217EOF
218 fi
219 168
220 # Update files and directories permissions. 169 # Update files and directories permissions.
221 # Assuming default values, this *should* not be changed. 170 # Assuming default values, this *should* not be changed.
@@ -267,21 +216,6 @@ GNUNET_GROUP=${_GROUPNAME}
267GNUNET_AUTOSTART="${_AUTOSTART}" 216GNUNET_AUTOSTART="${_AUTOSTART}"
268EOF 217EOF
269 218
270cat > "/etc/systemd/system/gnunet.service" <<EOF
271[Unit]
272Description=A framework for secure peer-to-peer networking
273
274[Service]
275EnvironmentFile=/etc/default/gnunet
276User=${_USERNAME}
277Type=forking
278ExecStart=/usr/bin/gnunet-arm -s -c /etc/gnunet.conf
279ExecStop=/usr/bin/gnunet-arm -e -c /etc/gnunet.conf
280
281[Install]
282WantedBy=multi-user.target
283EOF
284
285 cp -f "${CONFIG_NEW}" "${CONFIG_FILE}" 219 cp -f "${CONFIG_NEW}" "${CONFIG_FILE}"
286 echo " done." 220 echo " done."
287 221