} echo "{$tag_list}"; echo "</br>\n"; echo "</fieldset>"; // -------------- Deployment Identity --------------- echo "<fieldset><legend>Deployment Information</legend>"; $query_identity = "SELECT * FROM `hosts-identities` where `id_host` like '{$id}' "; $result_identity = mysql_query($query_identity) or die(mysql_error() . "<br>Couldn't execute query: {$query_identity}"); $nridentity = mysql_num_rows($result_identity); if (empty($nridentity)) { echo "<img src=\"images/error.gif\"> No identity account for deployment associated with this host. <a href=\"identities_hosts.php?hostgroup={$hostgroup}&id={$id}\">Please add one now</a> "; } else { $row_identity = mysql_fetch_array($result_identity); // Afecting values $id_identities = $row_identity["id_identities"]; $name_identity = get_identity_name($id_identities); echo "SSH key on this host will be deployed using identity : {$name_identity} [ <a href=\"identities_hosts.php?hostgroup={$hostgroup}&id={$id}\">change</a> ]"; mysql_free_result($result_identity); } echo "</fieldset>"; // -------------- Account management --------------- echo "<fieldset><legend>SSH Key Management</legend>"; echo "<table class='displayaccount'>\n"; echo "<tr><td class=displayaccount><a href=\"ha_setup.php?id={$id}&host_name={$name}&hostgroup={$groupname}\"><img src=\"images/mister_add.png\"><br>Add an account</td>"; // looking for accounts // -------------------- $accounts = mysql_query("SELECT * FROM `hosts-accounts` WHERE `id_host` = '{$id}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_accounts = mysql_num_rows($accounts); $currentnum = 2; // 2 not 1 because we display Add an Account on first line while ($keyrow = mysql_fetch_array($accounts)) {
<body> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"host-view.php?id={$id}&hostgroup={$hostgroup}\"> {$hostname} </a> > <a href=\"account-view.php?id={$id}&hostgroup={$hostgroup}&id_account={$id_account}\">{$account_name} </a> > Deployment "); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <?php // ------------------- Deployment ------------------ echo "<fieldset><legend>Deploying securities for {$account_name} on host {$hostname} using identity {$identity_name}</legend>\n"; // ------------------- Prepare idendity file for this deployment ------------------ $id_identity = get_identity_id($id); $identity_name = get_identity_name($id_identity); $query = "SELECT * FROM `identities` WHERE `id` = '{$id_identity}' "; $result = mysql_query($query) or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $row_identity = mysql_fetch_array($result); $handle = fopen("/tmp/{$identity_name}-id", "w"); if (!fputs($handle, $row_identity["identity_file"])) { echo "<fieldset class=cmderror><legend class=cmderror>Preparing private key used for deployment : ERROR</legend>"; echo "Could not write private key of {$identity_name} from mysql to local file /tmp/{$identity_name}-id.<br>"; echo "Please check if /tmp/{$identity_name}-id can be created"; echo "</fieldset>"; die(""); } else { display_command_output("Writing private key from mysql to /tmp/{$identity_name}-id", 0, "/tmp/{$identity_name}-id created successfully", "", "error"); } fclose($handle); $output = array();