From nobody Wed Apr 24 05:55:02 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VPSr62qxQz5Js75; Wed, 24 Apr 2024 05:55:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VPSr62LBmz4bTn; Wed, 24 Apr 2024 05:55:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713938102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6phvVLuvFmcENJ3P8V1+T5OMFa6d9HnhnsxepZAwtJI=; b=l/ksok6y4NzjnH6OwPejUY17rOmf/XUBeASqtnHYcqUpIIRz3SkyLk/ihOU+RZd5MGd1Nr okvLNTzGzSrEGj7GJ1lT0uSvE5Ds9EMyihQqraSK+uQ26w0d/IkB0JDlw3I9lepVzu+6vX cXPKB4KGimzn+9UDo3wyZYEN8CwBoKZRKVXN9N6dH243Gx/GzZw5KDNuCW3dkSTiYsy2DB Ag0EC4kCKhvdwNQ8qG8cMQ2Ur0y1hLdnzzWqfYwELBBXvZSGte9KOGKMrP1i1KlECFAt4n Og08+AvnU7IZ304lDg8uSghbPoeXFfqqjtGoC+5fdhoJ7DPQobJ17v0/fzVuug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713938102; a=rsa-sha256; cv=none; b=fNIW355RiavAeyHhc0tknxC/XfIX72phaSw6Db2fXuLqGjcz0KlPrrnMM/2CWD0uf6+nIQ DjzxJxjE7BcWvR+1zZvl5ZDXzw+tIV4ic9wvxhcr9uE9l4JBOI/8N4CUwi4ooQJ6Pak811 fTgeqlQ1IQOQ1peUrI2uOpa5MURHPjliejfjZ8T0/HJm/K4N9qkYJA9zMY/EQ3VQwFQKv8 71Q42h1RWRXQFdVKMAxxv6fbtFswJ2TQ76LGPN2ZqoDzSO7gC+oM6tnax91ppydCqCsKNY 1VMho5ctCewQdICIUAsVnqR1Bsa/Yuw60Bssd39hUkhgUNC27l9AG4z7fyoJ1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713938102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6phvVLuvFmcENJ3P8V1+T5OMFa6d9HnhnsxepZAwtJI=; b=dawadovZZxRRGboNjfbnDqvvqaARLAZegYEQLKq/EGBpwCqt2w6NsjKOr2P3FB3d59uCAU mZSGGij1RODrFn2MKBJo8nRNTlBoXJdL/VMvo9xnNoO+6XHX6aHACyIkuq6FPLXIEjIP8e xs4unMx3wMm6P0jkM+siWibUB9SgGqc6hksCaCkYfyalQAB1vQzoZ9Fj63insWTjbiVfHh AbSVOKAS51BqKbvBtl27+sxi01wUHEc20jC4mpQqXKtgIkEpQZsJFLuktddsiFWMQ93GD1 cxD90PmZ3nRnQtfTy9H/JlkqBMoL8q6umQh1e8xdMM9cUkGkF58W46PVVL/SJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VPSr61sKtz13Fd; Wed, 24 Apr 2024 05:55:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43O5t2L8008644; Wed, 24 Apr 2024 05:55:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43O5t2BC008641; Wed, 24 Apr 2024 05:55:02 GMT (envelope-from git) Date: Wed, 24 Apr 2024 05:55:02 GMT Message-Id: <202404240555.43O5t2BC008641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 9e248b7f645c - main - kdc: Add restart option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e248b7f645cdf05615a49cc15295df49b54d659 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9e248b7f645cdf05615a49cc15295df49b54d659 commit 9e248b7f645cdf05615a49cc15295df49b54d659 Author: Cy Schubert AuthorDate: 2024-04-18 18:56:54 +0000 Commit: Cy Schubert CommitDate: 2024-04-24 05:50:38 +0000 kdc: Add restart option Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under daemon(8). This automatically restarts the kdc should it fail, i.e. when it's configured to use LDAP as a backend and cannot connect to its LDAP directory. Set kdc_restart="YES" to auto restart kdc on abnormal termination. Set kdc_restart_delay="N" to the number of seconds to delay before restarting the kdc. The daemon(8) default seconds applies when not set. Reported by: Lexi Winter PR: 278395 Differential Revision: https://reviews.freebsd.org/D44898 --- libexec/rc/rc.conf | 2 ++ libexec/rc/rc.d/kdc | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 6a8b6e257b17..c91f13bd9812 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -330,6 +330,8 @@ resolv_enable="YES" # Enable resolv / resolvconf kdc_enable="NO" # Run a kerberos 5 KDC (or NO). kdc_program="/usr/libexec/kdc" # path to kerberos 5 KDC kdc_flags="" # Additional flags to the kerberos 5 KDC +kdc_restart="NO" # Auto restart kdc on abnormal termination +kdc_restart_delay="" # Auto restart delay seconds kadmind_enable="NO" # Run kadmind (or NO) kadmind_program="/usr/libexec/kadmind" # path to kadmind kpasswdd_enable="NO" # Run kpasswdd (or NO) diff --git a/libexec/rc/rc.d/kdc b/libexec/rc/rc.d/kdc index c3059f261e09..a2d9f87f8e20 100755 --- a/libexec/rc/rc.d/kdc +++ b/libexec/rc/rc.d/kdc @@ -12,15 +12,40 @@ name=kdc desc="Kerberos 5 server" rcvar=${name}_enable +: ${kdc_restart:="NO"} +: ${kdc_restart_delay:=""} set_rcvar_obsolete kerberos5_server_enable kdc_enable set_rcvar_obsolete kerberos5_server kdc_program set_rcvar_obsolete kerberos5_server_flags kdc_flags - load_rc_config $name if [ "${kdc_program}" = /usr/libexec/kdc -o \ "${kdc_program}" = /usr/local/libexec/kdc ]; then - command_args="$command_args --detach" + detach="--detach" + flavor=heimdal +else + flavor=mit + unset detach fi + +case ${kdc_restart} in +[Yy][Ee][Ss]) + if [ "$flavor" = mit ]; then + detach=-n + else + unset detach + fi + case ${kdc_restart_delay} in + "") unset daemon_restart_delay;; + *) daemon_restart_delay="-R ${kdc_restart_delay}";; + esac + command_args="-r ${daemon_restart_delay} ${kdc_program} ${detach} ${command_args}" + kdc_program=/usr/sbin/daemon + ;; +*) + command_args="${detach} ${command_args}" + ;; +esac + run_rc_command "$1"