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

Change DOMAIN_DC to DOMAIN_DN and make it optional #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SphtKr
Copy link

@SphtKr SphtKr commented Jan 17, 2024

The DOMAIN_DC env variable was provided in all examples but not documented in the "quick start" instructions, yet it was necessary for setup to run. This change computes the value from DOMAIN if it is not explicitly specified, and adds documentation for it. It also changes the name to DOMAIN_DN as I think this is a more accurate name than DOMAIN_DC, which is ambiguous (it's not necessarily the "root DN", which might technically be "", nor the "search base DN", which is often "OU=Users,DC=corp,...", but it is a DN and it's for the domain...there might be a better name). If DOMAIN_DN is not specified but DOMAIN_DC is, then the value of DOMAIN_DC will be used, for backwards-compatibility with existing documentation/examples/deployments.

I've added documentation for it, but notably I'm not sure what the impact is if something is specified for the DN-style domain that doesn't match the DNS-style domain (e.g. DOMAIN=CORP.EXAMPLE.COM + DOMAIN_DN=DC=DOMAIN,DC=EXAMPLE,DC=COM ... Samba may assume somewhere that these two match (or may not). In any case, the existing code allowed a mismatch, so this new code does not prevent it.

The `DOMAIN_DC` env variable was provided in all examples but not documented in the "quick start" instructions, yet it was necessary for setup to run. This change computes the value from `DOMAIN` if it is not explicitly specified, and adds documentation for it. It also changes the name to `DOMAIN_DN` as I think this is a more accurate name than `DOMAIN_DC`, which is ambiguous (it's not necessarily the "root DN", which might technically be "", nor the "search base DN", which is often "OU=Users,DC=corp,...", but it is a DN and it's for the domain...there might be a better name). If `DOMAIN_DN` is not specified but `DOMAIN_DC` _is_, then the value of `DOMAIN_DC` will be used, for backwards-compatability with existing documentation/examples/deployments.

I've added documentation for it, but notably I'm not sure what the impact is if something is specified for the DN-style domain that doesn't match the DNS-style domain (e.g. `DOMAIN=CORP.EXAMPLE.COM` + `DOMAIN_DN=DC=DOMAIN,DC=EXAMPLE,DC=COM` ... Samba may assume somewhere that these two match (or may not). In any case, the existing code allowed a mismatch, so this new code does not prevent it.
@Fmstrat
Copy link
Owner

Fmstrat commented Jan 17, 2024

The main problem I see here is users upgrading. Any change like this would need to be backwards compatible with existing installations, I.E convert the old variable. Thanks!

@SphtKr
Copy link
Author

SphtKr commented Jan 18, 2024

Thanks--I was attempting to do just that here:

DOMAIN_DN=${DOMAIN_DN:-${DOMAIN_DC:-DC=$(echo $DOMAIN | sed -e 's/\./,DC=/g')}}

...by including the (old) DOMAIN_DC variable in as a default before defaulting to transforming the DNS-style name. The old DOMAIN_DC variable effectively becomes an undocumented feature. Did you have something more robust in mind?

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

Successfully merging this pull request may close these issues.

2 participants