Generate SSL certificates for tests in the test helper
Gazler opened this issue · comments
See failures on https://travis-ci.org/elixir-plug/plug_cowboy/jobs/544024765
There's a readme for this, but I wasn't able to get it to work.
https://github.com/elixir-plug/plug_cowboy/blob/master/test/fixtures/ssl/README.md
The files generated in the instructions don't match the names of the files used by the tests. Also, the points where it tells me to enter a password, I'm not prompted for one. I'm a little out of my depth with openssl commands.
My suggestion would be to port the code in phx.gen.cert: https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Cert.html. Or maybe we port phx.gen.cert
to plug.gen.cert
and simply invoke it.
I'd have to add client certs and password protected keys to the x509.gen.suite
task to have feature parity with the current certs. I do think adding x509 as a test dependency would be preferred over forking yet another gen.cert task and adding the missing functionality there.
@voltone just to clarify, if we add the task to to Plug, we would remove it from Phoenix. :)
@josevalim ok, maybe it should have been in Plug all along. But to cover the needs of plug_cowboy it would have to be extended significantly, beyond just the self-signed cert
Oh, I see! So let's go the x509.gen.suite route then, although I have no idea how much work is necessary to make it generate what we need for our suite.
Not that much, I'll try to do that this evening and then push a PR here
Please have a look at #13