On to, 14 huhti 2022, Matthew Miller wrote:
On Thu, Apr 14, 2022 at 07:29:48AM +0300, Alexander Bokovoy wrote:
> I understand what you have proposed. I have pointed that it is not
> possible because not everything can be overridden from such config and,
> sadly, those bits are what common to all configurations. Content in
> /var/lib/samba is what matters, not where config file is located.
I think in the overwhelming number of cases I care about, samba will not
have any previous configuration. I would be perfectly fine with the plugin
recognizing anything other than:
1) whatever is the default out of the box
2) its own configuration
... and then displaying something like "This system has already been configured for
advanced file
sharing. It can't be managed via this interface. If this isn't what you
want, remove all existing configuration and return here."
There are no sane ways of detecting whether configuration is default or not.
Sure, you can detect whether registry backend is enabled. You can also
detect a role Samba runs in and refuse operating on unsupported roles. I
think that's at most what could be done.
There is not even a way to find out whether your current config backend
is registry. In FreeIPA case we use the following smb.conf:
# cat /etc/samba/smb.conf
### Added by IPA Installer ###
# DO NOT EDIT #
[global]
debug pid = yes
state directory = /var/lib/samba
cache directory = /var/lib/samba
include = registry
and if you would compare output of the `testparm -s -v` between this and
a normal Samba setup, you'd see only difference in the role but not the
config backend:
# testparm -s -v 2>&1 |egrep '(Server role|config backend)'
Server role: ROLE_IPA_DC
config backend = file
# testparm -s -v 2>&1 |egrep '(Server role|config backend)'
Server role: ROLE_STANDALONE
config backend = file
testparm simply does not see 'include = registry' individually as Samba
parser consumes that:
# testparm -s -v 2>&1 |egrep '(Server role|include)'
Server role: ROLE_IPA_DC
include system krb5 conf = Yes
include =
So in order to distinguish the cases we would need to apply some other
logic.
I am fine if Cockpit app would limit itself to the cases it considers
supportable. However, at the moment I don't see a good way to detect
what is supportable purely from the configuration file using Samba
tools.
--
/ Alexander Bokovoy