$value) {
if ($key !== "count") {
$entries[] = explode(":", $value);
}
}
if (isset($_GET["file"])) {
$basecert = $vardir . "/userkeys/" . $ldap_user;
if (!file_exists($basecert . ".cert.pem")) {
exec("taskserver-user-certs $ldap_user");
}
$certificate = file_get_contents($basecert . ".cert.pem");
$cert_key = file_get_contents($basecert . ".key.pem");
$server_cert = file_get_contents($vardir . "/keys/server.cert");
$file = $_GET["file"];
switch($file) {
case "ca.cert.pem":
$content = $server_cert;
$name = "ca.cert.pem";
$type = "application/x-x509-ca-cert";
break;
case "cert.pem":
$content = $certificate;
$name = $ldap_user . ".cert.pem";
$type = "application/x-x509-ca-cert";
break;
case "key.pem":
$content = $cert_key;
$name = $ldap_user . ".key.pem";
$type = "application/x-x509-ca-cert";
break;
case "mirakel";
foreach ($entries as $entry) {
list($org, $user, $key) = $entry;
if ($key == $_GET["key"]) { break; }
}
$name = $user . ".mirakel";
$type = "text/plain";
$content = "username: $user
org: $org
user key: $key
server: $host
client.cert:
$certificate
Client.key:
$cert_key
ca.cert:
$server_cert
";
break;
default:
die("invalid file name");
break;
}
header("Content-Type: $type");
header('Content-Disposition: attachment; filename="' . $name . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
header('Cache-Control: private');
header('Pragma: private');
echo $content;
exit;
}
?>
taskd.certificate=/path/to/.cert.pem taskd.key=/path/to/.key.pem taskd.server= 1) { echo "# Chose one of them\n"; foreach($entries as $entry) { list($org, $user, $key) = $entry; echo "# taskd.credentials=$org/$user/$key\n"; } } else { ?> taskd.credentials=// taskd.ca=/path/to/ca.cert.pemFor Mirakel, download and import the file: