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 4, 2024
1 parent a324b82 commit 19f62c4
Show file tree
Hide file tree
Showing 3 changed files with 11 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
4 changes: 4 additions & 0 deletions package-managers/dnf-harden.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[main]
deltarpm=0
zchunk=0
gpgcheck=1
5 changes: 5 additions & 0 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ if [ -L /usr/local ]; then
mount /usr/local || :
fi

%if 0%{?fedora} < 41
dnf config-manager --setopt=gpgcheck=1 --setopt=zchunk=0 --setopt=deltarpm=0 --save
%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 +967,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 19f62c4

Please sign in to comment.