summaryrefslogtreecommitdiff
path: root/scripts/mail-weak-keys.php
blob: c85aec889a804d63588b3ed16591f2ba9cf012c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/php -q
<?	# Companion script to DumpWeakCerts.pl, takes output and sends a mail to each owner of a weak cert

	function SendServerCertMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date) {
		$mail_text =
"Dear $owner_name,

CAcert recently became aware that some of the certificates signed by CAcert pose a security
risk because they are backed by private keys that are vulnerable to attack.

The security issues identified are:
Private keys with a small key size. These keys are vulnerable to brute force attack.
Private keys with an unsafe exponent. These keys are vulnerable to some specialised attacks.
Private keys generated by a compromised version of OpenSSL distributed by Debian.

You received this email because a certificate issued to you is vulnerable:

Server Certificate, Serial $cert_serial, expiring $cert_expire, CN $cert_CN

To rectify the problem CAcert will revoke all vulnerable certificates (including yours) on $action_date.
CAcert will no longer accept vulnerable certificate requests for signing. In future all Certificate
Signing Requests must be backed by private keys with a key length at least 2048 bits and no other known vulnerabilities.

You should submit a new Certificate Signing Request of acceptable strength as soon as possible
and replace your existing certificate.

If you are interested in background information on this change please refer to this document:
http://csrc.nist.gov/publications/nistpubs/800-78-3/sp800-78-3.pdf

Kind regards
CAcert Suport Team
";
		mail($cert_email, "[CAcert.org]CAcert Server Certificate - Urgent Action Required", $mail_text, "From: CAcert Support <support@cacert.org>\nReply-To: returns@cacert.org");
	}

	function SendClientMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date) {
		$mail_text =
"Dear $owner_name,

CAcert recently became aware that some of the certificates signed by CAcert pose a security
risk because they are backed by private keys that are vulnerable to attack.

The security issues identified are:
Private keys with a small key size. These keys are vulnerable to brute force attack.
Private keys with an unsafe exponent. These keys are vulnerable to some specialised attacks.
Private keys generated by a compromised version of OpenSSL distributed by Debian.

You received this email because a certificate issued to you is vulnerable:

Client Certificate, Serial $cert_serial, expiring $cert_expire, CN $cert_CN

To rectify the problem CAcert will revoke all vulnerable certificates (including yours) on $action_date.
CAcert will no longer accept vulnerable certificate requests for signing. In future all
client certificates must be backed by private keys with a key length at least 1024 bits
and no other known vulnerabilities.

This means that you should replace your current certificate with a new one of acceptable strength.
If you use Firefox or Chrome, select 'Keysize: High Grade' before 'Create Certificate Request'.
If you use Internet Explorer, select 'Microsoft Strong Cryptographic Provider'. If you select an
option that generates a weak key (eg 'Microsoft Base Cryptographic Provider v1.0') your certificate
request will be rejected.

Kind regards
CAcert Suport Team
";
		mail($cert_email, "[CAcert.org]CAcert Client Certificate - Urgent Action Required", $mail_text, "From: CAcert Support <support@cacert.org>\nReply-To: returns@cacert.org");
	}

	function SendOrgServerCertMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date) {
		$mail_text =
"Dear $owner_name,

CAcert recently became aware that some of the certificates signed by CAcert pose a security
risk because they are backed by private keys that are vulnerable to attack.

The security issues identified are:
Private keys with a small key size. These keys are vulnerable to brute force attack.
Private keys with an unsafe exponent. These keys are vulnerable to some specialised attacks.
Private keys generated by a compromised version of OpenSSL distributed by Debian.

You received this email because a certificate issued to you is vulnerable:

Organisation Server Certificate, Serial $cert_serial, expiring $cert_expire, CN $cert_CN

To rectify the problem CAcert will revoke all vulnerable certificates (including yours) on $action_date.
CAcert will no longer accept vulnerable certificate requests for signing. In future all Certificate
Signing Requests must be backed by private keys with a key length at least 2048 bits and no other known vulnerabilities.

You should submit a new Certificate Signing Request of acceptable strength as soon as possible
and replace your existing certificate.

If you are interested in background information on this change please refer to this document:
http://csrc.nist.gov/publications/nistpubs/800-78-3/sp800-78-3.pdf

Kind regards
CAcert Suport Team
";
		mail($cert_email, "[CAcert.org]CAcert Organisation Server Certificate - Urgent Action Required", $mail_text, "From: CAcert Support <support@cacert.org>\nReply-To: returns@cacert.org");
	}

	function SendOrgClientMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date) {
		$mail_text =
"Dear $owner_name,

CAcert recently became aware that some of the certificates signed by CAcert pose a security
risk because they are backed by private keys that are vulnerable to attack.

The security issues identified are:
Private keys with a small key size. These keys are vulnerable to brute force attack.
Private keys with an unsafe exponent. These keys are vulnerable to some specialised attacks.
Private keys generated by a compromised version of OpenSSL distributed by Debian.

You received this email because a certificate issued to you is vulnerable:

Organisation Client Certificate, Serial $cert_serial, expiring $cert_expire, CN $cert_CN

To rectify the problem CAcert will revoke all vulnerable certificates (including yours) on $action_date.
CAcert will no longer accept vulnerable certificate requests for signing. In future all
client certificates must be backed by private keys with a key length at least 1024 bits
and no other known vulnerabilities.

This means that you should replace your current certificate with a new one of acceptable strength.
If you use Firefox or Chrome, select 'Keysize: High Grade' before 'Create Certificate Request'.
If you use Internet Explorer, select 'Microsoft Strong Cryptographic Provider'. If you select an
option that generates a weak key (eg 'Microsoft Base Cryptographic Provider v1.0') your certificate
request will be rejected.

Kind regards
CAcert Suport Team
";
		mail($cert_email, "[CAcert.org]CAcert Organisation Client Certificate - Urgent Action Required", $mail_text, "From: CAcert Support <support@cacert.org>\nReply-To: returns@cacert.org");
	}

  # Main

  $num_domain = 0;
  $num_client = 0;
  $num_orgdomain = 0;
  $num_orgclient = 0;
	$action_date = '2011-07-15';
	$in = fopen("php://stdin", "r");
	while($in_string = rtrim(fgets($in, 255))) {
		list($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial) = explode("\t", $in_string);

    if ($cert_type == "DomainCert") {
			SendServerCertMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date);
			$num_domain++;
		} else if ($cert_type == "EmailCert") {
			SendClientMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date);
			$num_client++;
    } else if ($cert_type == "OrgServerCert") {
			SendOrgServerCertMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date);
			$num_orgdomain++;
    } else if ($cert_type == "OrgEmailCert") {
			SendOrgClientMail($cert_type, $cert_email, $owner_name, $cert_expire, $cert_CN, $reason, $cert_serial, $action_date);
			$num_orgclient++;
    }
	}
	fclose($in);
	echo "Mails sent: $num_domain server certs, $num_client client certs, $num_orgdomain Org server certs, $num_orgclient Org client certs.\n";
?>