How to do secure LDAP to an alias

661 views
Skip to first unread message

Mike Leone

unread,
Mar 3, 2022, 1:11:49 PM3/3/22
to NTSysAdmin
I've set up a DNS entry called "ldap.FQDN>", and assigned it the IP address of all my DCs. (why? I don't want my applications to do an LDAP lookup to any one specific DC, especially since I am in the process of replacing all my DCs). 

I run my own CA, so I issued a cert in the name of "ldap.<FQDN>", and imported it into the computer account Personal cert store on each DC (I have 4). But I can't connect using port 636.

ld = ldap_open("ldap.wrk.ads.pha.phila.gov", 636);
Error <0x51>: Fail to connect to ldap.wrk.ads.pha.phila.gov.

(that's from ldp.exe)

I can connect using non-secure (i.e., port 389), that's all good. And I will use that, if I have to. But I'd prefer a secure LDAP. I'm just not sure how to get it to work this way (i.e., using a DNS round robin name, as opposed to using a context name on a load balancer).

I'm missing something basic, but what? Does the cert have to have a SAN with the name of each DC? I haven't been able to find anything about doing ldap this way, by querying an alias .

Each DC has its own cert, in it's own name. And each connects securely, via its individual name. That all works as expected. It's only the "alias" name that won't connect securely.

How are you handling doing LDAP? Do you specify an alias address like I'm trying to do? Or do you go to a specifically named server, and what do you do when it's time to retire that server?

Thanks
--

Mike. Leone, <mailto:tur...@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

This space reserved for future witticisms ...

Robert ECEO Townley

unread,
Mar 3, 2022, 1:30:53 PM3/3/22
to ntsys...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/CAHBr%2B%2BiBagLzOCiXXAw_x%3DdW-%3DuMNJS5Q3i9M30WWaDNeNBNYg%40mail.gmail.com.


Mike,  SubjectAlternativeNames would be required.   If there are web servers running on each dc, they would fail to connect as well unless each possible host name and IP address is in the SAN.  

--
Two Rules to remember:
Do not blame older Windows versions when Win10 networking can be blamed. 
Do not blame IPv4 when you can blame IPv6.

Michael B. Smith

unread,
Mar 3, 2022, 1:31:23 PM3/3/22
to ntsys...@googlegroups.com

You’ve got to have the server FQDN as a SAN for the LDAP certificate.

 

I generally do something like:

 

               Ldap.domain.com as the subject

 

And then the same as a SAN and each DC name:

 

               Ldap.domain.com

               Dc1.domain.com

               DCn.domain.com

 

You also need to make sure you have the EKU for server auth.

 

Not sure what you mean “computer account Personal cert store”. It should be in either LocalMachine\My or the service account store for AD DS:

 

--

Mike Leone

unread,
Mar 3, 2022, 1:40:53 PM3/3/22
to ntsys...@googlegroups.com
On Thu, Mar 3, 2022 at 1:31 PM Michael B. Smith <mic...@smithcons.com> wrote:

You’ve got to have the server FQDN as a SAN for the LDAP certificate. 

 

I generally do something like:

 

               Ldap.domain.com as the subject

 

And then the same as a SAN and each DC name:

 

               Ldap.domain.com

               Dc1.domain.com

               DCn.domain.com


So I need a SAN listing each DC name? meaning every time I add or remove  a DC from AD, I have to re-issue the cert, with new SANs, so it stays up to date?
 

 

You also need to make sure you have the EKU for server auth.


Don't know what this means ...
 

 

Not sure what you mean “computer account Personal cert store”. It should be in either LocalMachine\My or the service account store for AD DS:


When you open the MMC and add the Certificate snapin, it asks if you want  user account, service account, or computer account.  I choose computer account, because the cert is not for any specific user,

And the store it imports into is the Personal store.

Michael B. Smith

unread,
Mar 3, 2022, 2:03:29 PM3/3/22
to ntsys...@googlegroups.com

How often do you add/remove DCs? 😊

 

In re: the EKU – what are you using as the template?

Kurt Buff

unread,
Mar 3, 2022, 2:31:27 PM3/3/22
to ntsys...@googlegroups.com
You're replacing your DCs?

Prepopulate the cert with the current and future DCs - per whatever your naming convention might be.

Some distant time later, re-issue the cert without the old names.

Kurt

Mike Leone

unread,
Mar 3, 2022, 2:32:11 PM3/3/22
to ntsys...@googlegroups.com
On Thu, Mar 3, 2022 at 2:03 PM Michael B. Smith <mic...@smithcons.com> wrote:

How often do you add/remove DCs? 😊


Not often, no. :-) But I am upgrading all the 2012 R2 DCs to Win 2019. But I suppose as long as I remove the A records from DNS, I can leave all the (soon-to-be-unused) SANs in the cert ...
 

In re: the EKU – what are you using as the template?


Something I found from some guy with the initials MBS ... :-)

;
; SAMPLE Certificate Request template, for a DC to be able to do LDAPS
; LDAP over SSL, which is mandatory after 2020-03.
;
; You will need to customize this file, and then save it with the name of the DC
; you are creating the request for (i.e., save ass "DCTRWRK007-LDAPS-request.CSR".
; CSR=Certificate Signing Request
;
[Version]
Signature="$Windows NT$"

; if this file is named "certreq-ldaps.inf" then "certreq.exe -new certreq-ldaps.inf certreq-ldaps.csr"

[NewRequest]
; Change to `Subject=<FQDN>` of the DC in question
Subject = "CN=ldaps.smithcons.com,O=Michael B. Smith,L=Charlottesville,ST=Virginia,C=US"

; Change to display name of DC 
FriendlyName = "ldaps.smithcons.com 2019-11-04"

Requesttype = Cert               ; make a self-signed certificate
Exportable = True                ; private-key is exportable
KeyLength = 2048                 ; 512, 1024, 2048, 4096, 8192, or 16384
KeySpec = 1                      ; AT_KEYEXCHANGE
MachineKeySet = True             ; goes in machine store instead of user's personal store
KeyAlgorithm = RSA               ; RSA key
SMIME = False                    ; cannot be used for signing S/MIME messages
HashAlgorithm = sha256           ; "certutil -oid 1 | findstr pwszName" -- gives a list (including sha1)
UserProtected = False
UseExistingKeySet = False   ; we are not renewing a key that already exists
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
ProviderType = 12                ; for ProviderName and ProviderType, see "certutil -csplist"
RequestType =  PKCS10            ; if empty or set to "CERT" then a self-signed cert is created
KeyUsage = 0xa0                  ; 0xa0 - CERT_DIGITAL_SIGNATURE_KEY_USAGE + CERT_KEY_ENCIPHERMENT_KEY_USAGE
 
[RequestAttributes]
CertificateTemplate="WebServer"

[EnhancedKeyUsageExtension]
OID = 1.3.6.1.5.5.7.3.1 ; PKIX_KP_SERVER_AUTH
OID = 1.3.6.1.5.5.7.3.2 ; PKIX_KP_CLIENT_AUTH

[Extensions]

; This is for a SAN (SubjectAltName), reguired by CHROME and FIREFOX as of 2019
;
; If your client operating system is Windows Server 2008, Windows Server 2008 R2,
; Windows Vista, or Windows 7 (or later), SANs can be included in the Extensions
; section by using the following text format.

; Note 2.5.29.17 is the OID for a SAN extension.
 
2.5.29.17 = "{text}"

; CHANGE to `DNS=<FQDN> of the DC.
_continue_ = "dns=autodiscover.smithcons.com"

 

Mike Leone

unread,
Mar 3, 2022, 3:21:22 PM3/3/22
to ntsys...@googlegroups.com
Yep, that worked a treat! Great! Now I just have to go and change all the existing applications that have LDAP settings pointing to a soon-to-be-nonexistent DC and point them at my new abstract name ..

Oh, the joy! LOL




On Thu, Mar 3, 2022 at 1:31 PM Michael B. Smith <mic...@smithcons.com> wrote:

Michael B. Smith

unread,
Mar 3, 2022, 3:25:42 PM3/3/22
to ntsys...@googlegroups.com

There ya go “EnhancedKeyUsage” – EKU 😊

 

Did that come out of one of Webster’s script archives? 😊

Mayo, Bill

unread,
Mar 3, 2022, 3:32:55 PM3/3/22
to ntsys...@googlegroups.com

I have been watching this thread with interest. We have a group policy that automatically generates certificates for computer objects, which obviously wouldn’t have any SAN entries. Our vulnerability scans sometimes show expired certificates being given for LDAPS responses. I would confirm there is a current certificate, but I have been unable to find a way to force LDAPS to use a particular certificate. If I were to create a different certificate that had SAN entries, such that there were now multiple certificates that were valid for the purpose of LDAPS, what is the method by which LDAPS would decide which certificate to present? And is there a way to force it to use a particular certificate? I have reviewed https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority on multiple occasions, but it doesn’t seem to address this issue.

 

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone

Sent: Thursday, March 3, 2022 3:21 PM
To: ntsys...@googlegroups.com

Subject: Re: [ntsysadmin] How to do secure LDAP to an alias

 

Yep, that worked a treat! Great! Now I just have to go and change all the existing applications that have LDAP settings pointing to a soon-to-be-nonexistent DC and point them at my new abstract name ..

 

Oh, the joy! LOL

 

 

 

 

On Thu, Mar 3, 2022 at 1:31 PM Michael B. Smith <mic...@smithcons.com> wrote:

You’ve got to have the server FQDN as a SAN for the LDAP certificate.

 

I generally do something like:

 

               Ldap.domain.com as the subject

 

And then the same as a SAN and each DC name:

 

               Ldap.domain.com

               Dc1.domain.com

               DCn.domain.com

 

You also need to make sure you have the EKU for server auth.

 

Not sure what you mean “computer account Personal cert store”. It should be in either LocalMachine\My or the service account store for AD DS:

 

cid:17f516fd6795b16b21

David Svirskis

unread,
Mar 3, 2022, 3:49:37 PM3/3/22
to ntsys...@googlegroups.com

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority#improvements

 

you can also put certificates in the NTDS Service's Personal certificate store in Windows Server 2008 and in later versions of Active Directory Domain Services (AD DS)”

 

“AD DS preferentially looks for certificates in this store over the Local Machine's store. This makes it easier to configure AD DS to use the certificate that you want it to use”

 

if a Windows Server 2008 or a later version domain controller finds multiple certificates in its store, it automatically selects the certificate whose expiration date is furthest in the future. Then, if your current certificate is approaching its expiration date, you can drop the replacement certificate in the store, and AD DS automatically switches to use it.”

 

There doesn’t appear to be a way to force the use of a particular certificate if there multiple certificates in the NTDS service’s personal certificate store.

 

Cheers,

David

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mayo, Bill
Sent: Friday, 4 March 2022 7:33 AM
To: ntsys...@googlegroups.com
Subject: RE: [ntsysadmin] How to do secure LDAP to an alias

 

I have been watching this thread with interest. We have a group policy that automatically generates certificates for computer objects, which obviously wouldn’t have any SAN entries. Our vulnerability scans sometimes show expired certificates being given for LDAPS responses. I would confirm there is a current certificate, but I have been unable to find a way to force LDAPS to use a particular certificate. If I were to create a different certificate that had SAN entries, such that there were now multiple certificates that were valid for the purpose of LDAPS, what is the method by which LDAPS would decide which certificate to present? And is there a way to force it to use a particular certificate? I have reviewed https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority on multiple occasions, but it doesn’t seem to address this issue.

 

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone
Sent: Thursday, March 3, 2022 3:21 PM
To: ntsys...@googlegroups.com
Subject: Re: [ntsysadmin] How to do secure LDAP to an alias

 

Yep, that worked a treat! Great! Now I just have to go and change all the existing applications that have LDAP settings pointing to a soon-to-be-nonexistent DC and point them at my new abstract name ..

 

Oh, the joy! LOL

 

 

 

 

On Thu, Mar 3, 2022 at 1:31 PM Michael B. Smith <mic...@smithcons.com> wrote:

You’ve got to have the server FQDN as a SAN for the LDAP certificate.

 

I generally do something like:

 

               Ldap.domain.com as the subject

 

And then the same as a SAN and each DC name:

 

               Ldap.domain.com

               Dc1.domain.com

               DCn.domain.com

 

You also need to make sure you have the EKU for server auth.

 

Not sure what you mean “computer account Personal cert store”. It should be in either LocalMachine\My or the service account store for AD DS:

 

Mike Leone

unread,
Mar 3, 2022, 3:49:56 PM3/3/22
to ntsys...@googlegroups.com
In my case: I have 4 DCs. Each has a cert issued in its own name. If you do a LDAPS://<that specific DC name>, it will use that cert for LDAPS.

Now, each DC *also* has a cert issued to "ldap.<FQDN>"; this cert has a 5 SAN entries - 1 for each of the 4 DCs, and 1 for itself.

There's a DNS entry called "ldap.<FQDN>" that has 4 A records, one for each DC.

So now if you make a call to "ldap.<FQDN>", it will randomly connect to one of those 4 DCs it has an A record for, and use the "ldap" certificate to do it ... which appears as valid, because the actual DC is a SAN (i.e., alias) for that "ldap" DNS name.

Does that make sense?


Mayo, Bill

unread,
Mar 3, 2022, 3:55:58 PM3/3/22
to ntsys...@googlegroups.com

Well, dang, I guess I stopped reading before I got to that part. Thanks much.

cid:image001.png@01D82F17.16591600

Mike Leone

unread,
Mar 4, 2022, 12:57:27 PM3/4/22
to ntsys...@googlegroups.com
Spoke too soon. Today it's back to failing when doing LDAPS but working for LDAP ....'

ld = ldap_sslinit("ldap.wrk.ads.pha.phila.gov", 636, 1);
Error 81 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 81 = ldap_connect(hLdap, NULL);
Server error: <empty>

Error <0x51>: Fail to connect to ldap.wrk.ads.pha.phila.gov.

And each DC has a copy of the certificate in the name of "ldap.wrk.ads.pha.phila.gov", and that cert has SANs for itself and all 4 DCs ... The DNS for it lists all 4 IPs of the DCs ...

So how can I get more details as to why it thinks it failed?

Kurt Buff

unread,
Mar 4, 2022, 1:00:02 PM3/4/22
to ntsys...@googlegroups.com
Are the RRs A records or CNAMEs? I think you want A records, but I could be off base on this.

Kurt

Mike Leone

unread,
Mar 4, 2022, 1:02:16 PM3/4/22
to ntsys...@googlegroups.com
On Fri, Mar 4, 2022 at 1:00 PM Kurt Buff <kurt...@gmail.com> wrote:
Are the RRs A records or CNAMEs? I think you want A records, but I could be off base on this.

All A records

nslookup
> set type=A
> ldap.wrk.ads.pha.phila.gov
Server:  dctrwrk005.wrk.ads.pha.phila.gov
Address:  10.64.7.59

Name:    ldap.wrk.ads.pha.phila.gov
Addresses:  10.64.7.61
          10.64.7.59
          10.64.7.48
          10.64.7.43
 

James Iversen

unread,
Mar 4, 2022, 1:15:57 PM3/4/22
to ntsys...@googlegroups.com
Is this a "windows domain joined" client connecting, or a non-doamin joined device attempting to connect using valid domain user creds?
James Iversen
Network Systems Analyst
IT Infrastructure


 
 


1899 Central Plaza East
Edmeston, NY 13335

nycm.com






From:        "Kurt Buff" <kurt...@gmail.com>
To:        ntsys...@googlegroups.com
Date:        03/04/2022 01:00 PM
Subject:        Re: [ntsysadmin] How to do secure LDAP to an alias
Sent by:        ntsys...@googlegroups.com





ATTENTION: This email was sent from someone outside of NYCM.
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntsysadmin/CADy1Ce7bHM%2Bb%2BVESBb6VhVMeDZ2_yy%3DCYjWqjr-RJ4kGZLAmeg%40mail.gmail.com.









Join us on Facebook at
www.facebook.com/NYCMInsurance.


***CONFIDENTIALITY NOTICE***

This email and any attachments to it are confidential and intended solely for the individual or entity to whom it is addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you have received this email in error, please contact the sender by reply email and destroy all copies of the original message.




Mike Leone

unread,
Mar 4, 2022, 1:22:32 PM3/4/22
to ntsys...@googlegroups.com
On Fri, Mar 4, 2022 at 1:15 PM James Iversen <JIve...@nycm.com> wrote:
Is this a "windows domain joined" client connecting, or a non-doamin joined device attempting to connect using valid domain user creds?

It's my PAW, so a domain member ...


James Iversen

unread,
Mar 4, 2022, 1:45:16 PM3/4/22
to ntsys...@googlegroups.com
Restarting

If an existing LDAPS certificate is replaced with another certificate, either through a renewal process or because the issuing CA has changed, the server must be restarted for Schannel to use the new certificate.
At the least, restart the KDC service on the DC.


From:        "Mike Leone" <tur...@mike-leone.com>
To:        ntsys...@googlegroups.com
Date:        03/04/2022 01:22 PM
Subject:        Re: [ntsysadmin] How to do secure LDAP to an alias
Sent by:        ntsys...@googlegroups.com





ATTENTION: This email was sent from someone outside of NYCM.
 
On Fri, Mar 4, 2022 at 1:15 PM James Iversen <JIve...@nycm.com> wrote:
Is this a "windows domain joined" client connecting, or a non-doamin joined device attempting to connect using valid domain user creds?

It's my PAW, so a domain member ...


--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntsysadmin+...@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntsysadmin/CAHBr%2B%2Bh%2Bx_raMMtX1%3DA%3DbXOW2nC%3DB%2BwtGifV1FuJdbdW2evCug%40mail.gmail.com.

Mike Leone

unread,
Mar 4, 2022, 1:48:13 PM3/4/22
to NTSysAdmin


On Fri, Mar 4, 2022, 1:45 PM James Iversen <JIve...@nycm.com> wrote:
Restarting

If an existing LDAPS certificate is replaced with another certificate, either through a renewal process or because the issuing CA has changed,

Cert not replaced, just a new cert added to the store. See earlier in this thread.


The server must be restarted for Schannel to use the new certificate.
At the least, restart the KDC service on the DC.

I'll mention it to my colleague..


Robert ECEO Townley

unread,
Mar 4, 2022, 4:05:02 PM3/4/22
to ntsys...@googlegroups.com
Does it also fail on ldaps connections to the dns domain name as opposed to directly to a particular dc?

In our environment, we can successfully do all of the following:

ls \\dc2\netlogon
ls \\dc2.ad.domain.tld\netlogon
ls \\ad.domain.tld\netlogon

Wondering if the functionality you desire may already be built in.

Michael B. Smith

unread,
Mar 6, 2022, 5:57:25 PM3/6/22
to ntsys...@googlegroups.com

What does your bind dialog look like?

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone

Sent: Friday, March 4, 2022 12:57 PM
To: ntsys...@googlegroups.com

Mike Leone

unread,
Mar 7, 2022, 9:03:42 AM3/7/22
to ntsys...@googlegroups.com
On Sun, Mar 6, 2022 at 5:57 PM Michael B. Smith <mic...@smithcons.com> wrote:

What does your bind dialog look like?


I re-issued my cert, after promoting my last 2 DCs (meaning: now there's an actual DC to match each SAN), and it works for me, via LDP.EXE:

 I connect to "ldap.wrk.ads.pha.,phila.gov", port 636. It now connects. I bind using an account we use for lookups, and it binds, too.

ld = ldap_sslinit("ldap.wrk.ads.pha.phila.gov", 636, 1);
Error 0 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 0 = ldap_connect(hLdap, NULL);
Error 0 = ldap_get_option(hLdap,LDAP_OPT_SSL,(void*)&lv);
Host supports SSL, SSL cipher strength = 256 bits
Established connection to ldap.wrk.ads.pha.phila.gov.

-----------
53 = ldap_set_option(ld, LDAP_OPT_ENCRYPT, 1)
res = ldap_bind_s(ld, NULL, &NtAuthIdentity, NEGOTIATE (1158)); // v.3
{NtAuthIdentity: User='pgpldap'; Pwd=<unavailable>; domain = ''}
Authenticated as: 'PHA.PHILA.GOV\pgpldap'.
-----------

To me, I'd say that works. But one of my devs says it's still not working from his Oracle application, with the same credentials, and I don't know why ...
His app is an Oracle WebLogic server, and I know nothing about it. Except for the screenshot, that says "Could not connect to LDAP server".

The alias he's connecting with:

Addresses:  10.64.7.59
          10.64.7.48
          10.64.7.55
          10.64.7.62
          10.64.7.43
          10.64.7.61

As for SANs in the cert, the FQDN of each server listed above is in the SAN, but not the FQDN (i.e., the SAN has the FQDN of the server at 10.64.7.59, but not a SAN for the actual IP address of 10.64.7.59). I don't know if that has anything to do with it.

Also, there is no reverse DNS for that alias. i.e., a reverse lookup of 10.64.7.59 will not return "ldap.wrk.ads.pha.phila.gov", but instead returns the actual hostname of 10.64.7.59. Again, I don't know if that matters or not.


Mike Leone

unread,
Mar 7, 2022, 9:07:39 AM3/7/22
to ntsys...@googlegroups.com
On Fri, Mar 4, 2022 at 4:05 PM Robert ECEO Townley <rob...@eyeconsultantspc.com> wrote:
Does it also fail on ldaps connections to the dns domain name as opposed to directly to a particular dc?

In our environment, we can successfully do all of the following:

ls \\dc2\netlogon
ls \\dc2.ad.domain.tld\netlogon
ls \\ad.domain.tld\netlogon

My devs tell me they require a hostname, not just a domain name. I suppose I could have them try just using the domain name, but I'd rather see it work using a hostname, like any "normal" (i.e.,m not AD-specific) type of connection.

Yes, for me, using LDP.EXE, it will make a connection using just the domain name:

 
image.png

ld = ldap_sslinit("wrk.ads.pha.phila.gov", 636, 1);

Error 0 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 0 = ldap_connect(hLdap, NULL);
Error 0 = ldap_get_option(hLdap,LDAP_OPT_SSL,(void*)&lv);
Host supports SSL, SSL cipher strength = 256 bits
Established connection to wrk.ads.pha.phila.gov.


 

Coleman, Hunter

unread,
Mar 7, 2022, 4:09:02 PM3/7/22
to ntsys...@googlegroups.com

> But one of my devs says it's still not working from his Oracle application

 

Does he have the CA cert chain loaded into his java keystore?

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone

Sent: Monday, March 7, 2022 7:03 AM
To: ntsys...@googlegroups.com
Subject: [EXTERNAL] Re: [ntsysadmin] How to do secure LDAP to an alias

On Sun, Mar 6, 2022 at 5:57 PM Michael B. Smith <mic...@smithcons.com> wrote:

What does your bind dialog look like?

 

I re-issued my cert, after promoting my last 2 DCs (meaning: now there's an actual DC to match each SAN), and it works for me, via LDP.EXE:

 

 I connect to "ldap.wrk.ads.pha.,phila.gov [phila.gov]", port 636. It now connects. I bind using an account we use for lookups, and it binds, too.

 


Error 0 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 0 = ldap_connect(hLdap, NULL);
Error 0 = ldap_get_option(hLdap,LDAP_OPT_SSL,(void*)&lv);
Host supports SSL, SSL cipher strength = 256 bits



-----------
53 = ldap_set_option(ld, LDAP_OPT_ENCRYPT, 1)
res = ldap_bind_s(ld, NULL, &NtAuthIdentity, NEGOTIATE (1158)); // v.3
{NtAuthIdentity: User='pgpldap'; Pwd=<unavailable>; domain = ''}

Authenticated as: 'PHA.PHILA.GOV [pha.phila.gov]\pgpldap'.
-----------

 

To me, I'd say that works. But one of my devs says it's still not working from his Oracle application, with the same credentials, and I don't know why ...

His app is an Oracle WebLogic server, and I know nothing about it. Except for the screenshot, that says "Could not connect to LDAP server".

 

The alias he's connecting with:

 

 

As for SANs in the cert, the FQDN of each server listed above is in the SAN, but not the FQDN (i.e., the SAN has the FQDN of the server at 10.64.7.59 [10.64.7.59], but not a SAN for the actual IP address of 10.64.7.59 [10.64.7.59]). I don't know if that has anything to do with it.

 

Also, there is no reverse DNS for that alias. i.e., a reverse lookup of 10.64.7.59 [10.64.7.59] will not return "ldap.wrk.ads.pha.phila.gov [ldap.wrk.ads.pha.phila.gov]", but instead returns the actual hostname of 10.64.7.59 [10.64.7.59]. Again, I don't know if that matters or not.

 

 

--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.

Mike Leone

unread,
Mar 7, 2022, 4:18:56 PM3/7/22
to NTSysAdmin


On Mon, Mar 7, 2022, 4:09 PM 'Coleman, Hunter' via ntsysadmin <ntsys...@googlegroups.com> wrote:

> But one of my devs says it's still not working from his Oracle application

 

Does he have the CA cert chain loaded into his java keystore?

 


I'll ask 


Michael B. Smith

unread,
Mar 7, 2022, 4:36:10 PM3/7/22
to ntsys...@googlegroups.com

You don’t want a SAN for the IP address (and while you can do it, it ain’t strictly “legal”).

 

Reverse DNS also isn’t required (at least, not by standard, I don’t know anything about Oracle).

 

He’ll need the root loaded into the server though, so it can verify the chain.

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone
Sent: Monday, March 7, 2022 9:03 AM
To: ntsys...@googlegroups.com
Subject: Re: [ntsysadmin] How to do secure LDAP to an alias

 

On Sun, Mar 6, 2022 at 5:57 PM Michael B. Smith <mic...@smithcons.com> wrote:

--

You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.

Robert ECEO Townley

unread,
Mar 7, 2022, 5:10:07 PM3/7/22
to ntsys...@googlegroups.com
On Mon, Mar 7, 2022 at 3:36 PM Michael B. Smith <mic...@smithcons.com> wrote:

You don’t want a SAN for the IP address (and while you can do it, it ain’t strictly “legal”).

Please expound on this.  In my view, would be good for troubleshooting to have the IP so he can TLS directly to the IP.   Further, with all the restrictions added in web browsers to TLS, I believe there are some scenarios where reverse ip is checked.  Even if not required by ldaps, it may be required by the lower level TLS dynamic link library.

Mike, have you been monitoring the ldap userPrincipalName entries for each DC in ldap.  Thanks for the info shared.   

 

Reverse DNS also isn’t required (at least, not by standard, I don’t know anything about Oracle).

 

He’ll need the root loaded into the server though, so it can verify the chain.


Hopefully, the dev is smart enough to see the new carts in the windows store that may not show in the a cached Java store until restart or something like that.   

Michael B. Smith

unread,
Mar 7, 2022, 5:32:40 PM3/7/22
to ntsys...@googlegroups.com

I ain’t gonna go chase down the RFC, but basically it goes like this:

 

[1] SANs _usually_ contain dNSNames. And most browsers specifically validate against those dNSNames.

[2] An IP address has the format of a dNSName, but you can’t look it up in DNS (especially recursively), so conformant browsers will ignore them.

[3] There is another type of record allowed in a SAN called an iPAddress which allows both IPv4 and IPv6 addresses, but not dNSNames.

 

So FQDNs should be in dNSNames and IP addresses should be in iPAddresses. I have never (and I quote myself because the OP used one of my scripts to create his certificates) published a script using iPAddresses, nor do I remember seeing one published. I expect any modern browser to ignore IP addresses put into dNSNames entries.

 

If reverse IP were to be checked, that would break proxy, reverse proxy, SNI, and IDS solutions. I do not believe that any such “solution” is widespread.

Mike Leone

unread,
Mar 8, 2022, 8:46:57 AM3/8/22
to ntsys...@googlegroups.com
On Mon, Mar 7, 2022 at 5:32 PM Michael B. Smith <mic...@smithcons.com> wrote:

I ain’t gonna go chase down the RFC, but basically it goes like this:

 

[1] SANs _usually_ contain dNSNames. And most browsers specifically validate against those dNSNames.

[2] An IP address has the format of a dNSName, but you can’t look it up in DNS (especially recursively), so conformant browsers will ignore them.

[3] There is another type of record allowed in a SAN called an iPAddress which allows both IPv4 and IPv6 addresses, but not dNSNames.


I have added IP addresses as a SAN to a cert before, but I've done it at the time I submit the request to the CA. Like this:

certreq -submit -attrib "CertificateTemplate:PHAWebServer\nSAN:DNS=<FQDN>&DNS=<HOSTNAME>&ipaddress=10.xx.xx.xx" <FQDN>_certreq.txt
 
This will add those SAN entries to a cert request, if the request didn't already have SANs embedded in it.

You can also specify an IP address as a SAN if the certificate template you use has "supply in the request" as opposed to "Build from AD information", it's one of the options you can choose.

I didn't do that with the cert we're discussing here, however. I just used dNSNames of all the DCs as SANs. As MBS says later on, I used one of his scripts as the template to create the request, so I just customized the SANs in that template.
Reply all
Reply to author
Forward
0 new messages