Esempio n. 1
0
 def test_private_ipv6(self):
     certificate = mock.MagicMock()
     certificate.subject_ip_addresses = mock.Mock(return_value=[
         self.FakeIPAddress(253, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
                            14, 15)
     ])
     check = ip_addresses.CheckPrivateIpAddresses()
     result = check.check(certificate)
     self.assertEqual(len(result), 1)
Esempio n. 2
0
 def test_not_private_ipv4(self):
     certificate = mock.MagicMock()
     certificate.subject_ip_addresses = mock.Mock(return_value=[
         self.FakeIPAddress(11, 0, 0, 5),
         self.FakeIPAddress(172, 32, 0, 5),
         self.FakeIPAddress(172, 5, 1, 1),
         self.FakeIPAddress(192, 15, 0, 0)
     ])
     check = ip_addresses.CheckPrivateIpAddresses()
     result = check.check(certificate)
     self.assertEqual(len(result), 0)
Esempio n. 3
0
 def test_private_ipv4(self):
     certificate = mock.MagicMock()
     certificate.subject_ip_addresses = mock.Mock(return_value=[
         self.FakeIPAddress(10, 0, 0, 5),
         self.FakeIPAddress(192, 168, 0, 1),
         self.FakeIPAddress(172, 16, 5, 5),
         self.FakeIPAddress(172, 31, 3, 3),
         self.FakeIPAddress(172, 27, 42, 4)
     ])
     check = ip_addresses.CheckPrivateIpAddresses()
     result = check.check(certificate)
     self.assertEqual(len(result), 5)
Esempio n. 4
0
from ct.cert_analysis import common_name
from ct.cert_analysis import crl_pointers
from ct.cert_analysis import dnsnames
from ct.cert_analysis import extensions
from ct.cert_analysis import ip_addresses
from ct.cert_analysis import ocsp_pointers
from ct.cert_analysis import serial_number
from ct.cert_analysis import validity

ALL_CHECKS = [serial_number.CheckNegativeSerialNumber(),
              validity.CheckValidityNotBeforeFuture(),
              validity.CheckValidityCorrupt(),
              validity.CheckIsExpirationDateWellDefined(),
              dnsnames.CheckValidityOfDnsnames(),
              dnsnames.CheckCorruptSANExtension(),
              dnsnames.CheckTldMatches(),
              common_name.CheckSCNTldMatches(),
              common_name.CheckLackOfSubjectCommonName(),
              common_name.CheckCorruptSubjectCommonName(),
              extensions.CheckCorrectExtensions(),
              ip_addresses.CheckPrivateIpAddresses(),
              ip_addresses.CheckCorruptIpAddresses(),
              algorithm.CheckSignatureAlgorithmsMismatch(),
              algorithm.CheckCertificateAlgorithmSHA1After2017(),
              algorithm.CheckTbsCertificateAlgorithmSHA1Ater2017(),
              ca_field.CheckCATrue(),
              ocsp_pointers.CheckOcspExistence(),
              ocsp_pointers.CheckCorruptOrMultipleAiaExtension(),
              crl_pointers.CheckCrlExistence(),
              crl_pointers.CheckCorruptOrMultipleCrlExtension(),]