From: Stefan Metzmacher Date: Thu, 22 Feb 2018 09:19:58 +0000 (+0100) Subject: winbind: don't try to do an authenticated SMB connection as AD DC X-Git-Tag: ldb-1.3.2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=06601b3a9293db35feda1b033fa864dc1a764164;p=thirdparty%2Fsamba.git winbind: don't try to do an authenticated SMB connection as AD DC BUG: https://bugzilla.samba.org/show_bug.cgi?id=13278 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Fri Feb 23 17:58:23 CET 2018 on sn-devel-144 --- diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 8d8396d1ab2..1e44e9bd3ce 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -999,6 +999,31 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain, enum smb_signing_setting smb_sign_client_connections = lp_client_ipc_signing(); + if (IS_AD_DC) { + if (domain->secure_channel_type == SEC_CHAN_NULL) { + /* + * Make sure we don't even try to + * connect to a foreign domain + * without a direct outbound trust. + */ + return NT_STATUS_NO_TRUST_LSA_SECRET; + } + + /* + * As AD DC we only use netlogon and lsa + * using schannel over an anonymous transport + * (ncacn_ip_tcp or ncacn_np). + * + * Currently we always establish the SMB connection, + * even if we don't use it, because we later use ncacn_ip_tcp. + * + * As we won't use the SMB connection there's no + * need to try kerberos. And NT4 domains expect + * an anonymous IPC$ connection anyway. + */ + smb_sign_client_connections = SMB_SIGNING_OFF; + } + if (smb_sign_client_connections == SMB_SIGNING_DEFAULT) { /* * If we are connecting to our own AD domain, require @@ -1011,8 +1036,7 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain, * AD domain in our forest * then require smb signing to disrupt MITM attacks */ - } else if ((lp_security() == SEC_ADS || - lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC) + } else if ((lp_security() == SEC_ADS) && domain->active_directory && (domain->domain_trust_attribs & LSA_TRUST_ATTRIBUTE_WITHIN_FOREST)) { @@ -1071,6 +1095,22 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain, try_ipc_auth = true; } + if (IS_AD_DC) { + /* + * As AD DC we only use netlogon and lsa + * using schannel over an anonymous transport + * (ncacn_ip_tcp or ncacn_np). + * + * Currently we always establish the SMB connection, + * even if we don't use it, because we later use ncacn_ip_tcp. + * + * As we won't use the SMB connection there's no + * need to try kerberos. And NT4 domains expect + * an anonymous IPC$ connection anyway. + */ + try_ipc_auth = false; + } + if (try_ipc_auth) { result = get_trust_credentials(domain, talloc_tos(), false, &creds); if (!NT_STATUS_IS_OK(result)) {