Skip to content

ocsp-server doesn't run with sqlite #24

Closed

Description

@ruomad

Hello I'm trying to test the server with SQLite, but it silently exits without any message. Is there a way to know what is wrong (config file ?)
I tested it with the provided binary (ubuntu) and with a self compiled server on freebsd, no joy and same symptoms
Any clue ?

Activity

  1. DorianCoding commented on May 20, 2026

    @DorianCoding
    Owner

    Hello,

    Yes it seems the Github actions generates an invalid binary, I will take a look. Compiling should however work.

  2. DorianCoding commented on May 20, 2026

    @DorianCoding
    Owner

    Can you try with the new version?

  3. ruomad commented on May 20, 2026

    @ruomad
    ContributorAuthor

    I tried, no change, sorry.
    No output at all when I run ocsp-server config.toml
    If I make an error in config file I get output

    BTW ocsp-server -V reports 0.7.0 even with new version

  4. ruomad commented on May 20, 2026

    @ruomad
    ContributorAuthor
  5. DorianCoding commented on May 20, 2026

    @DorianCoding
    Owner

    Have you installed libmysqlclient-dev ?

  6. ruomad commented on May 20, 2026

    @ruomad
    ContributorAuthor

    To use sqlite ? no

  7. DorianCoding commented on May 20, 2026

    @DorianCoding
    Owner

    To use sqlite ? no

    The binary compiles all features such as mysql and requires the library. If you want only one feature you need to compile with this specific feature and the library won't be needed.

  8. ruomad commented on May 23, 2026

    @ruomad
    ContributorAuthor

    well I tried even with a mysql database and starting the server as a ubuntu (WSL) service but if still fails to start... thinking of giving up ;-)

  9. DorianCoding commented on May 24, 2026

    @DorianCoding
    Owner

    Try with this binary: https://github.com/DorianCoding/OCSP-server/releases/download/v0.7.1/ocsp-server

    Type ldd also to check required libraries and if they are present.

  10. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    Thanks a lot, I tried it. ldd was reporting a unknown library libmariadb so I installed libmariadb-dev but it still doesn't start at all, very frustrating, I must be missing something...
    The syslog shows only (lauching the service):
    2026-05-25T07:13:51.212830+02:00 jopin systemd[1]: ocspserver.service: Start request repeated too quickly.
    2026-05-25T07:13:51.212969+02:00 jopin systemd[1]: ocspserver.service: Failed with result 'exit-code'.
    2026-05-25T07:13:51.213019+02:00 jopin systemd[1]: Failed to start ocspserver.service - OCSP Server.
    If I launch directly the binary there is no output at all. Isn't there a way to get some debug output ?

  11. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    OK I succeeded to launch it ! I had a wrong password in mysql in my config file. sorry for this.
    I will now try to use other params. Thanks again

  12. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    findings:

    • itkey must be in pkcs8 DER format (unencrypted key)
    • postgres and mysql working as expected
    • sqlite works only with create_table = false
    • dbuser and dbpassword must be set even if they are unused in sqlite
  13. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    additionnally : certnum must be lowercase
    I get correct responses for all my certs except one where I get status 'unknown' instead of good, what can be the reason for this ?
    My current OCSP responder answers good for the same cert (from a crl which I imported in sql db)

  14. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    the problematic cert is serial 0x3d.

    openssl ocsp -CAfile tls_ca_bundle.crt -issuer tls_ca.crt -serial 0x3d -url http://127.0.0.1:9000
    WARNING: no nonce in response
    Response verify OK
    0x3d: unknown
            This Update: May 25 07:53:00 2026 GMT
            Next Update: May 28 07:53:00 2026 GMT
    

    and in db

    sqlite3 /var/ocsp/tls_certs.db
    SQLite version 3.45.1 2024-01-30 16:01:20
    Enter ".help" for usage hints.
    sqlite> select * from custom_certs where cert_num = '0x3d';
    0x3d||unspecified|Valid
    
  15. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    OK problem solved, it was the cache kicking in with a stale answer as I tested this cert before with a capitalized version of cert_num in the database (0x3D was not found).

  16. ruomad commented on May 25, 2026

    @ruomad
    ContributorAuthor

    Also I would very much be able to use this for several issuers (as I have a CA with some sub-CAs).
    AFAIK this would only require some modifications in your code

    • extract authorityKeyIdentifier from the request
    • add a corresponding field to database structure
    • match request on both cert_num and authorityKeyIdentifier
      Is this something you could consider implementing ?

    background : I'm looking to replace openca-ocspd which FreeBSD port I am maintaining as upstream seems mostly dead and also as the complexity of the underlying libpki is really overkill

  17. DorianCoding commented on May 25, 2026

    @DorianCoding
    Owner

    I add a feature for sqlite instead of keeping it by default.

    findings:

    * itkey must be in pkcs8 DER format (unencrypted key)
    
    * postgres and mysql working as expected
    
    * sqlite works only with create_table = false
    
    * dbuser and dbpassword must be set even if they are unused in sqlite
    

    I can investigate the two last points. Regarding the first one, I think it is a dependancy requirement.

    OK problem solved, it was the cache kicking in with a stale answer as I tested this cert before with a capitalized version of cert_num in the database (0x3D was not found).

    Yes there is a cache that you can disable on the config.

    • extract authorityKeyIdentifier from the request

    • add a corresponding field to database structure

    • match request on both cert_num and authorityKeyIdentifier
      Is this something you could consider implementing ?

    Yes I will think of it. However we need also to implement multiple itkeys and certificate as files and change the database while keeping backward-compatibility.

  18. Repository owner locked and limited conversation to collaborators on May 25, 2026
  19. converted this issue into a discussion #26 on May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions