This is Annoying... To empty the Samba keytab and rebuild it, refresh original principals with new key material etc, you need to add a 'canary' placeholder spn so that the checks for net ads set spn add/delete allow you to empty and refill/recreate the Samba keytab.... Removing some of the 'hand holding' checks that the key tab contains an SPN of the form 'host/netbiosname' for the net ads setspn add/delete command would be useful for use with Ansible, Chef, Puppet, and other administrative scripts etc. Will create a patch for this when I get the chance.
Created attachment 17463 [details] Ansible code to currently manipulate keytab... Added the current shenanigans I have to do with the Samba key tab in Ansible for winbind setup. Note I have told Samba in smb.conf to always use the system keytab /etc/krb5.keytab.