kairoaraujo / goca

Golang Certificate Authority (CA) package
MIT License
38 stars 13 forks source link

Support databases as storage #26

Open kebugcheckex opened 1 year ago

kebugcheckex commented 1 year ago

This is a feature request. I will probably work on it later.

Current storage uses file system to store keys and certificates. This will not scale well when the number of certificates grows to a magnitude of 10^4 or larger. I'm considering create a storage adapter that can support databases, both relational databases (e.g. MySQL) and key-value storage (e.g. Redis), while retaining the ability to use file system as the storage.

I don't have a detailed design yet. On the high level, we can abstract the load/save operations and have different implementations behind the scene. I will add more details soon.

wixregiga commented 1 year ago

Hey, did you make any progress on this or would you like some assistance? @kebugcheckex

kebugcheckex commented 1 year ago

Sorry. I haven't got a chance to start working on this yet. This will require a bit design work. Here are some thoughts in my mind.

  1. What kind of database do we want to support? We can support one specific kind of database (e.g. MySQL) or a variety of them. Given that the existing code has a storage adapter, I guess we should create an abstraction based on that and support different databases through adapters.
  2. How to design the table schema? For example, shall we store certificates/keys as Base64 encoded string or just binary blobs?
  3. In the long term (obviously not any time soon) we may need to support distributed databases, how to shard, etc.
BirknerAlex commented 1 month ago

A interface which everyone can implement would be awesome, so everybody can decide which storage method to use. One interface implemenation would be the file system as we already have.