Drop loading of anaconda configuration from sysconfig including scriptlet to migrate to include drop-in directory

This commit is contained in:
Jakub Jelen 2020-06-08 21:47:34 +02:00
parent fccd87eb18
commit dfeecfb1e8
3 changed files with 13 additions and 4 deletions

View File

@ -612,6 +612,17 @@ getent passwd sshd >/dev/null || \
%post server
%systemd_post sshd.service sshd.socket
# Migration scriptlet for Fedora 31 and 32 installations to sshd_config
# drop-in directory (in F32+).
# Do this only if the file generated by anaconda exists, contains our config
# directive and sshd_config contains include directive as shipped in our package
%global sysconfig_anaconda /etc/sysconfig/sshd-permitrootlogin
test -f %{sysconfig_anaconda} && \
test ! -f /etc/ssh/sshd_config.d/01-permitrootlogin.conf && \
grep -q '^PERMITROOTLOGIN="-oPermitRootLogin=yes"' %{sysconfig_anaconda} && \
grep -q '^Include /etc/ssh/sshd_config.d/\*.conf' /etc/ssh/sshd_config && \
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config.d/25-permitrootlogin.conf && \
rm %{sysconfig_anaconda} || :
%preun server
%systemd_preun sshd.service sshd.socket

View File

@ -6,9 +6,8 @@ Wants=sshd-keygen.target
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/sshd-permitrootlogin
EnvironmentFile=-/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd -D $OPTIONS $PERMITROOTLOGIN
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

View File

@ -5,7 +5,6 @@ Wants=sshd-keygen.target
After=sshd-keygen.target
[Service]
EnvironmentFile=-/etc/sysconfig/sshd-permitrootlogin
EnvironmentFile=-/etc/sysconfig/sshd
ExecStart=-/usr/sbin/sshd -i $OPTIONS $PERMITROOTLOGIN
ExecStart=-/usr/sbin/sshd -i $OPTIONS
StandardInput=socket