Handle better upgrade of sshd_config

Fixes: rhbz#1887928
This commit is contained in:
Alexander Bokovoy 2020-10-13 18:54:07 +03:00
parent 45879303cf
commit deafacd653

View File

@ -161,7 +161,7 @@
Name: %{package_name}
Version: %{IPA_VERSION}
Release: 5%{?dist}
Release: 6%{?dist}
Summary: The Identity, Policy and Audit system
License: GPLv3+
@ -1159,6 +1159,18 @@ if [ -f '/etc/ssh/sshd_config' -a $restore -ge 2 ]; then
/bin/systemctl condrestart sshd.service 2>&1 || :
fi
# If the snippet has been created, ensure that it is included
# either by /etc/ssh/sshd_config.d/*.conf or directly
if [ -f '/etc/ssh/sshd_config.d/04-ipa.conf' ]; then
if ! grep -E -q '^\s*Include\s*/etc/ssh/sshd_config.d/\*\.conf' /etc/ssh/sshd_config 2> /dev/null ; then
if ! grep -E -q '^\s*Include\s*/etc/ssh/sshd_config.d/04-ipa\.conf' /etc/ssh/sshd_config 2> /dev/null ; then
# Include the snippet
echo "Include /etc/ssh/sshd_config.d/04-ipa.conf" > /etc/ssh/sshd_config.ipanew
cat /etc/ssh/sshd_config >> /etc/ssh/sshd_config.ipanew
mv -fZ --backup=existing --suffix .ipaold /etc/ssh/sshd_config.ipanew /etc/ssh/sshd_config
fi
fi
fi
fi
@ -1530,6 +1542,10 @@ fi
%endif
%changelog
* Tue Oct 13 2020 Alexander Bokovoy <abokovoy@redhat.com> - 4.8.10-6
- Handle sshd_config upgrade properly
Fixes: rhbz#1887928
* Tue Sep 29 2020 Alexander Bokovoy <abokovoy@redhat.com> - 4.8.10-5
- Properly handle upgrade case when systemd-resolved is enabled