dev-java/icedtea/files/generate-cacerts.pl
author Da Risk <da_risk@geekorum.com>
Mon, 03 Apr 2017 10:27:19 -0700
changeset 208 6be79539dae2
parent 115 27c2a6303f2f
permissions -rw-r--r--
Merge removing of a bunch of ebuild already in main gentoo tree
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
115
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     1
#!/usr/bin/perl
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     2
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     3
# Copyright (C) 2007, 2008 Red Hat, Inc.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     4
#
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     5
# This program is free software; you can redistribute it and/or modify
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     6
# it under the terms of the GNU General Public License as published by
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     7
# the Free Software Foundation; either version 2 of the License, or
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     8
# (at your option) any later version.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
     9
#
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    10
# This program is distributed in the hope that it will be useful,
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    13
# GNU General Public License for more details.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    14
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    15
# generate-cacerts.pl generates a JKS keystore named 'cacerts' from
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    16
# OpenSSL's certificate bundle using OpenJDK's keytool.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    17
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    18
# First extract each of OpenSSL's bundled certificates into its own
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    19
# aliased filename.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    20
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    21
# Downloaded from http://cvs.fedoraproject.org/viewvc/rpms/ca-certificates/F-12/generate-cacerts.pl?revision=1.2
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    22
# Check and prevention of duplicate aliases added by Vlastimil Babka <caster@gentoo.org>
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    23
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    24
$file = $ARGV[1];
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    25
open(CERTS, $file);
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    26
@certs = <CERTS>;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    27
close(CERTS);
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    28
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    29
$pem_file_count = 0;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    30
$in_cert_block = 0;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    31
$write_current_cert = 1;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    32
foreach $cert (@certs)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    33
{
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    34
    if ($cert =~ /Issuer: /)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    35
    {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    36
        $_ = $cert;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    37
        if ($cert =~ /personal-freemail/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    38
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    39
            $cert_alias = "thawtepersonalfreemailca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    40
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    41
        elsif ($cert =~ /personal-basic/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    42
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    43
            $cert_alias = "thawtepersonalbasicca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    44
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    45
        elsif ($cert =~ /personal-premium/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    46
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    47
            $cert_alias = "thawtepersonalpremiumca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    48
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    49
        elsif ($cert =~ /server-certs/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    50
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    51
            $cert_alias = "thawteserverca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    52
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    53
        elsif ($cert =~ /premium-server/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    54
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    55
            $cert_alias = "thawtepremiumserverca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    56
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    57
        elsif ($cert =~ /Class 1 Public Primary Certification Authority$/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    58
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    59
            $cert_alias = "verisignclass1ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    60
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    61
        elsif ($cert =~ /Class 1 Public Primary Certification Authority - G2/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    62
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    63
            $cert_alias = "verisignclass1g2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    64
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    65
        elsif ($cert =~
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    66
               /VeriSign Class 1 Public Primary Certification Authority - G3/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    67
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    68
            $cert_alias = "verisignclass1g3ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    69
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    70
        elsif ($cert =~ /Class 2 Public Primary Certification Authority$/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    71
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    72
            $cert_alias = "verisignclass2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    73
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    74
        elsif ($cert =~ /Class 2 Public Primary Certification Authority - G2/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    75
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    76
            $cert_alias = "verisignclass2g2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    77
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    78
        elsif ($cert =~
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    79
               /VeriSign Class 2 Public Primary Certification Authority - G3/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    80
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    81
            $cert_alias = "verisignclass2g3ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    82
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    83
        elsif ($cert =~ /Class 3 Public Primary Certification Authority$/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    84
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    85
            $cert_alias = "verisignclass3ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    86
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    87
        # Version 1 of Class 3 Public Primary Certification Authority
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    88
        # - G2 is added.  Version 3 is excluded.  See below.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    89
        elsif ($cert =~
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    90
               /VeriSign Class 3 Public Primary Certification Authority - G3/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    91
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    92
            $cert_alias = "verisignclass3g3ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    93
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    94
        elsif ($cert =~
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    95
               /RSA Data Security.*Secure Server Certification Authority/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    96
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    97
            $cert_alias = "verisignserverca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    98
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
    99
        elsif ($cert =~ /GTE CyberTrust Global Root/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   100
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   101
            $cert_alias = "gtecybertrustglobalca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   102
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   103
        elsif ($cert =~ /Baltimore CyberTrust Root/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   104
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   105
            $cert_alias = "baltimorecybertrustca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   106
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   107
        elsif ($cert =~ /www.entrust.net\/Client_CA_Info\/CPS/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   108
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   109
            $cert_alias = "entrustclientca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   110
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   111
        elsif ($cert =~ /www.entrust.net\/GCCA_CPS/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   112
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   113
            $cert_alias = "entrustglobalclientca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   114
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   115
        elsif ($cert =~ /www.entrust.net\/CPS_2048/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   116
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   117
            $cert_alias = "entrust2048ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   118
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   119
        elsif ($cert =~ /www.entrust.net\/CPS /)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   120
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   121
            $cert_alias = "entrustsslca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   122
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   123
        elsif ($cert =~ /www.entrust.net\/SSL_CPS/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   124
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   125
            $cert_alias = "entrustgsslca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   126
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   127
        elsif ($cert =~ /The Go Daddy Group/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   128
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   129
            $cert_alias = "godaddyclass2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   130
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   131
        elsif ($cert =~ /Starfield Class 2 Certification Authority/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   132
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   133
            $cert_alias = "starfieldclass2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   134
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   135
        elsif ($cert =~ /ValiCert Class 2 Policy Validation Authority/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   136
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   137
            $cert_alias = "valicertclass2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   138
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   139
        elsif ($cert =~ /GeoTrust Global CA$/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   140
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   141
            $cert_alias = "geotrustglobalca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   142
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   143
        elsif ($cert =~ /Equifax Secure Certificate Authority/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   144
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   145
            $cert_alias = "equifaxsecureca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   146
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   147
        elsif ($cert =~ /Equifax Secure eBusiness CA-1/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   148
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   149
            $cert_alias = "equifaxsecureebusinessca1";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   150
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   151
        elsif ($cert =~ /Equifax Secure eBusiness CA-2/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   152
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   153
            $cert_alias = "equifaxsecureebusinessca2";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   154
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   155
        elsif ($cert =~ /Equifax Secure Global eBusiness CA-1/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   156
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   157
            $cert_alias = "equifaxsecureglobalebusinessca1";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   158
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   159
        elsif ($cert =~ /Sonera Class1 CA/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   160
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   161
            $cert_alias = "soneraclass1ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   162
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   163
        elsif ($cert =~ /Sonera Class2 CA/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   164
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   165
            $cert_alias = "soneraclass2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   166
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   167
        elsif ($cert =~ /AAA Certificate Services/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   168
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   169
            $cert_alias = "comodoaaaca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   170
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   171
        elsif ($cert =~ /AddTrust Class 1 CA Root/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   172
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   173
            $cert_alias = "addtrustclass1ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   174
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   175
        elsif ($cert =~ /AddTrust External CA Root/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   176
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   177
            $cert_alias = "addtrustexternalca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   178
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   179
        elsif ($cert =~ /AddTrust Qualified CA Root/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   180
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   181
            $cert_alias = "addtrustqualifiedca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   182
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   183
        elsif ($cert =~ /UTN-USERFirst-Hardware/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   184
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   185
            $cert_alias = "utnuserfirsthardwareca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   186
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   187
        elsif ($cert =~ /UTN-USERFirst-Client Authentication and Email/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   188
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   189
            $cert_alias = "utnuserfirstclientauthemailca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   190
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   191
        elsif ($cert =~ /UTN - DATACorp SGC/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   192
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   193
            $cert_alias = "utndatacorpsgcca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   194
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   195
        elsif ($cert =~ /UTN-USERFirst-Object/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   196
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   197
            $cert_alias = "utnuserfirstobjectca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   198
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   199
        elsif ($cert =~ /America Online Root Certification Authority 1/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   200
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   201
            $cert_alias = "aolrootca1";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   202
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   203
        elsif ($cert =~ /DigiCert Assured ID Root CA/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   204
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   205
            $cert_alias = "digicertassuredidrootca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   206
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   207
        elsif ($cert =~ /DigiCert Global Root CA/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   208
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   209
            $cert_alias = "digicertglobalrootca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   210
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   211
        elsif ($cert =~ /DigiCert High Assurance EV Root CA/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   212
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   213
            $cert_alias = "digicerthighassuranceevrootca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   214
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   215
        elsif ($cert =~ /GlobalSign Root CA$/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   216
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   217
            $cert_alias = "globalsignca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   218
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   219
        elsif ($cert =~ /GlobalSign Root CA - R2/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   220
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   221
            $cert_alias = "globalsignr2ca";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   222
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   223
        elsif ($cert =~ /Elektronik.*Kas.*2005/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   224
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   225
            $cert_alias = "extra-elektronikkas2005";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   226
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   227
        elsif ($cert =~ /Elektronik/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   228
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   229
            $cert_alias = "extra-elektronik2005";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   230
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   231
        # Mozilla does not provide these certificates:
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   232
        #   baltimorecodesigningca
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   233
        #   gtecybertrust5ca
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   234
        #   trustcenterclass2caii
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   235
        #   trustcenterclass4caii
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   236
        #   trustcenteruniversalcai
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   237
        else
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   238
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   239
            # Generate an alias using the OU and CN attributes of the
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   240
            # Issuer field if both are present, otherwise use only the
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   241
            # CN attribute.  The Issuer field must have either the OU
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   242
            # or the CN attribute.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   243
            $_ = $cert;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   244
            if ($cert =~ /OU=/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   245
            {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   246
                s/Issuer:.*?OU=//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   247
                # Remove other occurrences of OU=.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   248
                s/OU=.*CN=//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   249
                # Remove CN= if there were not other occurrences of OU=.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   250
                s/CN=//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   251
                s/\/emailAddress.*//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   252
                s/Certificate Authority/ca/g;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   253
                s/Certification Authority/ca/g;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   254
            }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   255
            elsif ($cert =~ /CN=/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   256
            {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   257
                s/Issuer:.*CN=//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   258
                s/\/emailAddress.*//;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   259
                s/Certificate Authority/ca/g;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   260
                s/Certification Authority/ca/g;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   261
            }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   262
            s/\W//g;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   263
            tr/A-Z/a-z/;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   264
            $cert_alias = "extra-$_";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   265
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   266
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   267
        while (-e "$cert_alias.pem")
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   268
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   269
            $cert_alias = "$cert_alias" . "_";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   270
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   271
    }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   272
    # When it attempts to parse:
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   273
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   274
    # Class 3 Public Primary Certification Authority - G2, Version 3
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   275
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   276
    # keytool says:
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   277
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   278
    # #2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   279
    # Unparseable AuthorityInfoAccess extension due to
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   280
    # java.io.IOException: Invalid encoding of URI
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   281
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   282
    # If we do not exclude this file
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   283
    # openjdk/jdk/test/lib/security/cacerts/VerifyCACerts.java fails
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   284
    # on this cert, printing:
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   285
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   286
    # Couldn't verify: java.security.SignatureException: Signature
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   287
    # does not match.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   288
    #
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   289
    elsif ($cert =~
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   290
           /A6:0F:34:C8:62:6C:81:F6:8B:F7:7D:A9:F6:67:58:8A:90:3F:7D:36/)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   291
    {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   292
        $write_current_cert = 0;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   293
        $pem_file_count--;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   294
    }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   295
    elsif ($cert eq "-----BEGIN CERTIFICATE-----\n")
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   296
    {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   297
        if ($in_cert_block != 0)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   298
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   299
            die "$file is malformed.";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   300
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   301
        $in_cert_block = 1;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   302
        if ($write_current_cert == 1)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   303
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   304
            $pem_file_count++;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   305
            if (-e "$cert_alias.pem")
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   306
            {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   307
                print "$cert_alias";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   308
                die "already exists"
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   309
            }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   310
            open(PEM, ">$cert_alias.pem");
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   311
            print PEM $cert;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   312
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   313
    }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   314
    elsif ($cert eq "-----END CERTIFICATE-----\n")
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   315
    {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   316
        $in_cert_block = 0;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   317
        if ($write_current_cert == 1)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   318
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   319
            print PEM $cert;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   320
            close(PEM);
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   321
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   322
        $write_current_cert = 1
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   323
    }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   324
    else
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   325
    {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   326
        if ($in_cert_block == 1 && $write_current_cert == 1)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   327
        {
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   328
            print PEM $cert;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   329
        }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   330
    }
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   331
}
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   332
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   333
# Check that the correct number of .pem files were produced.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   334
@pem_files = <*.pem>;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   335
if (@pem_files != $pem_file_count)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   336
{
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   337
    print "$pem_file_count";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   338
    die "Number of .pem files produced does not match".
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   339
        " number of certs read from $file.";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   340
}
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   341
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   342
# Now store each cert in the 'cacerts' file using keytool.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   343
$certs_written_count = 0;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   344
foreach $pem_file (@pem_files)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   345
{
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   346
    system "$ARGV[0] -noprompt -import".
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   347
        " -alias `basename $pem_file .pem`".
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   348
        " -keystore cacerts -storepass 'changeit' -file $pem_file";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   349
    unlink($pem_file);
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   350
    $certs_written_count++;
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   351
}
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   352
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   353
# Check that the correct number of certs were added to the keystore.
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   354
if ($certs_written_count != $pem_file_count)
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   355
{
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   356
    die "Number of certs added to keystore does not match".
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   357
        " number of certs read from $file.";
27c2a6303f2f Add ebuild for icedtea which can build on hardened system with XATTRS_PAX
Da Risk <da_risk@geekorum.com>
parents:
diff changeset
   358
}