PREIN
/bin/sh
getent group sshd >/dev/null || groupadd -g 74 -r sshd || :
getent passwd sshd >/dev/null || \
useradd -c "Privilege-separated SSH" -u 74 -g sshd -s /sbin/nologin \
-s /sbin/nologin -r -d /var/empty/sshd sshd 2> /dev/null || :
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable sshd.service > /dev/null 2>&1 || :
/bin/systemctl --no-reload disable sshd-keygen.service > /dev/null 2>&1 || :
/bin/systemctl stop sshd.service > /dev/null 2>&1 || :
/bin/systemctl stop sshd-keygen.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] ; then
/bin/systemctl enable sshd.service >/dev/null 2>&1 || :
/bin/systemctl enable sshd-keygen.service >/dev/null 2>&1 || :
fi
POSTUN
/bin/sh
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart sshd.service >/dev/null 2>&1 || :
/bin/systemctl try-restart sshd-keygen.service >/dev/null 2>&1 || :
fi
Triggers
openssh-server <
5.8p2-12
/bin/sh
/usr/bin/systemd-sysv-convert --save sshd >/dev/null 2>&1 || :
/bin/systemctl enable sshd.service >/dev/null 2>&1
/bin/systemctl enable sshd-keygen.service >/dev/null 2>&1
/sbin/chkconfig --del sshd >/dev/null 2>&1 || :
/bin/systemctl try-restart sshd.service >/dev/null 2>&1 || :
# This one was never a service, so we don't simply restart it
/bin/systemctl is-active -q sshd.service && /bin/systemctl start sshd-keygen.service >/dev/null 2>&1 || :