Bug 16267 - Clustered keytab generation needs improvement
Summary: Clustered keytab generation needs improvement
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.25.0rc*
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Martin Schwenke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-09-30 08:19 UTC by Martin Schwenke
Modified: 2026-10-07 03:40 UTC (History)
2 users (show)

See Also:


Attachments
Patch for v4-25-test (65.87 KB, patch)
2026-10-07 03:12 UTC, Martin Schwenke
martins: review? (pfilipensky)
Details
Patch for v4-24-test (75.26 KB, patch)
2026-10-07 03:40 UTC, Martin Schwenke
martins: review? (pfilipensky)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schwenke 2026-09-30 08:19:02 UTC
Not sure if the component should be "Clustering", "Winbind" or "CTDB".  Outside of test code, most of the required changes will be in CTDB, so let's go with that...  :-)

The main issues are:

* The 46.update-keytabs event script passes a fixed config file option
  to "net ads keytab create".  This means it will not work out of the box.

* The winbind_ctdb_updatekeytab.sh script uses onnode to run a keytab
  update on each connected node.  However, this won't work on inactive nodes.
  So, onnode needs an "active" target that can be used here.

Secondary issues:

* It turns out that status-based targets does not work in onnode when running
  under CTDB's local_daemons.sh script, as is used in the clusteredmember
  testenv.  I guess that this is saved by CTDB_SOCKET being set in that
  environment, which isn't really sufficient for use in other environments.

* cmdline_messaging_context() is restricted to root when clustering is enabled.
  It requires an except for self-test when using uid_wrapper().

Everything here could be fixed under separate bugs but let's be flexible...  :-)
Comment 1 Martin Schwenke 2026-09-30 08:20:34 UTC
I'm nearly done with fixes.  Need to add BUG tags and do final self-review...
Comment 3 Samba QA Contact 2026-10-06 23:38:04 UTC
This bug was referenced in samba master:

646de26e4b5a8ff9db45a2323b28a1b8359427f2
642a5a0b3d73559e9dd6b50e50fae7f242d1c0a3
ffaadbf6b334b53adb196cca62c24c46c08b88c3
621e5910f741eddeb7cfdb0332b32d8b944cf399
668af45ef1b20c410bcca7946c3ba7e0ed7061ff
efd0d0762ce40069bc2981f56364069dea4c93af
4c34fcda2294c9e1168302e10216b1b3fc84f9f3
0e0bca5e7ab3737f5909b13b279b336a62792f4d
9e8c66f5eef72f343205961f1cb8813bb3f5ec2b
8b516ee9ecc97c4df091605e2a9cca330ea65c32
9493d9643c832ee27804967f8cbd584545b0125e
539bd26505f9368d9f0e1095c2a61b520a2b2a32
ddb5e8cff649fcdb2e543179da3618ad21b809a8
aa2281252d7a24dc8ec07f0b8944f1b3f3ab783f
b38033757a0b882a153b7955c9f4d714474a679d
45a4089f5649af02d51ebacdec49021a06273d3b
Comment 4 Martin Schwenke 2026-10-07 03:12:54 UTC
Created attachment 19273 [details]
Patch for v4-25-test

With the addition of Pavel's commit 5d02b93cd40c469e142597a57d8788cfff5825e8:

  tests: Fix test_update_keytab_clustered.sh

these commit cherry-pick cleanly from the master branch into v4-25-test.

Builds successfully and the following tests pass as a smoketest:

$ make test TESTS="samba3.blackbox.update_keytab_clustered"
$ ./ctdb/tests/run_tests.sh ./ctdb/tests/UNIT/{onnode,shellcheck}
Comment 5 Martin Schwenke 2026-10-07 03:40:59 UTC
Created attachment 19274 [details]
Patch for v4-24-test

With the addition of:

* commit f5e5ad0125226c73755df783ab719cc16a3036e4
  Author: Andreas Schneider <asn@samba.org>
  Date:   Tue Nov 12 08:53:50 2024 +0100

    s3:tests: Fix argument checks in test shell scripts

* commit 5d02b93cd40c469e142597a57d8788cfff5825e8
  Author: Pavel Filipenský <pfilipensky@samba.org>
  Date:   Thu Aug 27 09:28:46 2026 +0200

    tests: Fix test_update_keytab_clustered.sh

these commit cherry-pick cleanly (apart from 1 commit, noted below) from the master branch into v4-24-test.

As I forgot to mention in my comment for the v4-25-test patch, I prefer to include previous useful fixes instead of backporting around them.  ;-)

For commit f5e5ad0125226c73755df783ab719cc16a3036e4 (above), I originally decided to do a backport including only the part of the commit that would fix a conflict.  However, then I decided to confirm that for all the files affected by this commit, the only changes in the diff between v4-24-test and v4-25-test are changes made by this commit, via:

$ git diff origin/v4-24-test origin/v4-25-test $(git show --stat f5e5ad0125226c73755df783ab719cc16a3036e4 | awk ' $2 == "|" {print $1}')

Therefore, there should be no incompatible changes.

The only commit requiring a "backport" was:

commit 642a5a0b3d73559e9dd6b50e50fae7f242d1c0a3
Author: Martin Schwenke <mschwenke@ddn.com>
Date:   Thu Oct 1 14:05:25 2026 +1000

    ctdb-tests: Fix some shellcheck complaints

File ctdb/tests/UNIT/shellcheck/tests.sh has been updated to test more files since v4-24-test branched.  I decided not to pull on that particular piece of string.  ;-)

Builds successfully and the following tests pass as a smoketest:

$ make test TESTS="samba3.blackbox.update_keytab_clustered"
$ ./ctdb/tests/run_tests.sh ./ctdb/tests/UNIT/{onnode,shellcheck}