duritong / trocla

A password store for password creation and retrieval
Other
75 stars 18 forks source link

Cfssl backend #54

Open XANi opened 5 years ago

XANi commented 5 years ago

Adds Cloudflare's PKI toolkit support via its remote CA API. Basically feeds cfssl CLI tool with required options to generate key, csr, feed that to remote CA server, and put resulting data back into trocla, adding from-to dates extracted from the cert along the way.

XANi commented 5 years ago

Though, I would love to have tests and I guess the only thing we need to mock is the Open3 call, so should be pretty easy. But tests would show that a) it works in general and be explain some of the logic you have their and thus would prevent regressions.

Is there an example in code on how I could do that? Ruby is not exactly something I write often in (and I don't think I ever even wrote a test in its test frameworks) so I do not even know where to start with mocking. Inputs and outputs for cfssl are pretty easy to check/emulate, but honestly most of the complexisty with the setup is "set cfssl correctly in the first place" (this is why I attached full example config of it) and after that it is just "feed json, parse json"