#9331 Better handling of the command line and web UI cert search and/or list features
Closed: fixed a year ago by rcritten. Opened a year ago by rcritten.

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2164349

When a user is browsing the WebUI and navigates to Authentication > Certificates, the webui performs a command equivalent to "ipa cert-find" without any size or time limit.

The IPA framework handles this operation in /ipaserver/plugins/cert.py, class cert_find, method execute()
https://github.com/freeipa/freeipa/blob/7d1d91fc86c49fcaaec05c772add13af36fc0209/ipaserver/plugins/cert.py#L1817

The execute method launches _ca_search, which in turn call ra.find()
https://github.com/freeipa/freeipa/blob/7d1d91fc86c49fcaaec05c772add13af36fc0209/ipaserver/plugins/cert.py#L1701

This method is defined in ipaserver/plugins/dogtag.py, class ra
https://github.com/freeipa/freeipa/blob/7d1d91fc86c49fcaaec05c772add13af36fc0209/ipaserver/plugins/dogtag.py#L1727

The method is doing an http request to PKI: POST /ca/rest/certs/search?size=2147483647
(the size is the default one, 0x7fffffff, used because no options.sizelimit was provided)
https://github.com/freeipa/freeipa/blob/7d1d91fc86c49fcaaec05c772add13af36fc0209/ipaserver/plugins/dogtag.py#L1828

Note: even if the user defines a sizelimit with ipa cert-find --sizelimit=xx, the limit passed to PKI is the default one 0x7fffffff. The limit is not forwarded from IPA framework to PKI.

The limit is only used when all the certs have been retrieved in order to truncate the returned entries:
https://github.com/freeipa/freeipa/blob/master/ipaserver/plugins/cert.py#L1917

    if (len(result) > sizelimit > 0):
        if not truncated:
            self.add_message(messages.SearchResultTruncated(
                    reason=errors.SizeLimitExceeded()))
        result = result[:sizelimit]
        truncated = True

On PKI side:
PKI server seems to properly honor the size parameter. If it receives POST /ca/rest/certs/search?size=0x00000001 it sends only the requested number of certificates, ie one.

In summary:
- IPA framework should be enhanced and make a better use of the size limit provided through ipa cert-find --sizelimit=xxx
- When no sizelimit is provided, the best would be to do a paged size when querying PKI. Not sure if PKI implements this functionality.


Metadata Update from @rcritten:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=2164349

a year ago

master:

  • 2b2f10c Enforce sizelimit in cert-find
  • 191880b Use the OpenSSL certificate parser in cert-find

ipa-4-9:

  • 6e04c49 Enforce sizelimit in cert-find
  • f54a55a Use the OpenSSL certificate parser in cert-find

ipa-4-10:

  • e257667 Enforce sizelimit in cert-find
  • 50dd79d Use the OpenSSL certificate parser in cert-find

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

a year ago

master:

  • 1f30cc6 cert_find: fix call with --all

ipa-4-9:

  • 59cab23 cert_find: fix call with --all

ipa-4-10:

  • 918b6e0 cert_find: fix call with --all

Metadata Update from @rcritten:
- Custom field changelog adjusted to cert-find performance was improved dramatically when a large number of certificates are returned by changing the method IPA uses internally to parse results from the CA.

a year ago

master:

  • 2a605c5 Revert "Use the OpenSSL certificate parser in cert-find"
  • 8a25020 Revert "cert_find: fix call with --all"
  • fa3a69f Use the python-cryptography parser directly in cert-find

ipa-4-10:

  • 2761380 Revert "Use the OpenSSL certificate parser in cert-find"
  • d83a4b0 Revert "cert_find: fix call with --all"
  • d9aa754 Use the python-cryptography parser directly in cert-find

ipa-4-9:

  • 9fe30f2 Revert "Use the OpenSSL certificate parser in cert-find"
  • 3b1dbcd Revert "cert_find: fix call with --all"
  • d00fd33 Use the python-cryptography parser directly in cert-find

Login to comment on this ticket.

Metadata