Skip to content

Commit

Permalink
Harden DNF config
Browse files Browse the repository at this point in the history
This uses a postinstall script for DNF5 and a configuration file
otherwise.
  • Loading branch information
DemiMarie committed Nov 12, 2024
1 parent a324b82 commit cf52c15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package-managers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ endif
install-dnf5: install-rpm
install -D -m 0644 qubes-post-update.actions \
$(DESTDIR)$(SYSCONFDIR)/dnf/libdnf5-plugins/actions.d/qubes-post-update.actions
install -D -m 0644 dnf-harden.conf \
$(DESTDIR)$(SYSCONFDIR)/dnf/libdnf5.conf.d/10-qubes.conf

install-yum: install-rpm
install -d $(DESTDIR)$(LIBDIR)/yum-plugins
Expand Down
3 changes: 3 additions & 0 deletions package-managers/dnf-harden.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[main]
deltarpm=0
zchunk=0
8 changes: 8 additions & 0 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,13 @@ if [ -L /usr/local ]; then
mount /usr/local || :
fi

%if 0%{?fedora} < 41
if [ ! -f /etc/qubes-dnf-hardened ]; then
dnf config-manager --setopt=zchunk=0 --setopt=deltarpm=0 --save &&
touch /etc/qubes-dnf-hardened
fi
%endif

# workaround for Fedora's systemd package bug
# https://bugzilla.redhat.com/1559286
if [ -d /var/lib/private ]; then
Expand Down Expand Up @@ -963,6 +970,7 @@ rm -f %{name}-%{version}
%config(noreplace) /etc/yum.repos.d/qubes-r4.repo
%if 0%{?fedora} >= 41
/etc/dnf/libdnf5-plugins/actions.d/qubes-post-update.actions
/etc/dnf/libdnf5.conf.d/10-qubes.conf
%else
%if 0%{?rhel} == 7
/etc/yum/pluginconf.d/yum-qubes-hooks.conf
Expand Down

0 comments on commit cf52c15

Please sign in to comment.