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

New DiscoverDcType prop #100

Merged
merged 3 commits into from Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.rst
Expand Up @@ -25,6 +25,31 @@ The implementation can work in two modes:
* read-only: if users and groups are read from a remote source, the system will
be able to consume them only using passwd database

Configuration DB format
-----------------------

::

sssd=service
AdDns=192.168.1.12
BindDN=ldapservice@AD.EXAMPLE.COM
BindPassword=cjnsdkuyf8934tjhvsdkljcvsdv
LdapURI=
Provider=ad
Realm=AD.EXAMPLE.COM
Workgroup=EXAMPLE
DiscoverDcType=dns
status=enabled


* ``AdDns``: IP address of the Active Directory DNS server

* ``LdapURI``: LDAP server URI (use ``ldap://`` or ``ldaps://`` scheme)

* ``DiscoverDcType {dns,ldapuri}``: ``dns`` query SRV records in AD DNS to find
the DC name; ``ldapuri`` retrieve the DC name from the ``LdapURI`` prop value


Realm and workgroup
-------------------

Expand Down
6 changes: 5 additions & 1 deletion lib/perl/NethServer/LdapClient.pm
Expand Up @@ -86,7 +86,11 @@ sub connect
my @ldap_hosts;
if($sssd->isAD()) {
my $ad_domain = lc($sssd->{'Realm'}) || $sssd->{'Domain'};
@ldap_hosts = _get_ldap_hosts($ad_domain, %ldap_params);
if($sssd->{'DiscoverDcType'} eq 'ldapuri') {
@ldap_hosts = $sssd->host();
} else {
@ldap_hosts = _get_ldap_hosts($ad_domain, %ldap_params);
}
if( ! @ldap_hosts ) {
warn("Could not resolve domain $ad_domain\n");
exit(1);
Expand Down
3 changes: 2 additions & 1 deletion lib/perl/NethServer/SSSD.pm
Expand Up @@ -363,7 +363,8 @@ sub new
my ($systemName, $domainName) = split(/\./, Sys::Hostname::hostname(), 2);
my %sssdProps = (
'status' => 'disabled',
'Provider' => 'none'
'Provider' => 'none',
'DiscoverDcType' => 'dns',
);
my %nsdcProps = (
'status' => 'disabled'
Expand Down
@@ -0,0 +1 @@
dns
5 changes: 5 additions & 0 deletions root/etc/e-smith/templates/etc/samba/smb.conf/10base
Expand Up @@ -7,6 +7,11 @@ server string = NethServer {$sysconfig{'Version'} . ' ' . $sysconfig{'Release'}}
security = { $sssd{'Provider'} eq 'ad' ? 'ADS' : 'user' }
{ $sssd{'Provider'} eq 'ad' ? '' : '# ' }realm = { $sssd{'Realm'} }
{ $sssd{'Provider'} eq 'ad' ? '' : '# ' }kerberos method = secrets and keytab
{ $sssd{'Provider'} eq 'ad' ? '' : '# ' }password server = {

This comment was marked as resolved.

This comment was marked as resolved.

use NethServer::SSSD;
my $sssd_object = NethServer::SSSD->new();
$OUT = $sssd_object->{'DiscoverDcType'} eq 'ldapuri' ? $sssd_object->host() : '*';
}
netbios name = { uc(substr($SystemName, 0, 15)); }


Expand Up @@ -18,6 +18,9 @@
$provider_config .= "krb5_store_password_if_offline = True\n";
$provider_config .= "ldap_id_mapping = True\n";
$provider_config .= "ad_maximum_machine_account_password_age = 0\n";
if($sssd_object->{'DiscoverDcType'} eq 'ldapuri') {
$provider_config .= "ad_server = " . $sssd_object->host() . "\n";
}
}

'';
Expand Down
1 change: 1 addition & 0 deletions root/usr/sbin/account-provider-test
Expand Up @@ -122,6 +122,7 @@ sub getDefaults

'BindDN' => $o->bindDN(),
'BindPassword' => $o->bindPassword(),
'DiscoverDcType' => $o->{'DiscoverDcType'},
};

return $dump;
Expand Down