Closed OTP-Maintainer closed 3 years ago
ingela
said:
I think you may be correct that the code path may not have been covered before.
The RFC 5280 is not one of the easiest to understand, I think.
The erl_make_certs part of the test frame work is one of the older parts the code,which creates OpenSSL configuration for generation of cert data. A problem with it is that it assumes all test wants more or less the same test data. So it could be that your addition could brakes some other test. For most test cases we no longer use this configuration but use our own public_key functions to generate test data. For CRLs however we have not had time to prioritize additions to public_key to be able to do so.
One way would be to add some config value so that you only use your configuration for the new test case.
You could also provide an OpenSSL config file in the ssl_crl_SUITE_data directory and then fetch it ( DataDir = proplists:get_value(data_dir, Config),
Conffile = filename:join(DataDir, "OpenSSLConf") ) and create your special input in init_per_tescase(yourtest, Config) -> ... it that feels easier. That is probably how I would do it if I wrote test using OpenSSL to generate data from scratch.
ingela
said:
It could be a good idea if you make your changes into a PR and we could cooperate to finish it to something "mergable"!
tim gleeson
said:
I hope I'll have a little time next week to look at the testing path you suggested. And then I'll try working up a proper PR.
tim gleeson
said:
Here's what I'm thinking of doing for testing. I'd appreciate
your shooting down anything which you think is mad...
When you talk about private_key testing, I assume you are talking
about the private_key module. I guess many (some?) of the
functions there can be 'unit tested' in a straightforward way
because they are fairly straightforward functions with limited
environment interaction. Is that in fact what's happening?
The crash I observed was in CRL file handling. I think I can't do
simple unit testing, because of the need to cover that path which
interacts with the file system. Is there a subset of SSL
functionality which I could test? I don't know the code well
enough, so I'm assuming I have to do a full 'system' test and
establish an SSL connection - as the other ssl_crl_SUITE tests
do.
If that's true, then I might as well use the
crl_verify_valid() (etc.) tests in the ssl_crl_SUITE, being
careful to have set up the environment correctly for them. I
think this means I will need to have pre-created:
% server/key.pem, server/cert.pem, server/cacerts.pem
% erlangCA/crl.pem
% otpCA/crl.pem
make_certs:all(), as you say, is doing too much and is
inflexible. So, I'm thinking of exploding that all() function into
my testcase (or testgroup) and writing a local enduser() function
to take an openssl config file from the datadir.
ingela
said:
Well we use the erlang public_key:pkix_test_data/1 to create a lots of our configuration. It will return its data as DER blobs. But the ssl test code also uses other public_key functions to create PEM file format (public_key application does not handle files, see x509-test.erl in ssl test directory) and writes it to files in test case priv_dir as to test that path of invocation. However public_key API has no function to create CRLs.
The problem with pre creating certs is that they might not always have a valid date when you try to run the test.
We prefer to always create fresh data that shall pass, we do not know the life cycle of the code. I think you should be able to
use OpenSSL to generate all cert data, that is what make_certs does. Pre generated keys are ok.
The public_key application has some own test of CRL based on http://csrc.nist.gov/groups/ST/crypto_apps_infra/pki/pkitesting.html
We have had the problem with this suite, that the certs expired, and they made a new one released in a different way.
The ssl application uses the public_key application to do all pkix_path and CRL validation so it could be possible to add a test case to
public_key instead of ssl but I am not sure it make the problem easier as generating the test data is the hard part.
Original reporter:
tim gleeson
Affected version:Not Specified
Fixed in version:OTP-20.3
Component:ssl
Migrated from: https://bugs.erlang.org/browse/ERL-1030