Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to automatically update/configure Samba workgroup during AD service activation #2671

Closed
FroggyFlox opened this issue Sep 11, 2023 · 2 comments · Fixed by #2672
Closed
Assignees
Labels

Comments

@FroggyFlox
Copy link
Member

In #2273, we added the automatic configuration of the Samba service workgroup during the activation of the Active Directory (AD) service (these need to match).

I'm not sure why/how but this procedure now fails (tested on Leap 15.5, testing branch only) with:

[11/Sep/2023 12:35:03] ERROR [storageadmin.util:45] Exception: Error running a command. cmd = /usr/bin/net ads workgroup -S samdom.example.com. rc = 255. stdout = ['']. stderr = ["Didn't find the cldap server!", '']
Traceback (most recent call last):
  File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 41, in _handle_exception
    yield
  File "/opt/rockstor/src/rockstor/smart_manager/views/active_directory.py", line 163, in post
    config["workgroup"] = domain_workgroup(domain, method=method)
  File "/opt/rockstor/src/rockstor/system/directory_services.py", line 309, in domain_workgroup
    o, e, rc = run_command(cmd)
  File "/opt/rockstor/src/rockstor/system/osi.py", line 251, in run_command
    raise CommandException(cmd, out, err, rc)
system.exceptions.CommandException: Error running a command. cmd = /usr/bin/net ads workgroup -S samdom.example.com. rc = 255. stdout = ['']. stderr = ["Didn't find the cldap server!", '']

This happens when smb.conf does not contain any information pertaining to the AD server/realm. We can thus bypass that by explicitly telling net the realm:

buildvm155:/opt/rockstor # net ads workgroup --realm=SAMDOM.EXAMPLE.COM
Workgroup: SAMDOM

It seems we should thus switch from using the -S flag to the --realm=<REALM> flag.

@FroggyFlox FroggyFlox self-assigned this Sep 11, 2023
@FroggyFlox FroggyFlox added the bug label Sep 11, 2023
@FroggyFlox
Copy link
Member Author

For the record: https://manpages.opensuse.org/Tumbleweed/samba-client/net.8.en.html

Current (problematic) option used:

-S|--server server
Name of target server. You should specify either this option or a target workgroup or a target IP address.

Proposed fix:

-r|--realm=REALM
Set the realm for the domain.

Note that specifying this parameter here will override the realm parameter in the /etc/samba/smb.conf file.

FroggyFlox added a commit to FroggyFlox/rockstor-core that referenced this issue Sep 12, 2023
During Active Directory activation, we query the Workgroup information
from the AD server using `net ads workgroup`. This normally gets its
parameters from `smb.conf` but we need here to explicitly give the
required server information at the command call given we usually work
with an empty `smb.conf` file at this stage.

This commit switches from using the `-S|--server` flag to the `--realm`
flag as that has proven more robust.
@FroggyFlox FroggyFlox linked a pull request Sep 12, 2023 that will close this issue
phillxnet added a commit that referenced this issue Sep 15, 2023
…y-update-configure-Samba-workgroup-during-AD-service-activation

Explicitly set REALM when querying workgroup #2671
@phillxnet
Copy link
Member

Closing as:
Fixed by #2672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants