diff options
Diffstat (limited to 'contrib/packages/alpine/gnunet')
-rw-r--r-- | contrib/packages/alpine/gnunet/APKBUILD | 95 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet-system-services.initd | 16 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet-system.conf | 3 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet-user-services.initd | 33 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet-user.conf | 3 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet.post-install | 40 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet.pre-deinstall | 28 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet.pre-install | 17 | ||||
-rw-r--r-- | contrib/packages/alpine/gnunet/gnunet.xsession | 48 |
9 files changed, 283 insertions, 0 deletions
diff --git a/contrib/packages/alpine/gnunet/APKBUILD b/contrib/packages/alpine/gnunet/APKBUILD new file mode 100644 index 000000000..b21c6241e --- /dev/null +++ b/contrib/packages/alpine/gnunet/APKBUILD | |||
@@ -0,0 +1,95 @@ | |||
1 | # Contributor: xrs <xrs@mail36.net> | ||
2 | # Maintainer: xrs <xrs@mail36.net> | ||
3 | pkgname=gnunet | ||
4 | pkgver=0.11.6 | ||
5 | pkgrel=0 | ||
6 | pkgdesc="A framework for secure and privacy enhancing peer-to-peer networking" | ||
7 | url="https://gnunet.org" | ||
8 | arch="all" | ||
9 | license="AGPL-3.0-only" | ||
10 | depends="gnutls-utils bash which iptables coreutils" | ||
11 | depends_dev="libgpg-error-dev libgcrypt-dev nettle-dev unbound-dev gnutls-dev | ||
12 | gnurl-dev libmicrohttpd-dev openssl-dev libunistring-dev libidn2-dev | ||
13 | nss-dev sqlite-dev zlib-dev miniupnpc-dev gmp-dev gettext" | ||
14 | makedepends="$depends_dev autoconf automake libtool gettext-dev python3 | ||
15 | texlive texinfo" | ||
16 | install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall" | ||
17 | pkgusers="gnunet" | ||
18 | pkggroups="gnunet gnunetdns" | ||
19 | subpackages="$pkgname-dev $pkgname-doc $pkgname-lang" | ||
20 | options="!check suid" # No check because The GNUnet project lacks a good CI at the moment. | ||
21 | source="https://mirrors.ocf.berkeley.edu/gnu/gnunet/gnunet-$pkgver.tar.gz | ||
22 | gnunet-system.conf | ||
23 | gnunet-user.conf | ||
24 | gnunet-system-services.initd | ||
25 | gnunet-user-services.initd | ||
26 | gnunet.xsession | ||
27 | " | ||
28 | |||
29 | prepare() { | ||
30 | default_prepare | ||
31 | autoreconf -if # FIXME: See https://bugs.gnunet.org/view.php?id=5902 | ||
32 | } | ||
33 | |||
34 | build() { | ||
35 | ./configure \ | ||
36 | --build=$CBUILD \ | ||
37 | --host=$CHOST \ | ||
38 | --prefix=/usr \ | ||
39 | --sysconfdir=/etc \ | ||
40 | --mandir=/usr/share/man \ | ||
41 | --localstatedir=/var \ | ||
42 | --enable-logging=verbose | ||
43 | make -j 1 | ||
44 | } | ||
45 | |||
46 | check() { | ||
47 | make DESTDIR="$pkgdir" check | ||
48 | } | ||
49 | |||
50 | package() { | ||
51 | make DESTDIR="$pkgdir" install | ||
52 | |||
53 | libexecdir=$pkgdir/usr/lib/gnunet/libexec/ | ||
54 | # Limit access to critical gnunet-helper-dns to group "gnunetdns" | ||
55 | chgrp gnunetdns $libexecdir/gnunet-helper-dns | ||
56 | chgrp gnunetdns $libexecdir/gnunet-service-dns | ||
57 | # Limit access to certain SUID binaries by group "gnunet" | ||
58 | chgrp gnunet $libexecdir/gnunet-helper-exit | ||
59 | chgrp gnunet $libexecdir/gnunet-helper-vpn | ||
60 | chgrp gnunet $libexecdir/gnunet-helper-nat-client | ||
61 | chgrp gnunet $libexecdir/gnunet-helper-nat-server | ||
62 | chmod u+s $libexecdir/gnunet-helper-exit | ||
63 | chmod u+s $libexecdir/gnunet-helper-vpn | ||
64 | chmod 2750 $libexecdir/gnunet-helper-dns | ||
65 | chmod 2700 $libexecdir/gnunet-service-dns | ||
66 | chmod u+s $libexecdir/gnunet-helper-nat-client | ||
67 | chmod u+s $libexecdir/gnunet-helper-nat-server | ||
68 | |||
69 | install -m644 -D $srcdir/$pkgname-user.conf \ | ||
70 | $pkgdir/etc/skel/.config/$pkgname.conf | ||
71 | install -m644 -D $srcdir/$pkgname-system.conf \ | ||
72 | $pkgdir/etc/$pkgname.conf | ||
73 | install -m755 -D $srcdir/$pkgname-system-services.initd \ | ||
74 | $pkgdir/etc/init.d/$pkgname-system-services | ||
75 | install -m755 -D $srcdir/$pkgname-user-services.initd \ | ||
76 | $pkgdir/etc/init.d/$pkgname-user-services | ||
77 | install -m755 -D $srcdir/$pkgname.xsession \ | ||
78 | $pkgdir/etc/X11/xinit/xinitrc.d/80-$pkgname-user-services | ||
79 | } | ||
80 | |||
81 | dev() { | ||
82 | default_dev | ||
83 | |||
84 | # dev() will move gnunet-config from $pkg to $pkg-dev, but it's an | ||
85 | # intended part of $pkg. | ||
86 | install -m755 -D $builddir/src/util/.libs/gnunet-config \ | ||
87 | $pkgdir/usr/bin/gnunet-config | ||
88 | } | ||
89 | |||
90 | sha512sums="1c6ea2ac7280d2edb30df627b79e017d199e93cd3970ce49f3f049abfb1dddfed541118e55766c422edf4a80e140c4eb2cfc681e0d4a1384e39811d024df9278 gnunet-0.11.6.tar.gz | ||
91 | a0f55413ed2c6edd6746a751d92ddac95ba70f20eefb07330817870d749456448f44bba95d245911a00f6078e0c2ac626004e3b764be5e5e049c00626c4c5ac0 gnunet-system.conf | ||
92 | b21112ff16aee771332aa9c33f55b0c7f46fe0266053543241e3efbe25dba56482c0e11112a192eefe59f1c74d2af5d7071b6a4e1e875cfc7e9d55b5fe8a0a33 gnunet-user.conf | ||
93 | 96ab78bb48d5fb10f0b34336ad05e73b543c4362c73436ef20b3bb83dff214e997acf38a2ea493b1901bdc37c8877d83cdaebd73a0e50831e2f23413c8edda76 gnunet-system-services.initd | ||
94 | 3dc88aaedc3886c0795bdb4c8e259125232ba10f2bc762216c341bb3240ef0855cba968799ba121304463a65e73ed0f62dec03759a2be478ec4ac086361b49ba gnunet-user-services.initd | ||
95 | 4fe1ed80cbaa4c140805bde2629fdb32b97f3273281ae7277c8988b4e490605652cdb9975fc1178169426f2279597c55f6e6b75b52315a426d78a1fedbb08401 gnunet.xsession" | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet-system-services.initd b/contrib/packages/alpine/gnunet/gnunet-system-services.initd new file mode 100644 index 000000000..19248d23e --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet-system-services.initd | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/sbin/openrc-run | ||
2 | # Contributor: xrs <xrs@mail36.net> | ||
3 | # Maintainer: xrs <xrs@mail36.net> | ||
4 | |||
5 | name="gnunet-system-service" | ||
6 | description="A secure and privacy enhancing peer-to-peer overlay network" | ||
7 | command="/usr/lib/gnunet/libexec/gnunet-service-arm" | ||
8 | command_args="-c /etc/gnunet.conf" | ||
9 | command_user="gnunet:gnunet" | ||
10 | command_background="yes" | ||
11 | pidfile="/run/${SVCNAME}.pid" | ||
12 | |||
13 | depend() { | ||
14 | need net | ||
15 | before gnunet-user-services | ||
16 | } | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet-system.conf b/contrib/packages/alpine/gnunet/gnunet-system.conf new file mode 100644 index 000000000..303cf5f16 --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet-system.conf | |||
@@ -0,0 +1,3 @@ | |||
1 | [arm] | ||
2 | START_SYSTEM_SERVICES = YES | ||
3 | START_USER_SERVICES = NO | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet-user-services.initd b/contrib/packages/alpine/gnunet/gnunet-user-services.initd new file mode 100644 index 000000000..0d7a626e7 --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet-user-services.initd | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/sbin/openrc-run | ||
2 | # Contributor: xrs <xrs@mail36.net> | ||
3 | # Maintainer: xrs <xrs@mail36.net> | ||
4 | |||
5 | name="gnunet-user-services" | ||
6 | description="GNUnet user services" | ||
7 | command_background="yes" | ||
8 | pidfile="/run/${SVCNAME}.pid" | ||
9 | users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd` | ||
10 | |||
11 | depend() { | ||
12 | need gnunet-system-services | ||
13 | } | ||
14 | |||
15 | start() { | ||
16 | for user in $users; do | ||
17 | if test -z "`ps|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1 | ||
18 | then | ||
19 | su $user -c "gnunet-arm \ | ||
20 | -c /home/$user/.config/gnunet.conf -s" | ||
21 | fi | ||
22 | done | ||
23 | } | ||
24 | |||
25 | stop() { | ||
26 | for user in $users; do | ||
27 | if test -n "`ps|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1 | ||
28 | then | ||
29 | su $user -c "gnunet-arm \ | ||
30 | -c /home/$user/.config/gnunet.conf -e" | ||
31 | fi | ||
32 | done | ||
33 | } | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet-user.conf b/contrib/packages/alpine/gnunet/gnunet-user.conf new file mode 100644 index 000000000..22f1fe37a --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet-user.conf | |||
@@ -0,0 +1,3 @@ | |||
1 | [arm] | ||
2 | START_SYSTEM_SERVICES = NO | ||
3 | START_USER_SERVICES = YES | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet.post-install b/contrib/packages/alpine/gnunet/gnunet.post-install new file mode 100644 index 000000000..f7c19b26f --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet.post-install | |||
@@ -0,0 +1,40 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Enumerate users. | ||
4 | users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd` | ||
5 | |||
6 | # Install gnunet.conf for existing users. | ||
7 | for user in $users; do | ||
8 | install -m644 -o $user -g $user -D /etc/skel/.config/gnunet.conf \ | ||
9 | /home/$user/.config/gnunet.conf | ||
10 | done | ||
11 | |||
12 | # Enable GNS proxy for users, if desired. | ||
13 | echo "Use GNU Name System in Firefox/Chromium by default? [y,N]" | ||
14 | read -r yn | ||
15 | case $yn in | ||
16 | y|Y ) | ||
17 | # Enable GNS proxy for existant users. | ||
18 | for user in $users; do | ||
19 | port=$((8000+$(id -u $user))) | ||
20 | gnunet-config -c /home/$user/.config/gnunet.conf \ | ||
21 | --rewrite \ | ||
22 | --section=gns-proxy \ | ||
23 | --option=IMMEDIATE_START \ | ||
24 | --value=YES | ||
25 | gnunet-config -c /home/$user/.config/gnunet.conf \ | ||
26 | --rewrite \ | ||
27 | --section=gns-proxy \ | ||
28 | --option=OPTIONS \ | ||
29 | --value="-p $port" | ||
30 | done | ||
31 | |||
32 | # Enable GNS proxy for future users. | ||
33 | echo "[gns-proxy]" >> /etc/skel/.config/gnunet.conf | ||
34 | echo "IMMEDIATE_START = YES" >> /etc/skel/.config/gnunet.conf | ||
35 | ;; | ||
36 | * ) | ||
37 | ;; | ||
38 | esac | ||
39 | |||
40 | exit 0 | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet.pre-deinstall b/contrib/packages/alpine/gnunet/gnunet.pre-deinstall new file mode 100644 index 000000000..3334c6d67 --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet.pre-deinstall | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Remove proxy settings from browser. | ||
4 | users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd` | ||
5 | for user in $users; do | ||
6 | gnunet_proxy=`grep -i "gns-proxy" /home/$user/.config/gnunet.conf` | ||
7 | if [ "$gnunet_proxy" ]; then | ||
8 | for ffprofile in /home/"$user"/.mozilla/firefox/*.*/; do | ||
9 | # Reset proxy preferences | ||
10 | js=$ffprofile/user.js | ||
11 | if [ -f $js ]; then | ||
12 | sed -i '/Preferences for using the GNU Name System/d' $js | ||
13 | sed -i '/network.proxy.socks/d' $js | ||
14 | sed -i '/network.proxy.socks_port/d' $js | ||
15 | sed -i '/network.proxy.socks_remote_dns/d' $js | ||
16 | sed -i '/network.proxy.type/d' $js | ||
17 | fi | ||
18 | done | ||
19 | |||
20 | # Chromium | ||
21 | profile=/home/$user/.profile | ||
22 | if [ -f $profile ]; then | ||
23 | sed -i '/CHROMIUM_USER_FLAGS/d' $profile | ||
24 | fi | ||
25 | fi | ||
26 | done | ||
27 | |||
28 | exit 0 | ||
diff --git a/contrib/packages/alpine/gnunet/gnunet.pre-install b/contrib/packages/alpine/gnunet/gnunet.pre-install new file mode 100644 index 000000000..bbb629cb1 --- /dev/null +++ b/contrib/packages/alpine/gnunet/gnunet.pre-install | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Add special group gnunetdns for controlling access to "gnunet-helper-dns". | ||
4 | addgroup -S gnunetdns 2>/dev/null | ||
5 | addgroup -S gnunet 2>/dev/null | ||
6 | |||
7 | # Add system user/group gnunet for system services | ||
8 | adduser -S -h "/var/lib/gnunet" -s /bin/sh \ | ||
9 | -G gnunet -g gnunet gnunet 2>/dev/null | ||
10 | |||
11 | # add users on host system to group "gnunet" | ||
12 | users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd` | ||
13 | for user in $users; do | ||
14 | adduser $user gnunet 2>/dev/null | ||
15 | done | ||
16 | |||
17 | exit 0 | ||
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 | ||
2 | user=$(whoami) | ||
3 | gnunet_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). | ||
7 | if [ "$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 | ||
45 | fi | ||
46 | |||
47 | # Create/Renew GNS certificate authority (CA) per user. | ||
48 | gnunet-gns-proxy-setup-ca | ||