summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhanibek Adilbekov2018-01-20 00:18:07 +0600
committerZhanibek Adilbekov2018-01-20 00:18:07 +0600
commita3271d07a7bf541ea3733e641c21370c707ab48d (patch)
tree7a97d8d76444c9c41f793e850ad5841082bea540
downloadaur-a3271d07a7bf541ea3733e641c21370c707ab48d.tar.gz
v2.0.1-1
-rw-r--r--.SRCINFO18
-rw-r--r--.gitignore15
-rw-r--r--PKGBUILD32
-rwxr-xr-xpixelserv-ca-init.sh4
-rw-r--r--pixelserv-tls.install51
-rw-r--r--pixelserv-tls.service10
6 files changed, 130 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..661c3507133
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = pixelserv-tls
+ pkgdesc = A tiny bespoke webserver for adblock with HTTP/1.1 and HTTPS support
+ pkgver = 2.0.1
+ pkgrel = 1
+ url = https://kazoo.ga/pixelserv-tls/
+ install = pixelserv-tls.install
+ arch = any
+ license = GPL3
+ depends = openssl>=1.0.2
+ source = pixelserv-tls-2.0.1.tar.gz::https://github.com/kvic-z/pixelserv-tls/archive/v2.0.1.tar.gz
+ source = pixelserv-ca-init.sh
+ source = pixelserv-tls.service
+ md5sums = 2cfb68b4e0bb24ba91595a913f61261a
+ md5sums = d53cf6340558d14eeb586a1129a87e9d
+ md5sums = fdb5a9de023c250a3e0d3712a836ca1e
+
+pkgname = pixelserv-tls
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..400fbff6d81
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+*.tar
+*.tar.*
+*.jar
+*.exe
+*.msi
+*.zip
+*.tgz
+*.log
+*.log.*
+*.sig
+
+pkg/
+src/
+
+*.crt
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..160f5c5e94c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Zhanibek Adilbekov <zhanibek.adilbekov@protornmail.com>
+pkgname=pixelserv-tls
+pkgver=2.0.1
+pkgrel=1
+pkgdesc="A tiny bespoke webserver for adblock with HTTP/1.1 and HTTPS support"
+arch=('any')
+url="https://kazoo.ga/pixelserv-tls/"
+license=('GPL3')
+depends=('openssl>=1.0.2')
+install="$pkgname.install"
+source=(
+ "$pkgname-$pkgver.tar.gz::https://github.com/kvic-z/pixelserv-tls/archive/v$pkgver.tar.gz"
+ "pixelserv-ca-init.sh"
+ "pixelserv-tls.service")
+md5sums=(
+ '2cfb68b4e0bb24ba91595a913f61261a'
+ 'd53cf6340558d14eeb586a1129a87e9d'
+ 'fdb5a9de023c250a3e0d3712a836ca1e')
+
+build() {
+ cd "$pkgname-$pkgver"
+ autoreconf -i
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+ make DESTDIR="$pkgdir/" install
+ install -Dm644 "$srcdir/pixelserv-tls.service" "$pkgdir/usr/lib/systemd/system/pixelserv-tls.service"
+ install -Dm755 "$srcdir/pixelserv-ca-init.sh" "$pkgdir/usr/bin/pixelserv-ca-init"
+}
diff --git a/pixelserv-ca-init.sh b/pixelserv-ca-init.sh
new file mode 100755
index 00000000000..2395cc1ea76
--- /dev/null
+++ b/pixelserv-ca-init.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+openssl genrsa -out /var/cache/pixelserv/ca.key 1024
+openssl req -key /var/cache/pixelserv/ca.key -new -x509 -days 3650 -sha256 \
+ -extensions v3_ca -out /var/cache/pixelserv/ca.crt -subj "/CN=Pixelserv CA"
diff --git a/pixelserv-tls.install b/pixelserv-tls.install
new file mode 100644
index 00000000000..0b44aa0e6fe
--- /dev/null
+++ b/pixelserv-tls.install
@@ -0,0 +1,51 @@
+# arg 1: the new package version
+post_install() {
+ if [ ! -d /var/cache/pixelserv ]; then
+ /bin/mkdir /var/cache/pixelserv
+ fi
+ /bin/chown -R nobody:root /var/cache/pixelserv
+ /bin/chmod -R 755 /var/cache/pixelserv
+cat << EOF
+
+ In order to use pixelserv-tls you need to:
+ 1. create root CA certificate https://git.io/vNuoH
+
+ cd /var/cache/pixelserv
+ sudo -u nobody openssl genrsa -out ca.key 1024
+ sudo -u nobody openssl req -key ca.key -new -x509 -days 3650 -sha256 -extensions v3_ca -out ca.crt -subj "/CN=Pixelserv CA"
+
+ 2. import CA certificate
+
+ cp /var/cache/pixelserv/ca.crt /usr/share/ca-certificates/trust-source/anchors/ca.pixelserv.crt
+ trust extract-compat
+
+ ... OR just run script as user "nobody":
+
+ sudo -u nobody pixelserv-ca-init
+
+ ... THEN start/enable systemd service:
+ sudo systemctl enable --now pixelserv-tls
+
+EOF
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install
+}
+
+# arg 1: the old package version
+post_remove() {
+cat << EOF
+
+ If you won't use pixelserv-tls anymore you may remove "Pixelserv CA" certificate
+ and pixelserv-tls's cert folder using:
+
+ rm /usr/share/ca-certificates/trust-source/anchors/ca.pixelserv.crt
+ trust extract-compat
+
+ rm -rf /var/cache/pixelserv
+
+EOF
+}
diff --git a/pixelserv-tls.service b/pixelserv-tls.service
new file mode 100644
index 00000000000..668843905e4
--- /dev/null
+++ b/pixelserv-tls.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=A tiny bespoke webserver for adblock with HTTP/1.1 and HTTPS support
+After=network.target
+
+[Service]
+ExecStart=/bin/pixelserv-tls -f -z /var/cache/pixelserv
+Restart=always
+
+[Install]
+WantedBy=mutli-user.target