Fix unit tests certificates to have correct chains and private keys

In preparation for certificate integrity-checking: invalid certificate
chains and mismatching private keys will no longer be allowed anywhere
in Lemur code.

The test vector certs were generated using the Lemur "cryptography"
authority plugin.

* Certificates are now more similar to real-world usage: long serial
  numbers, etc.
* Private key is included for all certs, so it's easy to re-generate
  anything if needed.
This commit is contained in:
Marti Raudsepp
2018-06-25 18:42:18 +03:00
parent acd2701fa2
commit 1f0f432327
13 changed files with 310 additions and 182 deletions

View File

@ -1,7 +1,7 @@
import pytest
from moto import mock_iam, mock_sts
from lemur.tests.vectors import EXTERNAL_VALID_STR, PRIVATE_KEY_STR
from lemur.tests.vectors import EXTERNAL_VALID_STR, SAN_CERT_KEY
def test_get_name_from_arn():
@ -15,6 +15,6 @@ def test_get_name_from_arn():
@mock_iam()
def test_get_all_server_certs(app):
from lemur.plugins.lemur_aws.iam import upload_cert, get_all_certificates
upload_cert('123456789012', 'testCert', EXTERNAL_VALID_STR, PRIVATE_KEY_STR)
upload_cert('123456789012', 'testCert', EXTERNAL_VALID_STR, SAN_CERT_KEY)
certs = get_all_certificates('123456789012')
assert len(certs) == 1

View File

@ -16,7 +16,7 @@ def test_formatting(certificate):
},
{
'short': True,
'value': u'Wednesday, January 1, 2020',
'value': u'Tuesday, December 31, 2047',
'title': 'Expires'
}, {
'short': True,