Skip to content

Commit 6ad6f90

Browse files
committed
sources: add whippet
whippet is a dbus-broker launcher that implements the minimal set of featured required by Bottlerocket to get a functional Bus, which includes: - D-Bus Policy parsing - Systemd socket activation Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
1 parent 6f7213a commit 6ad6f90

21 files changed

+2686
-39
lines changed

packages/os/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ source-groups = [
2626
"bloodhound",
2727
"xfscli",
2828
"brush",
29+
"whippet",
2930
]
3031

3132
[lib]

packages/os/dbus-1-system.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[user.root]
2+
rules = [
3+
# Allow activator interface
4+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.systemd1.Activator", allow = true },
5+
# Allow monitoring
6+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus.Monitoring", allow = true },
7+
# Allow stats interface
8+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus.Debug.Stats", allow = true }
9+
]
10+
11+
[default]
12+
rules = [
13+
# Allow all users to connect
14+
{ user = "*", allow = true },
15+
# Deny owning names
16+
{ own = "*", allow = false },
17+
{ send_type = "method-call", allow = false },
18+
# Allow signals
19+
{ send_type = "signal", allow = true },
20+
# Allow replies
21+
# This is a useless rule, it is dropped from the rules at runtime
22+
# { send_type = "method_return", send_requested_reply = true, allow = true },
23+
# This is a uselss rule, it is dropped from the rules at runtime
24+
# { send_type = "error", send_requested_reply = true, allow = true },
25+
# Allow all receives
26+
{ receive_type = "method-call", allow = true },
27+
# This is a userless rule, it is dropped from the rules at runtime
28+
# { receive_type = "method-return", allow = true },
29+
# This is a userless rule, it is dropped from the rules at runtime
30+
# { receive_type = "error", allow = true },
31+
{ receive_type = "signal", allow = true },
32+
# Allow DBus interface access
33+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus", allow = true },
34+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus.Introspectable", allow = true },
35+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus.Properties", allow = true },
36+
# Deny specific bus services
37+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus", send_member = "UpdateActivationEnvironment", allow = false },
38+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.DBus.Debug.Stats", allow = false },
39+
{ send_destination = "org.freedesktop.DBus", send_interface = "org.freedesktop.systemd1.Activator", allow = false }
40+
]

packages/os/os.spec

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Source18: bootstrap-containers-toml
3333
Source19: host-containers-toml
3434
Source20: bottlerocket-fips-checks-metadata-json
3535
Source21: bootstrap-commands-toml
36+
Source22: dbus-1-system.toml
37+
Source23: whippet.conf
3638

3739
# 1xx sources: systemd units
3840
Source100: apiserver.service
@@ -423,6 +425,13 @@ Conflicts: %{_cross_os}bash
423425
%description -n %{_cross_os}brush
424426
%{summary}.
425427

428+
%package -n %{_cross_os}whippet
429+
Summary: A simple dbus-broker launcher
430+
Provides: %{_cross_os}dbus-broker(launcher) = 0
431+
Conflicts: %{_cross_os}dbus-broker(launcher)
432+
%description -n %{_cross_os}whippet
433+
%{summary}.
434+
426435
%prep
427436
%setup -T -c
428437
%cargo_prep
@@ -543,6 +552,7 @@ echo "** Output from non-static builds:"
543552
-p shibaken \
544553
-p driverdog \
545554
-p brush \
555+
-p whippet \
546556
%{nil}
547557

548558
# Wait for fips builds from the background, if they're not already done.
@@ -604,7 +614,7 @@ for p in \
604614
bottlerocket-cis-checks \
605615
bottlerocket-fips-checks \
606616
kubernetes-cis-checks \
607-
shibaken driverdog brush \
617+
shibaken driverdog brush whippet \
608618
; do
609619
install -p -m 0755 %{__cargo_outdir}/${p} %{buildroot}%{_cross_bindir}
610620
done
@@ -731,6 +741,11 @@ install -p -m 0644 %{S:300} %{buildroot}%{_cross_udevrulesdir}/80-ephemeral-stor
731741
install -p -m 0644 %{S:301} %{buildroot}%{_cross_udevrulesdir}/81-ebs-volumes.rules
732742
install -p -m 0644 %{S:302} %{buildroot}%{_cross_udevrulesdir}/82-supplemental-storage.rules
733743

744+
install -d %{buildroot}%{_cross_datadir}/whippet/
745+
install -p -m 0644 %{S:22} %{buildroot}%{_cross_datadir}/whippet/system.toml
746+
install -d %{buildroot}%{_cross_unitdir}/dbus-broker.service.d/
747+
install -p -m 0644 %{S:23} %{buildroot}%{_cross_unitdir}/dbus-broker.service.d/
748+
734749
%cross_scan_attribution --clarify %{_builddir}/sources/clarify.toml \
735750
cargo --offline --locked %{_builddir}/sources/Cargo.toml
736751

@@ -932,4 +947,9 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
932947
%{_cross_bindir}/sh
933948
%dir %{_cross_libexecdir}/brush/allowed-programs
934949

950+
%files -n %{_cross_os}whippet
951+
%{_cross_bindir}/whippet
952+
%{_cross_datadir}/whippet/system.toml
953+
%{_cross_unitdir}/dbus-broker.service.d/whippet.conf
954+
935955
%changelog

packages/os/whippet.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[Service]
2+
User=dbus
3+
ExecStart=
4+
ExecStart=/usr/bin/whippet

0 commit comments

Comments
 (0)