diff options
-rw-r--r-- | .SRCINFO | 26 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 58 | ||||
-rw-r--r-- | config | 7 | ||||
-rw-r--r-- | service | 26 | ||||
-rw-r--r-- | sysusers.conf | 1 | ||||
-rw-r--r-- | tmpfiles.conf | 2 |
7 files changed, 124 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..aa0f8d869a68 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,26 @@ +pkgbase = google-safebrowsing-git + pkgdesc = Google SafeBrowsing API + pkgver = r53.bbf0d20 + pkgrel = 1 + url = https://github.com/google/safebrowsing/ + arch = x86_64 + license = Apache + makedepends = git + makedepends = go + depends = glibc + provides = google-safebrowsing + conflicts = google-safebrowsing + backup = etc/google-safebrowsing/config + source = google-safebrowsing::git+https://github.com/google/safebrowsing.git + source = service + source = config + source = sysusers.conf + source = tmpfiles.conf + sha256sums = SKIP + sha256sums = 137639f360bf8d543795e5ae26bf5f53755abcff16bdac86a49deabf59bf6a3b + sha256sums = 67a1ecce83116dc1c1f5d969afe14c620dd0f421969648ecd26a88fa8b6cfd39 + sha256sums = 2454d1de95e33172759f6f1643082bc1a8bc3090c8ea939142c2d70cc78300c8 + sha256sums = 8df8dc5a1a8e482c4d8b044ffe055e37a0219ad63fe4da0c31e7c364e96b3c03 + +pkgname = google-safebrowsing-git + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..18eafa278f17 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +pkg/ +src/ +*.tar.xz +google-safebrowsing diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..d6682120e58d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,58 @@ +# Maintainer: Celogeek <private-4zokpdq6@mrhyde.xyz> +_pkgname=google-safebrowsing +pkgname=${_pkgname}-git +pkgver=r53.bbf0d20 +pkgrel=1 +pkgdesc="Google SafeBrowsing API" +url="https://github.com/google/safebrowsing/" +license=('Apache') +provides=($_pkgname) +conflicts=($_pkgname) +source=( + "$_pkgname::git+https://github.com/google/safebrowsing.git" + "service" + "config" + "sysusers.conf" + "tmpfiles.conf" +) +arch=('x86_64') +noextract=() +makedepends=(git go) +depends=(glibc) +backup=( + "etc/google-safebrowsing/config" +) + +pkgver() { + cd $_pkgname + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd $_pkgname + mkdir -p build +} + +build() { + cd $_pkgname + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" + go build -o build ./cmd/... +} + +package() { + install -Dm755 -t "$pkgdir/usr/lib/$_pkgname" "$_pkgname/build/"* + install -dm750 "$pkgdir/etc/$_pkgname" + install -Dm644 -t "$pkgdir/etc/$_pkgname" config + install -Dm644 "service" $pkgdir/usr/lib/systemd/system/$_pkgname.service + install -Dm644 "sysusers.conf" "$pkgdir/usr/lib/sysusers.d/$_pkgname.conf" + install -Dm644 "tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/$_pkgname.conf" +} +sha256sums=('SKIP' + '137639f360bf8d543795e5ae26bf5f53755abcff16bdac86a49deabf59bf6a3b' + '67a1ecce83116dc1c1f5d969afe14c620dd0f421969648ecd26a88fa8b6cfd39' + '2454d1de95e33172759f6f1643082bc1a8bc3090c8ea939142c2d70cc78300c8' + '8df8dc5a1a8e482c4d8b044ffe055e37a0219ad63fe4da0c31e7c364e96b3c03') diff --git a/config b/config new file mode 100644 index 000000000000..55747585b9ab --- /dev/null +++ b/config @@ -0,0 +1,7 @@ +## Google Safebrowsing API config + +# https://github.com/google/safebrowsing +# Read the doc to obtain your API KEY + +LISTEN=127.0.0.1:34567 +API_KEY=CHANGEME diff --git a/service b/service new file mode 100644 index 000000000000..081ebad2aa3d --- /dev/null +++ b/service @@ -0,0 +1,26 @@ +[Unit] +Description=Google Safe Browsing API +After=network.target + +[Install] +WantedBy=multi-user.target + +[Service] +EnvironmentFile=/etc/google-safebrowsing/config +User=gsb +ExecStart=/usr/lib/google-safebrowsing/sbserver -srvaddr "$LISTEN" -apikey "$API_KEY" -db /var/lib/google-safebrowsing/db + +WorkingDirectory=~ +StateDirectory=google-safebrowsing +StateDirectoryMode=0750 +Restart=on-failure + +# Hardening +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectHome=yes +ProtectKernelTunables=yes +ProtectControlGroups=yes +ProtectSystem=full + diff --git a/sysusers.conf b/sysusers.conf new file mode 100644 index 000000000000..79dddeec0c40 --- /dev/null +++ b/sysusers.conf @@ -0,0 +1 @@ +u gsb - - /var/lib/google-safebrowsing diff --git a/tmpfiles.conf b/tmpfiles.conf new file mode 100644 index 000000000000..00392bc1cb1c --- /dev/null +++ b/tmpfiles.conf @@ -0,0 +1,2 @@ +Z /etc/google-safebrowsing 0640 gsb gsb +z /etc/google-safebrowsing 0750 gsb gsb |