From 8cf6c69a325cb846273310553be628156841931d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 24 Jan 2023 11:24:47 +0000 Subject: app-admin/opensnitch : new package (import from pentoo) --- app-admin/opensnitch/Manifest | 22 +++++ app-admin/opensnitch/files/opensnitch-ui | 1 + app-admin/opensnitch/files/opensnitch.initd | 12 +++ app-admin/opensnitch/files/systemd.patch | 13 +++ app-admin/opensnitch/opensnitch-1.5.2-r1.ebuild | 121 ++++++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 app-admin/opensnitch/Manifest create mode 100644 app-admin/opensnitch/files/opensnitch-ui create mode 100644 app-admin/opensnitch/files/opensnitch.initd create mode 100644 app-admin/opensnitch/files/systemd.patch create mode 100644 app-admin/opensnitch/opensnitch-1.5.2-r1.ebuild (limited to 'app-admin') diff --git a/app-admin/opensnitch/Manifest b/app-admin/opensnitch/Manifest new file mode 100644 index 00000000..6be7b9b6 --- /dev/null +++ b/app-admin/opensnitch/Manifest @@ -0,0 +1,22 @@ +DIST github.com-evilsocket-ftrace-v1.2.0.tar.gz 16895 BLAKE2B e17f90820eb6c2a5691477a1616753407f27ba509262ea57fffcf269f3e5e9ab8e87d86830796ef9cffeed78d36b4868a23746054cf26d82e0146a2462e8249d SHA512 e7787485a97ca0c1dc31dde2973d795439015d412a0588c813f601dc7eaf80912016675a2674748c4c3f49b50ec11a59274eeccf0fe4052e7249159d29a58909 +DIST github.com-fsnotify-fsnotify-v1.5.1.tar.gz 32691 BLAKE2B 9140e0a6e675b0beb2561805dbe251ad05151ce15b5fb6e1cec3974c71575f636788bac78ed0eb66775e03a165079f84154ea99b26636ea09518254df993f84a SHA512 8139cc581044f45905a3658955075d19dc02631d6b997ef0e264c46704303e01f7ac09f7fb48dd11b89cbf7d61f371c03f291e3b03db7b305c61bb15d1b4c503 +DIST github.com-golang-net-27dd8689420f.tar.gz 1230097 BLAKE2B f332557ddc39f607336374ae57dce7b60bdb441d97c2c8ff557cffcfccf5423fbd1db7d9387c22a3e919d737e831e77bb6fe6c86c56e0680098b3ed04cdd9478 SHA512 7ee1c0bca7d87b44697a96f02474d850517d4044b50260fe08cfa2eb6435a0e51aae51d93370ff31f21437355b4af1f27563f6b990083517108e2c7e7dff36cd +DIST github.com-golang-protobuf-v1.5.2.tar.gz 171702 BLAKE2B 4b1b0936aed1919f3ec967648d15a0c533b57d9d19d3c80c8d4149345bf6bda096d6b5cfd5c49ef5e76eb7358e694fc159d16faedb096faf81e82e425377892d SHA512 5707936f2ea9493d2f3897a3ec04139afcc00b3dbfaa2142b56a492d356bc17e26237c74788b047592a0fa89c0078b7970dbf481f7c33a7a63c5f50557779590 +DIST github.com-golang-sync-036812b2e83c.tar.gz 18757 BLAKE2B bcacc4b7967712290c678018d206c24b71bf3057c862454bccdd497c792a7d9000ecbac329a19ad364387e18a5f1f368d5e177a78670eb631808c2d336c83af6 SHA512 5e9a75eabc254b496b39bfb33181999a2060188db17c6bcc31b3d0a31d32122eb078cac8a3359675f03078a456839541e43d169103b183484372bb74857160dd +DIST github.com-golang-sys-4e6760a101f9.tar.gz 1260696 BLAKE2B 68144701163d4721523ac02125058cc5bc09e20571d37475b8a15c36cfc1dd54ff40d7ed0ceabb30ed4969c857b3fab8fd4141b17d8ce17a1052c5fe6f81897c SHA512 24df91664f83c548901f412820f8b3165617c1540e17759ac6f1361082debc4dcc320ad3cb2c595c2fe528c424849643ed87a212127dba7503a405983a91fcbe +DIST github.com-golang-text-v0.3.7.tar.gz 8354718 BLAKE2B 77eb1d08ff420e0d1fff4e92641bd463a0a6e84625bc26f83a9edc467144448b513116f8b72954a30533eafe3454fb739dcdede169229a01df81c8b152c2ba57 SHA512 52899d4326ba4c9bb9a051ba52810d12e531a57bb85d48fa03dd9a9cbbf69a191eb35fbf8dfec8ec8ded706f5a67cd9cf39bc4f491676004e335a37878adb6f2 +DIST github.com-google-gopacket-v1.1.19.tar.gz 950745 BLAKE2B fae65da5b9611aace62d4b2565a197b9512223c05f4cfd95178b7cb307fe6bb522a31b9d4d9fbd8cfe86056ef1f90dbefccb183963a1040a6b56ea5a07eb019e SHA512 c9ca009770f84d29c30b5a6ae210f4b09051f4bbcb81c1118d3f8ab577b16fb617c89fb461ad4117ec7fe3b8bdc7efe778a2f56526276f984573d8293ae0ef62 +DIST github.com-google-nftables-950e408d48c671ccd9f4997a4b6eb95db21365d6.tar.gz 52437 BLAKE2B 6ea9115fc39c8833715c78792dc79dc682b83bcd85def563729f171988e66d491e2463247035a2102e45d0bce06a2376a3b77fe395e5a3e67241bb59cfdccc21 SHA512 7ad830a1761c42995643c0a66b635332fe9bb1c4eb3c47ec3e69cd39e4f63f1bc88187e9c262edc8d30ab39af281a5fa8de05f250c5f4c9b87c1278ccedf8cb3 +DIST github.com-googleapis-go-genproto-325a89244dc8.tar.gz 12862283 BLAKE2B 6ac945d3b3ee959bab4b8bf59c11976cc7a0fa11e8f5ef6fbbf2ed04c05cf3f2b3e572893c148bb57bbce4e134e3fd8f8e11403987b3293e55317348fb92468e SHA512 b9d91610c4b39447ac56d40a4e7ad57f1c29f6a228aea6931daa1dd680a171a13bfa1a4ebb66f2c423b0d5aedcd232a3d51d6f0c6c8790f977d249129a0879f8 +DIST github.com-grpc-grpc-go-v1.32.0.tar.gz 1053458 BLAKE2B 34fdd17ef7edecc84df8fbcfaee653192fd370e98929e33ba7bff7ef0e6fa04e3befb3153ab23d4bd98eeecb3c714e77aac2c56d448eb99b1d2e03bfc1a39798 SHA512 004f6ba02a53c67051cfe595ab5ce2692a6ef878d55a48165bd601cdbd5fa3a8e4944ba1ca7f5dc4aafac76f85c23714f8f2cfce8d14ea705ef4897c70cfce29 +DIST github.com-iovisor-gobpf-v0.2.0.tar.gz 115750 BLAKE2B 72d08e28d3453b0f2fd5acc3b16586fb4802b9faaad46e219f2465a48cadcb2ecc63c306f0e2a6d64e7c3308d2c55dc083bde6642678c8ce2acfefb63def7275 SHA512 00f28329b89a2fd7e76339b49e30b1bef31eab62854a77c77ccf29ac891f3c12b52f6feb3203d78b8ae2c5fe2f5529db5280686f752cd5b4577e5312dcc67ead +DIST github.com-josharian-native-v1.0.0.tar.gz 1803 BLAKE2B 312ccaa66a0300f8008c43694afc487713424002aac44f181df67ebc850cf31a755cc3b7bd541ad7283d8f8cc05b09c751fac962f2166321dbd2a39c2a336739 SHA512 ec1c4a1abf5cf39221de87d50443b7e7f48ca5b9dbfa0662a43cf7e54c0912ebad4209ee909423104ac2b236b9f781ed08673cef6194d23239aa3f6ca3030bba +DIST github.com-mdlayher-netlink-v1.6.0.tar.gz 58884 BLAKE2B 42461a6d1abf984cb1d38ba92e49d600fbab94bc3a961423bbc09da6f6a992a43daebd9112a27539869effae9165d685de87ebdce87f4242acefa8f348b03e31 SHA512 d74221db8de9d59a43622838bd58eb1af87ec36413a3147e9d724edf536cdc901cc27cf4bd7b0adf4d44eb0dfb2ae4fc4ab966437cbceac941b2834f95cded95 +DIST github.com-mdlayher-socket-v0.2.2.tar.gz 16879 BLAKE2B e764cd906400c24bf3b19befe654d7144e147116788fbceeb8d262de2f0c352c1da3ea6c797063c8aa93841be4f9cdb5f7f64c93db93aebf1061f5554a174ca2 SHA512 68312b06d20347960fee198857c23cb984d7a6a1bae48ca23c86e58e519cb3d4fe0a8b9b218b829a8dc40d7167af5f9a040d8e6c9f96cdd7f9d15c8499387d73 +DIST github.com-protocolbuffers-protobuf-go-v1.27.1.tar.gz 1278521 BLAKE2B 1591dbfc5aae2360d69ca3e5e9247c4287114699f732d85011fb1c6b5daa3532d2218ce4ddf0390ffb23a3fd097ffa1b6bc418ba968dab98112a4522cc5fe93b SHA512 a0236bc88b963df0acc2a2c7c247334614b2d555f341e103fd06759665802069a320ced4ab51be658283cc816ec9f2d53ed98728895c5b8ce18954a17663264b +DIST github.com-vishvananda-netlink-v1.1.0.tar.gz 147026 BLAKE2B 146936d2a959f1a9509e94a50dfd36a1bee9599d158d41a29ac65d305520f85def91df78b6c7b5475915e7aef11b150de6aefd7e2fd8856550624281555ef8b0 SHA512 55f184870a9ce85314d278722f49e0c2f51939841f37aee8f50bb150afa545fd18a9a43556d428fb8e960eb063a14c50c920de20f2a375bd780432cb26155918 +DIST github.com-vishvananda-netns-50045581ed74.tar.gz 8714 BLAKE2B f52368ec96295eb22491fc361ea5571e49a7e7a2eac1638863e680070968612d5abbbef9c7f7bcb6c18aca13972289bc352b93913c299f4f6f6d64a2ab1e917e SHA512 8a7943b0c6ebb606a8af534c78a87a47be6204f490b569296e375c841d321f470f1c006b95d09e843ac50763c0496fd0a60f73a4a8eb5c55bc68f1f36fd1296a +DIST opensnitch-1.5.2.tar.gz 995296 BLAKE2B aab54c00de55c42aebbae23fd0cb7befdc87c633153c9ae4a4b6535587e2ccd3436343cdd121e76118d3c17ec23778fb80e5d973dcd8b296b2f1986cc2dc1e6f SHA512 77ad266dd3531f576e2b10aff5bcfa724c4e7b90d8b9deb01d7bdf24c728f32c9a7d16eaa91954177a3717fbebc8b1524cf975ae899c2d703ccaba4ac4b86c19 +DIST opensnitch_amd64.o 10728 BLAKE2B 398f97a9136c8909955dc0ee2f258d2940b915fbd9142e97540813c977bb67cceb2cfc80df248512bc974960d0936c18c55496c1fd17e3176681560a52518047 SHA512 167b1913c0da8597079bee71063a084724b8326b3587ca91b7b72116ae8e998dae8871976fcb7b98135868ffe274d5d332dbacd53a0e47fb5510122b875674af +DIST opensnitch_arm64.o 10384 BLAKE2B 6439a1d29af9e44794aeb5a6a07ed0556f3cfd5afb6e1bdf8002b058acaae0909b362697bf32f60553ce42853e573d24f272712e215c08af2b677d513cbfff37 SHA512 298ee7aea9b70c206b5d12ada016b21a05fb0ee65001e24bf3bf949dcb9308fde83fff8e281df761354ebdcfc3ff9672ec0000a19e1f285b61228cb4eeba0700 +DIST opensnitch_i386.o 10368 BLAKE2B 15b4abd5da8c2ab29f91b2fdefe6ee095dde09d1dcb3180339ba8ab567e29400e77598f1f969c7a4e9b23140564807c237d52b5601d84e2733b658fa9ccd1aaa SHA512 a8e493f4f62e706d0499fa92777ebd8339c925b1622a75595971ee53a3d73b653749a053c3c43bb4a0dc7b6baaed45442d458626c3731bcbc97af069e2b7b160 diff --git a/app-admin/opensnitch/files/opensnitch-ui b/app-admin/opensnitch/files/opensnitch-ui new file mode 100644 index 00000000..7c005f42 --- /dev/null +++ b/app-admin/opensnitch/files/opensnitch-ui @@ -0,0 +1 @@ +opensnitch-ui --socket unix:///tmp/osui.sock & diff --git a/app-admin/opensnitch/files/opensnitch.initd b/app-admin/opensnitch/files/opensnitch.initd new file mode 100644 index 00000000..0597b0dd --- /dev/null +++ b/app-admin/opensnitch/files/opensnitch.initd @@ -0,0 +1,12 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Desktop application firewall" +command="/usr/bin/opensnitchd" +command_args=" -rules-path /etc/opensnitchd/rules -ui-socket unix:///tmp/osui.sock -cpu-profile /tmp/cpu.profile -mem-profile /tmp/mem.profile" +start_stop_daemon_args="--quiet" +pidfile="/run/opensnitchd.pid" +command_background=true + +# vim: set ft=gentoo-init-d ts=4 : diff --git a/app-admin/opensnitch/files/systemd.patch b/app-admin/opensnitch/files/systemd.patch new file mode 100644 index 00000000..aa7a1324 --- /dev/null +++ b/app-admin/opensnitch/files/systemd.patch @@ -0,0 +1,13 @@ +diff --git a/daemon/opensnitchd.service b/daemon/opensnitchd.service +index 014e79e..8a81d0e 100644 +--- a/daemon/opensnitchd.service ++++ b/daemon/opensnitchd.service +@@ -8,7 +8,7 @@ After=network.target + Type=simple + PermissionsStartOnly=true + ExecStartPre=/bin/mkdir -p /etc/opensnitchd/rules +-ExecStart=/usr/local/bin/opensnitchd -rules-path /etc/opensnitchd/rules ++ExecStart=/usr/bin/opensnitchd -rules-path /etc/opensnitchd/rules -ui-socket unix:///tmp/osui.sock -cpu-profile /tmp/cpu.profile -mem-profile /tmp/mem.profile + Restart=always + RestartSec=30 + diff --git a/app-admin/opensnitch/opensnitch-1.5.2-r1.ebuild b/app-admin/opensnitch/opensnitch-1.5.2-r1.ebuild new file mode 100644 index 00000000..2987c669 --- /dev/null +++ b/app-admin/opensnitch/opensnitch-1.5.2-r1.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{10..11} ) +inherit distutils-r1 linux-info systemd + +EGO_PN="github.com/evilsocket/opensnitch" +EGO_VENDOR=( + "github.com/evilsocket/ftrace v1.2.0" + "github.com/fsnotify/fsnotify v1.5.1" + "github.com/golang/protobuf v1.5.2" + "github.com/google/gopacket v1.1.19" + "github.com/google/nftables 950e408d48c671ccd9f4997a4b6eb95db21365d6" + "github.com/iovisor/gobpf v0.2.0" + "github.com/vishvananda/netlink v1.1.0" + "github.com/vishvananda/netns 50045581ed74" + "golang.org/x/net 27dd8689420f github.com/golang/net" + "golang.org/x/sync 036812b2e83c github.com/golang/sync" + "golang.org/x/sys 4e6760a101f9 github.com/golang/sys" + "golang.org/x/text v0.3.7 github.com/golang/text" + "google.golang.org/grpc v1.32.0 github.com/grpc/grpc-go" + + "google.golang.org/protobuf v1.27.1 github.com/protocolbuffers/protobuf-go" + "google.golang.org/genproto 325a89244dc8 github.com/googleapis/go-genproto" + "github.com/mdlayher/netlink v1.6.0" + "github.com/josharian/native v1.0.0" + "github.com/mdlayher/socket v0.2.2" +) + +inherit golang-vcs-snapshot + +DESCRIPTION="Desktop application firewall" +HOMEPAGE="https://github.com/evilsocket/opensnitch" + +SRC_URI="https://github.com/evilsocket/opensnitch/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + ${EGO_VENDOR_URI} + amd64? ( https://dev.pentoo.ch/~blshkv/distfiles/opensnitch_amd64.o ) + x86? ( https://dev.pentoo.ch/~blshkv/distfiles/opensnitch_i386.o ) + arm64? ( https://dev.pentoo.ch/~blshkv/distfiles/opensnitch_arm64.o ) + " + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="systemd" +KEYWORDS="" + +DEPEND=">=dev-lang/go-1.13 + net-libs/libnetfilter_queue + dev-go/go-protobuf + dev-go/protoc-gen-go-grpc + " +RDEPEND=" + dev-python/grpcio-tools[${PYTHON_USEDEP}] + dev-python/python-slugify[${PYTHON_USEDEP}] + dev-python/pyinotify[${PYTHON_USEDEP}] + dev-python/PyQt5[sql,${PYTHON_USEDEP}] +" + +RESTRICT="test" +#https://github.com/evilsocket/opensnitch/issues/712 +QA_PREBUILT="etc/opensnitchd/opensnitch.o" + +#KPROBES* required by ebpf +CONFIG_CHECK="NETFILTER_XT_MATCH_CONNTRACK CGROUP_BPF BPF BPF_SYSCALL BPF_EVENTS KPROBES KPROBE_EVENTS" + +pkg_pretend() { + linux-info_pkg_setup +} + +src_prepare() { + rm -r src/${EGO_PN}/ui/tests + emake -C src/${EGO_PN} protocol + cd src/${EGO_PN}/ui + pyrcc5 -o opensnitch/resources_rc.py opensnitch/res/resources.qrc + sed -i 's/^import ui_pb2/from . import ui_pb2/' opensnitch/ui_pb2* + use systemd && cd "${WORKDIR}/${P}/src/${EGO_PN}" && eapply "${FILESDIR}/systemd.patch" + eapply_user +} + +src_compile() { + GOPATH="${S}:$(get_golibdir_gopath)" \ + GOCACHE="${T}/go-cache" \ + go build -v -work -x -ldflags="-s -w" "${EGO_PN}/daemon" || die + + pushd src/${EGO_PN}/ui >/dev/null || die + distutils-r1_src_compile + popd >/dev/null || die +} + +src_install(){ + newbin daemon opensnitchd + + pushd src/${EGO_PN}/ui >/dev/null || die + distutils-r1_src_install + popd >/dev/null || die + + pushd src/${EGO_PN}/daemon >/dev/null || die + insinto /etc/opensnitchd/rules + insinto /etc/opensnitchd/ + doins default-config.json + doins system-fw.json + + if use amd64; then + newins "${DISTDIR}"/opensnitch_amd64.o opensnitch.o + elif use arm64; then + newins "${DISTDIR}"/opensnitch_arm64.o opensnitch.o + elif use x86; then + newins "${DISTDIR}"/opensnitch_i386.o opensnitch.o + fi + popd >/dev/null || die + + if use systemd; then + pushd src/${EGO_PN}/daemon >/dev/null || die + systemd_dounit opensnitchd.service + popd >/dev/null || die + else + newinitd "${FILESDIR}"/opensnitch.initd ${PN} + fi +} -- cgit v1.2.3