Chapter 9. Managing EST user database
You can find information on DS Realm management and PostgreSQL realm management in the following section.
9.1. Managing DS Realm Copy linkLink copied to clipboard!
The user DB requires a node containing the users inetOrgPerson and a node containing the groups groupOfUniqueNames. Therefore, if the base dn is dc=pki,dc=example,dc=com
it is possible to add a user and associate to EST Users group using the following commands:
9.1.1. TLS mutual authentication Copy linkLink copied to clipboard!
The above configurations allow client authentication using username/password. In some cases or for specific operation, such as re-enroll for a new certificate, mutual authentication with client certificate is required.
Realm configuration already support certificate based authentication out-of-the-box but in order to authenticate a user some additional information are needed. In more detail, the user entry has to include a description containing some certificate details and the binary certificate.
The description has the format <Version>;<Serial>;<Issuer>;<subject>
. The version is the hex value (without 0x), the serial is in decimal and issuer and subject are distinguished name (DN). The format for DN is from the more specific attribute to the more general (note: some tools, like OpenSSL, have different order), separated by comma. As an example, if the user has a certificate with the following values:
Then the user entry est-test-user
defined above can be modified in the DS case with the command:
Replace the <certificate_base64>
with the actual value. To obtain the value from the DER certificate it is possible to use the command:
openssl base64 -in cert.der | sed 's/^/ /'
$ openssl base64 -in cert.der | sed 's/^/ /'
9.2. Managing PostgreSQL Realm Copy linkLink copied to clipboard!
To add a user and associate to the EST Users group it is possible to execute the following commands:
psql -U est -t -A -c "INSERT INTO users VALUES ('est-test-user', 'EST TEST USER', '<tomcat_digest>');" est psql -U est -t -A -c "INSERT INTO group_members VALUES ('EST Users', 'est-test-user');" est
$ psql -U est -t -A -c "INSERT INTO users VALUES ('est-test-user', 'EST TEST USER', '<tomcat_digest>');" est
$ psql -U est -t -A -c "INSERT INTO group_members VALUES ('EST Users', 'est-test-user');" est
The tomcat digest for the password can be obtained with the command:
tomcat-digest <user_password>
$ tomcat-digest <user_password>
9.2.1. TLS mutual authentication Copy linkLink copied to clipboard!
The above configurations allow client authentication using username/password. In some cases or for specific operation, such as re-enroll for a new certificate, mutual authentication with client certificate is required.
Realm configuration already support certificate based authentication out-of-the-box but in order to authenticate a user some additional information are needed. In more detail, the user entry has to include a description containing some certificate details and the binary certificate.
The description has the format <Version>;<Serial>;<Issuer>;<subject>
. The version is the hex value (without 0x), the serial is in decimal and issuer and subject are distinguished name (DN). The format for DN is from the more specific attribute to the more general (note: some tools, like OpenSSL, have different order), separated by comma.
These information are stored in the user_certs table. As an example, if the user has a certificate with the following values:
Then the user entry est-test-user
defined above requires a new entry in the user_certs table which can be added with:
psql -U est -t -A -c "INSERT INTO user_certs VALUES ('est-test-user', '2;67939231264256858734977554404570695488;CN=CA Signing Certificate,OU=pki-tomcat,O=EXAMPLE;CN=test.example.com', pg_read_binary_file('/cert.der'));" est
$ psql -U est -t -A -c "INSERT INTO user_certs VALUES ('est-test-user', '2;67939231264256858734977554404570695488;CN=CA Signing Certificate,OU=pki-tomcat,O=EXAMPLE;CN=test.example.com', pg_read_binary_file('/cert.der'));" est