2022-01-21 18:45:44 +01:00
|
|
|
#
|
2023-05-09 02:49:51 +02:00
|
|
|
# spec file
|
2022-01-21 18:45:44 +01:00
|
|
|
#
|
2023-01-21 03:03:49 +01:00
|
|
|
# Copyright (c) 2023 SUSE LLC
|
2022-01-21 18:45:44 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2023-01-21 03:03:49 +01:00
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%define flavor @BUILD_FLAVOR@%{nil}
|
|
|
|
|
|
|
|
%if "%{flavor}" == "client"
|
|
|
|
%define build_client 1
|
|
|
|
%define build_server 0
|
|
|
|
%define build_kafka_humio_gateway 0
|
|
|
|
%define name_suffix -client
|
|
|
|
%define make_target linux_bare
|
|
|
|
%define config_perms %attr(0600, root, root)
|
|
|
|
%define state_dir_perms %attr(0700, root, root)
|
|
|
|
%else
|
|
|
|
%define build_kafka_humio_gateway 1
|
|
|
|
%define build_server 1
|
|
|
|
%define build_client 0
|
|
|
|
%define name_suffix %{nil}
|
|
|
|
%define make_target linux
|
|
|
|
%define config_perms %attr(0640, root, velociraptor)
|
|
|
|
%define state_dir_perms %attr(0700, velociraptor, velociraptor)
|
|
|
|
%endif
|
|
|
|
|
2022-01-21 18:45:44 +01:00
|
|
|
%define projname velociraptor
|
2023-05-09 02:49:51 +02:00
|
|
|
%define vendor_version 0.6.7.5~git77.997aa73
|
2022-11-14 16:01:41 +01:00
|
|
|
%define vmlinux_h_version 5.14.21150400.22-150400-default
|
2022-01-21 18:45:44 +01:00
|
|
|
|
2023-01-21 03:50:51 +01:00
|
|
|
# SLE 15 SP2 / Leap 15.2 or newer gets eBPF
|
|
|
|
# Earlier versions don't have a usable eBPF and the
|
|
|
|
# release doesn't easily build llvm13
|
2023-01-21 05:12:03 +01:00
|
|
|
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200
|
2023-01-19 02:05:43 +01:00
|
|
|
%bcond_without bpf
|
|
|
|
%else
|
|
|
|
%bcond_with bpf
|
|
|
|
%endif
|
|
|
|
|
2023-01-21 03:03:49 +01:00
|
|
|
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
|
|
|
%if ! %{defined _fillupdir}
|
|
|
|
%define _fillupdir %{_localstatedir}/adm/fillup-templates
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# SLE12 has _sharedstatedir in an odd place
|
|
|
|
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} < 150000
|
|
|
|
%define _sharedstatedir /var/lib
|
|
|
|
%endif
|
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
Name: velociraptor%{name_suffix}
|
2023-05-10 02:51:00 +02:00
|
|
|
Version: 0.6.7.5~git81.01be570
|
2022-01-21 18:45:44 +01:00
|
|
|
Release: 0
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_server}
|
2023-01-21 03:03:49 +01:00
|
|
|
Summary: Endpoint visibility and collection tool
|
2023-05-09 02:49:51 +02:00
|
|
|
%else
|
|
|
|
Summary: Endpoint visibility and collection tool (endpoint only)
|
|
|
|
%endif
|
2023-01-21 03:03:49 +01:00
|
|
|
Group: System/Monitoring
|
2022-01-21 18:45:44 +01:00
|
|
|
License: AGPL-3.0-only
|
|
|
|
URL: https://github.com/Velocidex/velociraptor
|
|
|
|
Source: %{projname}-%{version}.tar.xz
|
2023-01-21 03:03:49 +01:00
|
|
|
Source1: vendor-golang-%{vendor_version}.tar.xz
|
|
|
|
Source2: vendor-golang-kafka-humio-gateway-%{vendor_version}.tar.xz
|
|
|
|
Source3: vendor-nodejs-%{vendor_version}.tar.xz
|
2023-05-09 02:49:51 +02:00
|
|
|
Source4: vmlinux.h-%{vmlinux_h_version}.tar.xz
|
|
|
|
Source5: velociraptor.service
|
|
|
|
Source6: velociraptor-server.config.placeholder
|
|
|
|
Source7: velociraptor-client.service
|
|
|
|
Source8: velociraptor-client.config.placeholder
|
2023-01-21 03:03:49 +01:00
|
|
|
Source9: update-vendoring.sh
|
2023-05-09 02:49:51 +02:00
|
|
|
Source10: sysconfig.velociraptor
|
|
|
|
Source11: sysconfig.velociraptor-client
|
2023-01-25 14:29:03 +01:00
|
|
|
Source12: %{projname}.obsinfo
|
2023-05-09 04:00:49 +02:00
|
|
|
Source13: system-user-velociraptor.sysusers
|
|
|
|
Source14: velociraptor-kafka.sysusers
|
|
|
|
Source15: velociraptor-kafka-humio-gateway.service
|
|
|
|
Source16: sysconfig.velociraptor-kafka-humio-gateway
|
2023-01-21 03:03:49 +01:00
|
|
|
Patch1: velociraptor-golang-mage-vendoring.diff
|
2023-05-09 02:49:51 +02:00
|
|
|
Patch2: vendor-build-fixes-for-SLE12.patch
|
|
|
|
Patch3: sdjournal-build-fix-for-SLE12.patch
|
|
|
|
Patch4: velociraptor-reproducible-timestamp.diff
|
2023-01-21 03:03:49 +01:00
|
|
|
BuildRequires: fileb0x
|
2022-01-21 18:45:44 +01:00
|
|
|
BuildRequires: golang-packaging
|
2023-01-21 03:03:49 +01:00
|
|
|
BuildRequires: mage
|
2022-01-21 18:45:44 +01:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2023-01-19 16:27:12 +01:00
|
|
|
BuildRequires: golang(API) >= 1.18
|
2023-01-21 03:03:49 +01:00
|
|
|
BuildRequires: pkgconfig(libsystemd)
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_server}
|
2023-05-10 01:43:33 +02:00
|
|
|
BuildRequires: nodejs >= 18
|
|
|
|
BuildRequires: npm >= 18
|
2023-05-09 02:49:51 +02:00
|
|
|
%endif
|
2023-01-19 02:05:43 +01:00
|
|
|
%if %{with bpf}
|
2023-05-09 02:49:51 +02:00
|
|
|
# clang15 causes libbpfgo to crash immediately
|
|
|
|
BuildRequires: clang16
|
2023-01-21 03:03:49 +01:00
|
|
|
BuildRequires: libelf-devel
|
2023-05-09 02:49:51 +02:00
|
|
|
BuildRequires: libzstd-devel
|
|
|
|
BuildRequires: libzstd-devel
|
|
|
|
BuildRequires: llvm16
|
|
|
|
BuildRequires: zlib-devel
|
2023-01-19 02:05:43 +01:00
|
|
|
%endif
|
2023-05-09 02:49:51 +02:00
|
|
|
Requires: group(velociraptor)
|
|
|
|
Requires: user(velociraptor)
|
2023-01-21 03:03:49 +01:00
|
|
|
ExclusiveArch: x86_64 ppc64le aarch64 s390x
|
2023-05-09 04:00:49 +02:00
|
|
|
%if %{build_server}
|
2023-05-09 02:49:51 +02:00
|
|
|
BuildRequires: sysuser-tools
|
|
|
|
%{?sysusers_requires}
|
|
|
|
%endif
|
2022-01-21 18:45:44 +01:00
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_server}
|
2022-01-21 18:45:44 +01:00
|
|
|
%description
|
|
|
|
Velociraptor is a tool for collecting host based state information
|
|
|
|
using The Velociraptor Query Language (VQL) queries.
|
|
|
|
|
|
|
|
To learn more about Velociraptor, read the documentation on:
|
|
|
|
|
|
|
|
https://docs.velociraptor.app/
|
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
This package contains the velociraptor server and full console GUI.
|
2022-01-21 18:45:44 +01:00
|
|
|
For just the endpoint agent, please install the 'velociraptor-client' package.
|
2023-05-09 04:00:49 +02:00
|
|
|
|
|
|
|
%package -n system-user-velociraptor
|
|
|
|
Summary: System user and group 'velociraptor'
|
|
|
|
Version: 1.0.0
|
|
|
|
License: Apache-2.0
|
|
|
|
Group: System/Monitoring
|
|
|
|
Provides: group(velociraptor)
|
|
|
|
Provides: user(velociraptor)
|
|
|
|
|
|
|
|
%description -n system-user-velociraptor
|
|
|
|
This package provides a shared system user for all velociraptor components
|
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%endif
|
2022-01-21 18:45:44 +01:00
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_kafka_humio_gateway}
|
2022-03-15 15:14:34 +01:00
|
|
|
%package kafka-humio-gateway
|
2023-01-21 03:03:49 +01:00
|
|
|
Summary: Gateway between Kafka and Humio for Velociraptor Artifacts
|
2023-05-10 02:51:00 +02:00
|
|
|
Version: 0.6.7.5~git81.01be570
|
2023-05-09 02:49:51 +02:00
|
|
|
Requires: group(velociraptor-kafka)
|
|
|
|
Requires: user(velociraptor-kafka)
|
2022-03-15 15:14:34 +01:00
|
|
|
|
|
|
|
%description kafka-humio-gateway
|
|
|
|
This tool is used to consume events generated by the Kafka Velociraptor plugin
|
|
|
|
and post them to a Humio cluster.
|
2023-05-09 02:49:51 +02:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{build_client}
|
|
|
|
%description
|
|
|
|
Velociraptor is a tool for collecting host based state information
|
|
|
|
using The Velociraptor Query Language (VQL) queries.
|
|
|
|
|
|
|
|
To learn more about Velociraptor, read the documentation on:
|
|
|
|
|
|
|
|
https://docs.velociraptor.app/
|
|
|
|
|
|
|
|
This package contains only the endpoint agent. For the full server and GUI
|
|
|
|
console, please install the 'velociraptor' package.
|
|
|
|
%endif
|
2022-01-21 18:45:44 +01:00
|
|
|
|
|
|
|
%prep
|
2023-05-09 02:49:51 +02:00
|
|
|
%setup -q -a 1 -a 2 -a 3 -a 4 -n %{projname}-%{version}
|
2022-01-21 18:45:44 +01:00
|
|
|
%autopatch -p1
|
|
|
|
|
|
|
|
# Set the version to something more specific than <next-tag>-dev
|
|
|
|
sed -ie "s/\(VERSION *= \).*/\1 \"%{version}\"/" constants/constants.go
|
|
|
|
|
2023-01-19 02:05:43 +01:00
|
|
|
%if %{with bpf}
|
2022-08-19 20:30:12 +02:00
|
|
|
mkdir -p third_party/libbpfgo/output
|
2022-11-12 02:51:37 +01:00
|
|
|
|
2022-11-14 16:01:41 +01:00
|
|
|
cp vmlinux.h-%{vmlinux_h_version}/vmlinux-%{_arch}.h \
|
|
|
|
third_party/libbpfgo/output/vmlinux.h
|
2023-01-19 02:05:43 +01:00
|
|
|
%endif
|
2022-08-19 20:30:12 +02:00
|
|
|
|
2022-01-21 18:45:44 +01:00
|
|
|
# These just clutter the GUI and we don't have Windows clients
|
2022-02-07 19:30:48 +01:00
|
|
|
# Note: There are dependencies on these that need to be resolved before
|
|
|
|
# removing them outright.
|
2022-05-05 20:38:36 +02:00
|
|
|
# rm -rf artifacts/definitions/Windows
|
2022-01-21 18:45:44 +01:00
|
|
|
|
|
|
|
%build
|
2023-01-25 14:29:03 +01:00
|
|
|
|
|
|
|
# Reproductible builds need stable timestamps
|
|
|
|
timestamp=$(date -Iseconds --utc --date=@$(grep mtime: %{SOURCE12}|sed -e 's/mtime: //'))
|
|
|
|
git_commit=$(grep commit: %{SOURCE12}|sed -e 's/commit: //g')
|
|
|
|
|
|
|
|
export VELOCIRAPTOR_BUILD_TIME=$timestamp
|
|
|
|
export VELOCIRAPTOR_GIT_HEAD=$git_commit
|
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_server}
|
2022-01-21 18:45:44 +01:00
|
|
|
(cd gui/velociraptor ; npm run build)
|
2023-05-09 04:00:49 +02:00
|
|
|
%sysusers_generate_pre %{SOURCE13} velociraptor-user
|
2023-05-09 02:49:51 +02:00
|
|
|
%endif
|
|
|
|
|
|
|
|
make %{make_target} BUILD_LIBBPFGO=%{with bpf} GIT=echo
|
2022-01-21 18:45:44 +01:00
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_kafka_humio_gateway}
|
2022-08-19 20:30:12 +02:00
|
|
|
(cd contrib/kafka-humio-gateway; go build -o %{name}-kafka-humio-gateway)
|
2023-05-09 04:00:49 +02:00
|
|
|
%sysusers_generate_pre %{SOURCE16} kafka-user
|
2023-05-09 02:49:51 +02:00
|
|
|
%endif
|
2022-03-15 15:14:34 +01:00
|
|
|
|
2022-01-21 18:45:44 +01:00
|
|
|
%install
|
2023-05-09 02:49:51 +02:00
|
|
|
install -D -d -m 0750 %buildroot/%{_sysconfdir}/velociraptor
|
|
|
|
install -D -d -m 0700 %buildroot/%{_sharedstatedir}/%{name}/data
|
|
|
|
install -D -d -m 0700 %buildroot/%{_sharedstatedir}/%{name}/logs
|
|
|
|
install -D -d -m 0700 %buildroot/%{_sharedstatedir}/%{name}/tmp
|
|
|
|
|
|
|
|
%if %{build_server}
|
|
|
|
service_file_source=%{SOURCE5}
|
|
|
|
config_file_source=%{SOURCE6}
|
|
|
|
sysconfig_file_source=%{SOURCE10}
|
|
|
|
config_file=server.config
|
2023-05-09 04:00:49 +02:00
|
|
|
|
|
|
|
install -D -m 0644 %{SOURCE13} %{buildroot}%{_sysusersdir}/system-user-velociraptor.conf
|
2023-05-09 02:49:51 +02:00
|
|
|
%else
|
|
|
|
service_file_source=%{SOURCE7}
|
|
|
|
config_file_source=%{SOURCE8}
|
|
|
|
sysconfig_file_source=%{SOURCE11}
|
|
|
|
config_file=client.config
|
|
|
|
%endif
|
|
|
|
|
|
|
|
install -D -m 0644 "$service_file_source" %{buildroot}%{_unitdir}/%{name}.service
|
|
|
|
install -D -m 0644 "$sysconfig_file_source" %{buildroot}%{_fillupdir}/sysconfig.%{name}
|
|
|
|
install -D -m 0640 "$config_file_source" "%{buildroot}%{_sysconfdir}/velociraptor/$config_file"
|
|
|
|
install -D -m 0755 output/velociraptor-v%{version}-linux-* %buildroot/%{_bindir}/%{name}
|
|
|
|
|
|
|
|
%if %{build_kafka_humio_gateway}
|
2023-05-09 04:00:49 +02:00
|
|
|
install -D -m 0644 %{SOURCE15} %{buildroot}%{_unitdir}/
|
|
|
|
install -D -m 0644 %{SOURCE16} %{buildroot}%{_fillupdir}/
|
2023-05-09 02:49:51 +02:00
|
|
|
install -D -m 0755 contrib/kafka-humio-gateway/velociraptor-kafka-humio-gateway %buildroot/%{_bindir}
|
|
|
|
install -D -m 0644 contrib/kafka-humio-gateway/sample-config.yml \
|
|
|
|
%buildroot/%{_datadir}/velociraptor-kafka-humio-gateway/sample-config.yml
|
2023-05-09 04:00:49 +02:00
|
|
|
install -D -m 0644 %{SOURCE14} %{buildroot}%{_sysusersdir}/velociraptor-kafka.conf
|
2023-05-09 02:49:51 +02:00
|
|
|
install -D -d -m 0750 %{buildroot}%{_sysconfdir}/velociraptor-kafka-humio-gateway
|
|
|
|
install -D -m 0640 contrib/kafka-humio-gateway/sample-config.yml \
|
|
|
|
%buildroot/%{_sysconfdir}/velociraptor-kafka-humio-gateway/transport.yml
|
|
|
|
%endif
|
2022-01-21 18:45:44 +01:00
|
|
|
|
|
|
|
%files
|
2023-01-21 03:03:49 +01:00
|
|
|
%defattr(-, root, root)
|
2022-01-21 18:45:44 +01:00
|
|
|
%license LICENSE
|
|
|
|
%doc README.md
|
2023-05-09 02:49:51 +02:00
|
|
|
%{_bindir}/%{name}
|
2022-02-02 19:59:59 +01:00
|
|
|
%{_unitdir}/%{name}.service
|
2023-01-19 16:27:12 +01:00
|
|
|
%{_fillupdir}/sysconfig.%{name}
|
2022-02-02 19:59:59 +01:00
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%dir %attr(-, root, velociraptor) %{_sysconfdir}/velociraptor
|
|
|
|
|
|
|
|
%config(noreplace) %{config_perms} %{_sysconfdir}/velociraptor/*.config
|
|
|
|
%dir %{state_dir_perms} %{_sharedstatedir}/%{name}
|
|
|
|
%dir %{state_dir_perms} %{_sharedstatedir}/%{name}/data
|
|
|
|
%dir %{state_dir_perms} %{_sharedstatedir}/%{name}/logs
|
|
|
|
%dir %{state_dir_perms} %{_sharedstatedir}/%{name}/tmp
|
2022-03-15 15:14:34 +01:00
|
|
|
|
2022-02-02 19:59:59 +01:00
|
|
|
%pre
|
2023-05-09 02:49:51 +02:00
|
|
|
%service_add_pre %{name}.service
|
2022-02-02 19:59:59 +01:00
|
|
|
|
|
|
|
%post
|
2023-01-19 16:27:12 +01:00
|
|
|
%{fillup_only}
|
2023-05-09 02:49:51 +02:00
|
|
|
%service_add_post %{name}.service
|
2022-02-02 19:59:59 +01:00
|
|
|
|
|
|
|
%preun
|
2023-05-09 02:49:51 +02:00
|
|
|
%service_del_preun %{name}.service
|
2022-02-02 19:59:59 +01:00
|
|
|
|
|
|
|
%postun
|
2023-05-09 02:49:51 +02:00
|
|
|
%service_del_postun %{name}.service
|
|
|
|
|
2023-05-09 04:00:49 +02:00
|
|
|
%if %{build_server}
|
|
|
|
%pre -n system-user-velociraptor -f velociraptor-user.pre
|
|
|
|
|
|
|
|
%files -n system-user-velociraptor
|
|
|
|
%defattr(-, root, root)
|
|
|
|
%{_sysusersdir}/system-user-velociraptor.conf
|
|
|
|
%endif
|
|
|
|
|
2023-05-09 02:49:51 +02:00
|
|
|
%if %{build_kafka_humio_gateway}
|
|
|
|
%files kafka-humio-gateway
|
|
|
|
%defattr(-, root, root)
|
|
|
|
%license LICENSE
|
|
|
|
%doc contrib/kafka-humio-gateway/README.md
|
|
|
|
%{_bindir}/velociraptor-kafka-humio-gateway
|
|
|
|
%dir %{_datadir}/velociraptor-kafka-humio-gateway
|
|
|
|
%{_datadir}/velociraptor-kafka-humio-gateway/sample-config.yml
|
|
|
|
%{_sysusersdir}/velociraptor-kafka.conf
|
|
|
|
%{_unitdir}/velociraptor-kafka-humio-gateway.service
|
|
|
|
%{_fillupdir}/sysconfig.velociraptor-kafka-humio-gateway
|
|
|
|
%dir %attr(750, root, velociraptor-kafka) %{_sysconfdir}/velociraptor-kafka-humio-gateway
|
|
|
|
%config(noreplace) %attr(0640, root, velociraptor-kafka) %{_sysconfdir}/velociraptor-kafka-humio-gateway/transport.yml
|
|
|
|
|
2023-05-09 04:00:49 +02:00
|
|
|
%pre kafka-humio-gateway -f kafka-user.pre
|
2023-05-09 02:49:51 +02:00
|
|
|
%service_add_pre velociraptor-kafka-humio-gateway.service
|
|
|
|
|
|
|
|
%post kafka-humio-gateway
|
|
|
|
%{fillup_only -s kafka-humio-gateway}
|
|
|
|
%service_add_post velociraptor-kafka-humio-gateway.service
|
|
|
|
|
|
|
|
%preun kafka-humio-gateway
|
|
|
|
%service_del_preun velociraptor-kafka-humio-gateway.service
|
|
|
|
|
|
|
|
%postun kafka-humio-gateway
|
|
|
|
%service_del_postun velociraptor-kafka-humio-gateway.service
|
|
|
|
|
|
|
|
%endif
|
2022-01-21 18:45:44 +01:00
|
|
|
|
|
|
|
%changelog
|