git: b296e60ed35e - stable/13 - freebsd-update: restart sshd after upgrade

From: Eugene Grosbein <eugen_at_FreeBSD.org>
Date: Sat, 10 Dec 2022 05:01:04 UTC
The branch stable/13 has been updated by eugen:

URL: https://cgit.FreeBSD.org/src/commit/?id=b296e60ed35ef9936dbe673e4966da439841b320

commit b296e60ed35ef9936dbe673e4966da439841b320
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-05-02 17:16:19 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2022-12-10 04:56:24 +0000

    freebsd-update: restart sshd after upgrade
    
    Sometimes the parent-child sshd protocol changes during an upgrade, and
    when this happens sshd will not accept new connections until it is
    restarted.
    
    PR:             263489
    Reviewed by:    kevans, gjb
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35109
    
    (cherry picked from commit 6cd1bc53160973fc421c59f66aaa7e4b37a8cebe)
---
 usr.sbin/freebsd-update/freebsd-update.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index 9743cd652d16..078043326115 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -3023,6 +3023,14 @@ Kernel updates have been installed.  Please reboot and run
 		install_from_index INDEX-NEW || return 1
 		install_delete INDEX-OLD INDEX-NEW || return 1
 
+		# Restart sshd if running (PR263489).  Note that this does not
+		# affect child sshd processes handling existing sessions.
+		if service sshd status >/dev/null 2>/dev/null; then
+			echo
+			echo "Restarting sshd after upgrade"
+			service sshd restart
+		fi
+
 		# Rehash certs if we actually have certctl installed.
 		if which certctl>/dev/null; then
 			env DESTDIR=${BASEDIR} certctl rehash