Пример #1
0
    def renew_external_step_1(self, ca):
        print("Exporting CA certificate signing request, please wait")

        options = self.options

        if not options.external_ca_type:
            options.external_ca_type = cainstance.ExternalCAType.GENERIC.value

        if options.external_ca_type == cainstance.ExternalCAType.MS_CS.value \
                and options.external_ca_profile is None:
            options.external_ca_profile = cainstance.MSCSTemplateV1(u"SubCA")

        if options.external_ca_profile is not None:
            # check that profile is valid for the external ca type
            if options.external_ca_type \
                    not in options.external_ca_profile.valid_for:
                raise admintool.ScriptError(
                    "External CA profile specification '{}' "
                    "cannot be used with external CA type '{}'.".format(
                        options.external_ca_profile.unparsed_input,
                        options.external_ca_type))

        self.resubmit_request(RENEWAL_REUSE_CA_NAME,
                              profile=options.external_ca_profile)

        print(("The next step is to get %s signed by your CA and re-run "
               "ipa-cacert-manage as:" % paths.IPA_CA_CSR))
        print("ipa-cacert-manage renew "
              "--external-cert-file=/path/to/signed_certificate "
              "--external-cert-file=/path/to/external_ca_certificate")
Пример #2
0
 def test_write_pkispawn_config_file_MSCSTemplateV1(self):
     template = cainstance.MSCSTemplateV1(u"SubCA")
     expected = (
         '[CA]\n'
         'pki_req_ext_oid = 1.3.6.1.4.1.311.20.2\n'
         'pki_req_ext_data = 1e0a00530075006200430041\n\n'
     )
     self._test_write_pkispawn_config_file(template, expected)
Пример #3
0
 def test_MSCSTemplateV1_pickle_roundtrip(self):
     o = cainstance.MSCSTemplateV1("MySubCA")
     s = pickle.dumps(o)
     assert o.get_ext_data() == pickle.loads(s).get_ext_data()
Пример #4
0
 def test_MSCSTemplateV1_bad(self):
     with pytest.raises(ValueError):
         cainstance.MSCSTemplateV1("MySubCA:1")
Пример #5
0
 def test_MSCSTemplateV1_good(self):
     o = cainstance.MSCSTemplateV1("MySubCA")
     assert hexlify(o.get_ext_data()) == b'1e0e004d007900530075006200430041'