aboutgitcodebugslistschat
path: root/contrib/fedora/passt.spec
blob: aa312edf35dd64f45832f2a10616c3a649f97c78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# PASST - Plug A Simple Socket Transport
#  for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
#  for network namespace/tap device mode
#
# contrib/fedora/passt.spec - Example spec file for fedora
#
# Copyright (c) 2022 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>

Name:		passt
Version:	0+git-8fd20ad99d24
Release:	0
Summary:	User-mode networking daemons for virtual machines and namespaces
License:	AGPLv3+ and BSD
URL:		https://passt.top/
Source:		https://passt.top/passt/snapshot/passt-8fd20ad99d24a517fa1771e1863f51a32d2fe8a4.tar.xz

BuildRequires:	gcc, make, checkpolicy, selinux-policy-devel

%description
passt implements a translation layer between a Layer-2 network interface and
native Layer-4 sockets (TCP, UDP, ICMP/ICMPv6 echo) on a host. It doesn't
require any capabilities or privileges, and it can be used as a simple
replacement for Slirp.

pasta (same binary as passt, different command) offers equivalent functionality,
for network namespaces: traffic is forwarded using a tap interface inside the
namespace, without the need to create further interfaces on the host, hence not
requiring any capabilities or privileges.

%package    selinux
Summary:    SELinux support for passt and pasta
Requires:   %{name} = %{version}
Requires(post): policycoreutils, %{name}
Requires(preun): policycoreutils, %{name}

%description selinux
This package adds SELinux enforcement to passt(1) and pasta(1).

%prep
%setup -q

%build
export CFLAGS="%{optflags}"
%make_build

%install
%make_install DESTDIR=%{buildroot} prefix=%{_prefix}
%ifarch x86_64
ln -sr %{buildroot}%{_mandir}/man1/passt.1 %{buildroot}%{_mandir}/man1/passt.avx2.1
ln -sr %{buildroot}%{_mandir}/man1/pasta.1 %{buildroot}%{_mandir}/man1/pasta.avx2.1
%endif

pushd contrib/selinux
make -f %{_datadir}/selinux/devel/Makefile
install -p -m 644 -D passt.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/passt.pp
install -p -m 644 -D pasta.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/pasta.pp
popd

%post selinux
semodule -i %{_datadir}/selinux/packages/%{name}/passt.pp 2>/dev/null || :
semodule -i %{_datadir}/selinux/packages/%{name}/pasta.pp 2>/dev/null || :

%preun selinux
semodule -r passt 2>/dev/null || :
semodule -r pasta 2>/dev/null || :

%files
%license LICENSES/{AGPL-3.0-or-later.txt,BSD-3-Clause.txt}
%doc README.md
%{_bindir}/passt
%{_bindir}/pasta
%{_bindir}/qrap
%{_mandir}/man1/passt.1.*
%{_mandir}/man1/pasta.1.*
%{_mandir}/man1/qrap.1.*
%ifarch x86_64
%{_bindir}/passt.avx2
%{_mandir}/man1/passt.avx2.1.*
%{_bindir}/pasta.avx2
%{_mandir}/man1/pasta.avx2.1.*
%endif

%files selinux
%doc README.md
%{_datadir}/selinux/packages/%{name}/passt.pp
%{_datadir}/selinux/packages/%{name}/pasta.pp

%changelog
* Mon Mar 28 2022 Stefano Brivio <sbrivio@redhat.com> 0+git-8fd20ad99d24-0
- Pro forma: example