From 772c4b577b35fce621e0d8db1206ca8e07dee723 Mon Sep 17 00:00:00 2001 From: Wytze van der Raay Date: Wed, 9 Apr 2014 08:47:26 +0000 Subject: [PATCH] Add script for sending out notification about OpenSSL Heartbleed bug, per arbitration ruling a20140408.1 and https://bugs.cacert.org/view.php?id=1265 --- scripts/send_heartbleed.php | 248 ++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 scripts/send_heartbleed.php diff --git a/scripts/send_heartbleed.php b/scripts/send_heartbleed.php new file mode 100644 index 0000000..6bf0f5f --- /dev/null +++ b/scripts/send_heartbleed.php @@ -0,0 +1,248 @@ +#!/usr/bin/php -q + '$lastid' + and a.`memid` = u.`id` + and a.`general` = 1 + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `domains` as d, `domaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`domid` = d.`id` and d.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `domains` as d, `domlink` as dl, `domaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`id` = dl.`certid` and dl.`domid` = d.`id` and d.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `org` as o, `orgdomaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`orgid` = o.`orgid` and o.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `org` as o, `orgdomains` as d, `orgdomlink` as dl, `orgdomaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`id` = dl.`orgcertid` and dl.`orgdomid` = d.`id` + and d.`orgid` = o.`orgid` and o.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + order by `id`"; + +$res = mysql_query($query); + +while($row = mysql_fetch_assoc($res)) +{ + $mailtxt = "Dear ${row["fname"]} ${row["lname"]},\n".$lines_EN."\n\n"; + switch ($row["language"]) + { + case "de_DE": + case "de": + $mailtxt .= $lines_DE; + break; + } + + sendmail($row['email'], "[CAcert.org] Information about Heartbleed bug in OpenSSL 1.0.1 up to 1.0.1f", $mailtxt, "support@cacert.org", "", "", "CAcert", "returns@cacert.org", ""); + + $fp = fopen("send_heartbleed_lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + + $count++; + echo "Sent ${count}th mail. User ID: ${row["id"]}\n"; + + sleep (1); +}