diff --git a/hide-client/.SRCINFO b/hide-client/.SRCINFO new file mode 100644 index 0000000..f9df8f0 --- /dev/null +++ b/hide-client/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = hide-client + pkgdesc = Hide.me CLI VPN client for Linux + pkgver = 0.9.1 + pkgrel = 4 + url = hide.me + arch = any + license = GPL2 + source = https://github.com/eventure/hide.client.linux/archive/0.9.1.zip + source = go-sum.patch + source = config_sysdirs.patch + source = systemd-config.patch + source = service_sysdirs.patch + md5sums = 9346e79e8e1c98b5457a03e02febca9c + md5sums = 3cca85f964053529bc7d6581ceb3abd7 + md5sums = 07d59ac194c4aa8ee0de284283796461 + md5sums = cdd99adb78a8d0a5212e7f900fd53a6d + md5sums = ea50b6e6df86da7031cf72d8eaaf46a4 + +pkgname = hide-client + diff --git a/hide-client/PKGBUILD b/hide-client/PKGBUILD new file mode 100644 index 0000000..1f1b172 --- /dev/null +++ b/hide-client/PKGBUILD @@ -0,0 +1,71 @@ +# Maintainer: Leonard Janis Robert König +pkgname=hide-client +_pkgname=hide.client.linux +pkgver=0.9.1 +pkgrel=4 +epoch= +pkgdesc="Hide.me CLI VPN client for Linux" +arch=('any') +url="hide.me" +license=('GPL2') +groups=() +depends=() +makedepends=() +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +#XXX go.sum is created by `go mod tidy` as a workaround for repo not containing +# a go.sum file, which is required for go 1.16 compatibility. +source=("https://github.com/eventure/$_pkgname/archive/$pkgver.zip" + "go-sum.patch" + "config_sysdirs.patch" + "systemd-config.patch" + "service_sysdirs.patch") +noextract=() +md5sums=('9346e79e8e1c98b5457a03e02febca9c' + '3cca85f964053529bc7d6581ceb3abd7' + '07d59ac194c4aa8ee0de284283796461' + 'cdd99adb78a8d0a5212e7f900fd53a6d' + 'ea50b6e6df86da7031cf72d8eaaf46a4') +validpgpkeys=() + +prepare() { + cd "$_pkgname-$pkgver" + patch -p1 -i "$srcdir/systemd-config.patch" + patch -p1 -i "$srcdir/config_sysdirs.patch" + patch -p1 -i "$srcdir/service_sysdirs.patch" + patch -p1 -i "$srcdir/go-sum.patch" +} + +build() { + cd "$_pkgname-$pkgver" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + # readonly breaks build +# export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -modcacherw" + go build -o hide.me . +} + +#check() { +# cd "$_pkgname-$pkgver" +# go test . +#} + +package() { + cd "$_pkgname-$pkgver" + install -Dm755 -t "$pkgdir"/usr/bin/ hide.me + install -Dm644 -t "$pkgdir"/usr/share/hide.me/ CA.pem + # For (system-wide) accessToken.txt + install -dm750 "$pkgdir"/etc/hide.me/ + install -Dm644 -t "$pkgdir"/etc/hide.me config + install -Dm644 -t "$pkgdir"/usr/lib/systemd/system/ hide.me@.service +} diff --git a/hide-client/config_sysdirs.patch b/hide-client/config_sysdirs.patch new file mode 100644 index 0000000..4abdecd --- /dev/null +++ b/hide-client/config_sysdirs.patch @@ -0,0 +1,22 @@ +diff --git a/configuration/configuration.go b/configuration/configuration.go +index ac3947c..d65da20 100644 +--- a/configuration/configuration.go ++++ b/configuration/configuration.go +@@ -40,8 +40,8 @@ func NewHideGuardConfiguration() *HideGuardConfiguration { + Host: "", // command line option "-n" + Port: 432, // command line option "-p" + Domain: "hide.me", // Not configurable +- CA: "CA.pem", // command line option "-ca" +- AccessTokenFile: "accessToken.txt", // command line option "-t" ++ CA: "/usr/share/hide.me/CA.pem", // command line option "-ca" ++ AccessTokenFile: "/etc/hide.me/accessToken.txt", // command line option "-t" + Username: "", // command line option "-u" + Password: "", // Only configurable through the config file + ConnectTimeout: 10 * time.Second, // Only configurable through the config file +@@ -120,4 +120,4 @@ func ( c *HideGuardConfiguration ) InteractiveCredentials() ( err error ) { + func ( c *HideGuardConfiguration ) Print() { + if out, err := yaml.Marshal( c ); err != nil { fmt.Println( err ) } else { fmt.Print( string( out ) ) } + return +-} +\ No newline at end of file ++} diff --git a/hide-client/go-sum.patch b/hide-client/go-sum.patch new file mode 100644 index 0000000..0396504 --- /dev/null +++ b/hide-client/go-sum.patch @@ -0,0 +1,71 @@ +commit 36763c751815da1d07b0437174ad59ad79d5e401 +Author: Leonard König +Date: Sat Apr 10 00:29:18 2021 +0200 + + Go 1.16 requires a go.sum file, generated by `go mod tidy` + + This commit adds a go.sum file generated by `go mod tidy` to the repo. + + Upstream issue: https://github.com/golang/go/issues/44129 + +diff --git a/go.sum b/go.sum +new file mode 100644 +index 0000000..fc918a7 +--- /dev/null ++++ b/go.sum +@@ -0,0 +1,55 @@ ++github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= ++github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= ++github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= ++github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= ++github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= ++github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= ++github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw= ++github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4 h1:nwOc1YaOrYJ37sEBrtWZrdqzK22hiJs3GpDmP3sR2Yw= ++github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ= ++github.com/mdlayher/genetlink v1.0.0 h1:OoHN1OdyEIkScEmRgxLEe2M9U8ClMytqA5niynLtfj0= ++github.com/mdlayher/genetlink v1.0.0/go.mod h1:0rJ0h4itni50A86M2kHcgS85ttZazNt7a8H2a2cw0Gc= ++github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA= ++github.com/mdlayher/netlink v1.0.0/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M= ++github.com/mdlayher/netlink v1.1.0 h1:mpdLgm+brq10nI9zM1BpX1kpDbh3NLl3RSnVq6ZSkfg= ++github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY= ++github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 h1:RlZweED6sbSArvlE924+mUcZuXKLBHA35U7LN621Bws= ++github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc= ++github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= ++github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= ++github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k= ++github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= ++golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= ++golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= ++golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 h1:+ELyKg6m8UBf0nPFSqD0mi7zUfwPyXo23HNjMnXPz7w= ++golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= ++golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= ++golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= ++golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= ++golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20191003212358-c178f38b412c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= ++golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= ++golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= ++golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= ++golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= ++golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ++golang.zx2c4.com/wireguard v0.0.20200121 h1:vcswa5Q6f+sylDfjqyrVNNrjsFUUbPsgAQTBCAg/Qf8= ++golang.zx2c4.com/wireguard v0.0.20200121/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4= ++golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4 h1:KTi97NIQGgSMaN0v/oxniJV0MEzfzmrDUOAWxombQVc= ++golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4/go.mod h1:UdS9frhv65KTfwxME1xE8+rHYoFpbm36gOud1GhBe9c= ++gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= ++gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= ++gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= ++gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/hide-client/service_sysdirs.patch b/hide-client/service_sysdirs.patch new file mode 100644 index 0000000..41d34b0 --- /dev/null +++ b/hide-client/service_sysdirs.patch @@ -0,0 +1,26 @@ +diff --git a/hide.me@.service b/hide.me@.service +index b32902f..641241d 100644 +--- a/hide.me@.service ++++ b/hide.me@.service +@@ -6,9 +6,9 @@ DefaultDependencies=yes + + [Service] + Type=notify +-ExecStart=/opt/hide.me/hide.me $OPTIONS connect %i +-WorkingDirectory=/opt/hide.me +-ReadWritePaths=/opt/hide.me /etc +-EnvironmentFile=/opt/hide.me/config ++ExecStart=/usr/bin/hide.me $OPTIONS connect %i ++WorkingDirectory=/usr/bin ++ReadWritePaths=/etc ++EnvironmentFile=/etc/hide.me/config + TimeoutStopSec=30 + Restart=always + RestartSec=5s +@@ -30,4 +30,4 @@ Group=root + LimitNOFILE=64 + + [Install] +-WantedBy=multi-user.target +\ No newline at end of file ++WantedBy=multi-user.target diff --git a/hide-client/systemd-config.patch b/hide-client/systemd-config.patch new file mode 100644 index 0000000..c741a23 --- /dev/null +++ b/hide-client/systemd-config.patch @@ -0,0 +1,30 @@ +diff --git a/config b/config +new file mode 100644 +index 0000000..f0d2bfb +--- /dev/null ++++ b/config +@@ -0,0 +1 @@ ++OPTIONS= +diff --git a/hide.me@.service b/hide.me@.service +index b32902f..46b44ef 100644 +--- a/hide.me@.service ++++ b/hide.me@.service +@@ -6,9 +6,10 @@ DefaultDependencies=yes + + [Service] + Type=notify +-ExecStart=/opt/hide.me/hide.me connect %i ++ExecStart=/opt/hide.me/hide.me $OPTIONS connect %i + WorkingDirectory=/opt/hide.me + ReadWritePaths=/opt/hide.me /etc ++EnvironmentFile=/opt/hide.me/config + TimeoutStopSec=30 + Restart=always + RestartSec=5s +@@ -30,4 +31,4 @@ Group=root + LimitNOFILE=64 + + [Install] +-WantedBy=multi-user.target +\ No newline at end of file ++WantedBy=multi-user.target