Certificate-based user authentication allows users to log into MarkLogic Server without being required to enter user name/password. Certificate-based user authentication configuration can be achieved using either internal user or external name based user configurations.
The main topics are as follows.
There are few common steps/examples listed to add to clarity. In this example setup, the certificate presented by the App Server user (demoUser1
) will be as follows.
Certificate: Data: Version: 1 (0x0) Serial Number: 7 (0x7) Signature Algorithm: sha1WithRSAEncryption Issuer: C=US, ST=CA, L=San Carlos, O=MarkLogic Corp., OU=Engineering, CN=MarkLogic DemoCA Validity Not Before: Jul 11 02:58:24 2017 GMT Not After : Aug 27 02:58:24 2019 GMT Subject: C=US, ST=CA, L=San Carlos, O=MarkLogic Corp., OU=Engineering, CN=demoUser1 Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: ..................... Exponent: 65537 (0x10001) Signature Algorithm: sha1WithRSAEncryption
In order to allow MarkLogic Server to accept the Certificate presented by a user, MarkLogic Server needs a Certificate Authority (CA) to sign the user certificate installed into MarkLogic.
Install a CA certificate used to sign the demoUser1
certificate in the Admin Interface, as follows.
Certificate: Data: Version: 3 (0x2) Serial Number: 9774683164744115905 (0x87a6a68cc29066c1) Signature Algorithm: sha256WithRSAEncryption Issuer: C=US, ST=CA, L=San Carlos, O=MarkLogic Corp., OU=Engineering, CN=MarkLogic DemoCA Validity Not Before: Jul 11 02:53:18 2017 GMT Not After : Jul 6 02:53:18 2037 GMT Subject: C=US, ST=CA, L=San Carlos, O=MarkLogic Corp., OU=Engineering, CN=MarkLogic DemoCA Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (4096 bit) Modulus: ...................... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Key Identifier: D9:45:B9:9A:DC:93:7B:DB:47:07:C6:96:63:57:13:A7:A8:F1:D0:C8 X509v3 Authority Key Identifier: keyid:D9:45:B9:9A:DC:93:7B:DB:47:07:C6:96:63:57:13:A7:A8:F1:D0:C8 X509v3 Basic Constraints: critical CA:TRUE X509v3 Key Usage: critical Digital Signature, Certificate Sign, CRL Sign Signature Algorithm: sha256WithRSAEncryption
You can also import the Certificate Authority by using the pki:insert-trusted-certificates function to load the Trusted CA into the Security database in MarkLogic, as shown below.
If using Query Console, make sure this query is executed against the Security database.
xquery version "1.0-ml"; import module namespace pki = "http://marklogic.com/xdmp/pki" at "/MarkLogic/pki.xqy"; pki:insert-trusted-certificates( xdmp:document-get("/OurCertificateLocation/DemoLabCA.pem", <options xmlns="xdmp:document-get"> <format>text</format> </options>) )
To enable SSL on the App Server, do either of the following.
In both of the above cases, you must import the CA used to sign the certificate used by the MarkLogic SSL App Server into Client Browser/SSL Client, as described in Procedures for Obtaining a Signed Certificate or Importing a Self-Signed Certificate Authority into Windows.
After creating a certificate template, link the template with the App Server and enable SSL on the App Server.
When creating a internal MarkLogic user to use certificate-based authentication, specify the user name as it appears in the CN
value of the certificate Subject
field (demoUser1
in the example shown in User Certificate Example). When creating an external MarkLogic user to use certificate-based authentication, specify the external name as it appears in the whole certificate Subject
field (C=US,ST=CA,L=San Carlos,O=MarkLogic Corp.,OU=Engineering,CN=demoUser1 in the example shown in User Certificate Example).
To configure certificate-based user authentication for user, demoUser1
, as a MarkLogic internal user, do the following in the Admin Interface.
CN
value of the certificate Subject
field (demoUser1
in the example shown in User Certificate Example)Authentication
to Certificate
and set Internal Security
to true
. Unless you want to have the user authenticated as an external user as well, set External Securities
to none
.show
in the SSL Client Certificate Authorities
section.Once configured, demoUser1
is now able to access the App Server with a browser that has the user certificate installed, as described in Certificate Template & Template CA import into Client (Browser/SSL Client).
You will also need to assign the necessary roles to demoUser1
to access the needed MarkLogic resources.
To configure certificate-based user authentication for user, newUser1
, as a MarkLogic user with an external name, do the following in the Admin Interface.
User Name
field, enter newUser1.
External Name
field, enter the entire Subject
field from the example shown in User Certificate Example.Certificate
for Authentication
.show
in the SSL Client Certificate Authorities
section.External Securities
pull-down menu.