From 2c5f3cfd60575d7c72e6be8124b34c88b90d9fb7 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Fri, 15 Oct 2010 23:40:38 -0500 Subject: Host certificate management The service certificate management UI has been generalized and moved into certificate.js. The host details page is now using the same code to manage certificates. The host.py has been modified to return host certificate info. The Get/Revoke/View buttons behavior has been modified such that they are visible only if there is a valid certificate. The Get dialog box has been fixed to show the correct certificate header and footer. The ipa.css has been modified to store the style of the status bullets. New unit tests for certificate has been added. The test data has been modified to include sample host certificate. --- install/static/test/all_tests.html | 4 +- install/static/test/association_tests.html | 2 +- install/static/test/certificate_tests.html | 24 +++++++++ install/static/test/certificate_tests.js | 79 ++++++++++++++++++++++++++++++ install/static/test/data/cert_show.json | 1 - install/static/test/data/host_show.json | 14 +++++- install/static/test/details_tests.html | 2 +- install/static/test/entity_tests.html | 2 +- install/static/test/index.html | 1 + install/static/test/ipa_tests.html | 2 +- install/static/test/navigation_tests.html | 2 +- 11 files changed, 125 insertions(+), 8 deletions(-) create mode 100755 install/static/test/certificate_tests.html create mode 100755 install/static/test/certificate_tests.js (limited to 'install/static/test') diff --git a/install/static/test/all_tests.html b/install/static/test/all_tests.html index aede08e7..50c5155d 100644 --- a/install/static/test/all_tests.html +++ b/install/static/test/all_tests.html @@ -14,11 +14,13 @@ + +

Complete Test Suite

@@ -26,6 +28,6 @@

    -
    test markup
    +
    diff --git a/install/static/test/association_tests.html b/install/static/test/association_tests.html index 5b5fb717..40b3c208 100644 --- a/install/static/test/association_tests.html +++ b/install/static/test/association_tests.html @@ -18,6 +18,6 @@

      -
      test markup
      +
      diff --git a/install/static/test/certificate_tests.html b/install/static/test/certificate_tests.html new file mode 100755 index 00000000..90f09b21 --- /dev/null +++ b/install/static/test/certificate_tests.html @@ -0,0 +1,24 @@ + + + + Certificate Test Suite + + + + + + + + + + + + +

      Certificate Test Suite

      +

      +
      +

      +
        +
        + + diff --git a/install/static/test/certificate_tests.js b/install/static/test/certificate_tests.js new file mode 100755 index 00000000..6ada6e40 --- /dev/null +++ b/install/static/test/certificate_tests.js @@ -0,0 +1,79 @@ +/* Authors: + * Endi Sukma Dewata + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +test("Testing certificate_parse_dn().", function() { + + same( + certificate_parse_dn(), {}, + "Checking certificate_parse_dn()" + ); + + same( + certificate_parse_dn(''), {}, + "Checking certificate_parse_dn('')" + ); + + same( + certificate_parse_dn('c=US'), {'c': 'US'}, + "Checking certificate_parse_dn('c=US')" + ); + + same( + certificate_parse_dn('st=TX,c=US'), {'st': 'TX','c': 'US'}, + "Checking certificate_parse_dn('st=TX,c=US')" + ); + + same( + certificate_parse_dn('c=US,st=TX'), {'st': 'TX','c': 'US'}, + "Checking certificate_parse_dn('c=US,st=TX')" + ); + + same( + certificate_parse_dn(' st = New Mexico , c = US '), {'st': 'New Mexico','c': 'US'}, + "Checking certificate_parse_dn(' st = New Mexico , c = US ')" + ); + + same( + certificate_parse_dn('ST=TX,C=US'), {'st': 'TX','c': 'US'}, + "Checking certificate_parse_dn('ST=TX,C=US')" + ); + + same( + certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US'), + { 'cn': 'dev.example.com', + 'ou': 'Engineering', + 'o': 'Example', + 'l': 'Austin', + 'st': 'TX', + 'c': 'US' + }, + "Checking certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US')" + ); + + same( + certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com'), + { + 'cn': 'John Smith', + 'ou': ['Developers','Users'], + 'dc': ['example', 'com'] + }, + "Checking certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com')" + ); +}); diff --git a/install/static/test/data/cert_show.json b/install/static/test/data/cert_show.json index f8996715..71d895f0 100644 --- a/install/static/test/data/cert_show.json +++ b/install/static/test/data/cert_show.json @@ -6,7 +6,6 @@ "certificate": "MIICAjCCAWugAwIBAgICBAswDQYJKoZIhvcNAQEFBQAwKTEnMCUGA1UEAxMeSVBBIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTEwMTAwNzIzMzk0NFoXDTE1MTAwNzIzMzk0NFowKDEMMAoGA1UECgwDSVBBMRgwFgYDVQQDDA9kZXYuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOTXyj8grVB7Rj95RFawgdwn9OYZ03LWHZ+HMYggu2/xCCrUrdThP14YBlVqZumjVJSclj6T4ACjjdPJq9JTTmx7gMizDTReus7IPlS6fCxb5v5whQJZsEksXL04OxUMl25euPRFkYcTK1rdW47+AkG10j1qeNW+B6CpdQGR6eM/AgMBAAGjOjA4MBEGCWCGSAGG+EIBAQQEAwIGQDATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCBPAwDQYJKoZIhvcNAQEFBQADgYEASIhq723VL5xP0q51MYXFlGU1boD7pPD1pIQspD/MjCIEupcbH2kAo4wf+EiKsXR0rs+WZkaSgvFqaM4OQ2kWSFTiqmFXFDBEi6EFr68yLg7IpQpNTzVBXERd8B4GwNL9wrRw60jPXlUK29DPBsdGq8fDgX18l39wKkWXv7p1to4=", "issuer": "CN=Certificate Authority,O=IPA", "md5_fingerprint": "08:86:a9:f9:87:af:0d:d7:42:01:e0:5f:12:9b:32:7f", - "revocation_reason": 6, "serial_number": "1", "sha1_fingerprint": "b8:4c:4b:79:4f:13:03:79:47:08:fa:6b:52:63:3d:f9:15:8e:7e:dc", "subject": "CN=dev.example.com,O=IPA", diff --git a/install/static/test/data/host_show.json b/install/static/test/data/host_show.json index 64a7fb31..b0916215 100644 --- a/install/static/test/data/host_show.json +++ b/install/static/test/data/host_show.json @@ -14,6 +14,7 @@ "ipauniqueid": [ "b54b73a8-8ba8-11df-80bc-00163e26b89e" ], + "issuer": "CN=IPA Test Certificate Authority", "krbextradata": [ { "__base64__": "AAKOoTdMYWRtaW4vYWRtaW5ASURNLkxBQi5CT1MuUkVESEFULkNPTQA=" @@ -34,6 +35,7 @@ "managedby": [ "fqdn=vm-121.idm.lab.bos.redhat.com,cn=computers,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com" ], + "md5_fingerprint": "08:86:a9:f9:87:af:0d:d7:42:01:e0:5f:12:9b:32:7f", "memberof": [], "objectclass": [ "top", @@ -46,9 +48,19 @@ "krbprincipal", "krbticketpolicyaux" ], + "serial_number": "1", "serverhostname": [ "vm-121" - ] + ], + "sha1_fingerprint": "b8:4c:4b:79:4f:13:03:79:47:08:fa:6b:52:63:3d:f9:15:8e:7e:dc", + "subject": "CN=dev.example.com,O=IPA", + "usercertificate": [ + { + "__base64__": "MIICAjCCAWugAwIBAgICBAswDQYJKoZIhvcNAQEFBQAwKTEnMCUGA1UEAxMeSVBBIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTEwMTAwNzIzMzk0NFoXDTE1MTAwNzIzMzk0NFowKDEMMAoGA1UECgwDSVBBMRgwFgYDVQQDDA9kZXYuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOTXyj8grVB7Rj95RFawgdwn9OYZ03LWHZ+HMYggu2/xCCrUrdThP14YBlVqZumjVJSclj6T4ACjjdPJq9JTTmx7gMizDTReus7IPlS6fCxb5v5whQJZsEksXL04OxUMl25euPRFkYcTK1rdW47+AkG10j1qeNW+B6CpdQGR6eM/AgMBAAGjOjA4MBEGCWCGSAGG+EIBAQQEAwIGQDATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCBPAwDQYJKoZIhvcNAQEFBQADgYEASIhq723VL5xP0q51MYXFlGU1boD7pPD1pIQspD/MjCIEupcbH2kAo4wf+EiKsXR0rs+WZkaSgvFqaM4OQ2kWSFTiqmFXFDBEi6EFr68yLg7IpQpNTzVBXERd8B4GwNL9wrRw60jPXlUK29DPBsdGq8fDgX18l39wKkWXv7p1to4=" + } + ], + "valid_not_after": "Tue Oct 13 01:59:32 2015 UTC", + "valid_not_before": "Wed Oct 13 01:59:32 2010 UTC" }, "summary": null, "value": "vm-121.idm.lab.bos.redhat.com" diff --git a/install/static/test/details_tests.html b/install/static/test/details_tests.html index 7c323610..e96fa4b7 100644 --- a/install/static/test/details_tests.html +++ b/install/static/test/details_tests.html @@ -19,6 +19,6 @@

          -
          test markup
          +
          diff --git a/install/static/test/entity_tests.html b/install/static/test/entity_tests.html index a6d3f72f..b8da0f44 100644 --- a/install/static/test/entity_tests.html +++ b/install/static/test/entity_tests.html @@ -19,6 +19,6 @@

            -
            test markup
            +
            diff --git a/install/static/test/index.html b/install/static/test/index.html index a71ee60f..5467a683 100644 --- a/install/static/test/index.html +++ b/install/static/test/index.html @@ -29,6 +29,7 @@
          1. Details Test Suite
          2. Association Test Suite
          3. Navigation Test Suite +
          4. Certificate Test Suite diff --git a/install/static/test/ipa_tests.html b/install/static/test/ipa_tests.html index dfe2720a..3f3c1686 100644 --- a/install/static/test/ipa_tests.html +++ b/install/static/test/ipa_tests.html @@ -17,6 +17,6 @@

              -
              test markup
              +
              diff --git a/install/static/test/navigation_tests.html b/install/static/test/navigation_tests.html index dbb562f1..fa911d6e 100644 --- a/install/static/test/navigation_tests.html +++ b/install/static/test/navigation_tests.html @@ -16,6 +16,6 @@

                -
                test markup
                +
                -- cgit