$id = $_GET['id']; $id_account = $_GET['id_account']; $id_hostgroup = $_GET['id_hostgroup']; if (!empty($id) and !empty($id_account)) { ?> <html> <head> <title>Deployment process</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php start_main_frame(); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <?php $hostname = get_host_name($id); $account_name = get_account_name($id_account); echo "<fieldset><legend>Constructing securities for {$account_name} on host {$hostname}</legend>\n"; $output = prepare_authorizedkey_file($id, $id_account); ?> <table class="detail"> <tr>
} else { $name = ""; $key = ""; } ?> <html> <HEAD> <TITLE>Key Setup</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> <script src="/skm/jquery.min.js"></script> </HEAD> <body onload="page_loaded()"> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Adding keys"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <form name="setup_key" action="keys_setup.php" onsubmit="return validate_form()" method="post"> <fieldset><legend>Add / Modify a key</legend> <h5>SSH Key Description (owner)</h5> <input name="name" id="Desc" size="50" type="text" maxlength="255" value="<?php echo "{$name}"; ?> "><br> <h5>Paste the ssh public key here :</h5> <textarea name="key" id="Key" cols="80" rows="10" style="resize:none" onkeyup="clean_ssh_key()"><?php
<html> <HEAD> <TITLE>Hosts - accounts - Key Association</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </HEAD> <BODY> <?php $name_account = get_account_name($id_account); $name = get_host_name($id); ?> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"hosts-view.php?hostgroup={$hostgroup}\">{$hostgroup}</a> > <a href=\"host-view.php?id={$id}&hostgroup={$hostgroup}\"> {$name} </a> > <a href=\"account-view.php?id={$id}&hostgroup={$hostgroup}&id_account={$id_account}\">{$name_account} </a> > Add Key"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <center> <form name="setup_hak" action="hakk_setup.php" method="post"> <fieldset><legend>Adding key(s) to account <?php echo "{$account_name}"; ?> on host <?php echo "{$host_name}"; ?> </legend>
$hostname = "%"; } else { $hostname = $_POST["hostname"] . '%'; } ?> <html> <head> <title>SKM - Display Host list</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> <script src="sorttable.js"></script> </head> <body> <?php start_main_frame("<a href=\"hosts-view.php\"> SKM </a> > {$hostgroup}"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <!-- <form name="hostnameSearch" action="hosts-view.php" method="post"> hostname : <input name="hostname" type="text" value="<?php echo "{$hostname}"; ?> " > <input name="submit" type="submit" value="Search"> </form> -->
} else { $action = ""; } if (empty($id) and empty($action)) { ?> <html> <head> <title>Keyring list</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Manage Keyrings"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <fieldset><legend>Keyring List <a href="keyrings_setup.php">[create a new keyring |</a><a href="keyrings.php?action=expandall">Expand all |</a><a href="keyrings.php?action=collapseall">Collapse all ]</a></legend> <table class='detail'> <?php $result = mysql_query("SELECT * FROM `keyrings` ORDER BY `name`") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result); if (empty($nr)) { echo "<tr><td class='detail1'>No keyring defined</td></tr>\n";
if ($row['ostype'] == "Solaris") { $icon = "images/icon-solaris.gif"; } if ($row['ostype'] == "Windows") { $icon = "images/icon-windows.gif"; } if ($row['ostype'] == "FreeBSD") { $icon = "images/icon-freebsd.gif"; } $ostype = $row['ostype']; $osvers = $row['osvers']; $model = $row['model']; $po = $row['vendor']; $serialno = $row['serialno']; $groupname = $row['Environment']; start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > {$name}"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); // -------------- Host details --------------- echo "<fieldset><legend>Host Details [ <a href='hosts_setup.php?id={$id}&hostgroup={$groupname}'>edit details</a> ] [ <a href='host-view.php?id={$id}&action=delete&hostgroup={$groupname}'>delete {$name}</a> ]</legend>"; echo "<table class=detail>"; echo "<tr><th>OS Type</th><th>OS Version</th><th>Vendor</th><th>Model</th><th>Serial No</th></tr>"; echo "\t<tr><td><img src='{$icon}' border='0'> {$ostype}</td><td>{$osvers}</td><td>{$po}</td><td>{$model}</td><td>{$serialno}</td></tr>\n"; echo "</table>\n"; echo "</fieldset>"; echo "<fieldset><legend>Tags [ <a href='tags_hosts.php?id={$id}&hostgroup={$groupname}'>edit tags</a> ]</legend>"; $query_tags = "SELECT * FROM `hosts-tags` where `id-hosts` = '{$id}' "; $result_tags = mysql_query($query_tags) or die(mysql_error() . "<br>Couldn't execute query: {$query_tags}"); $tag_list = "";
} else { $step = ""; } if ($step != 1) { ?> <html> <head> <title>SKM - Associate Identity to host</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php $name = get_host_name($id); start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"host-view.php?hostgroup={$hostgroup}&id={$id}\">{$name}</a> > Associate identities"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); // -------------- Host details --------------- echo "<fieldset><legend>Identities</legend>"; //Display the selection box for the groups $result = mysql_query("SELECT * FROM `identities` ORDER BY `name` ") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result); if (empty($nr)) { echo 'No identities found... Please create one.'; } else { echo '<form name="setup_identities_association" action="identities_hosts.php" method="post">'; echo '<select class="list" name="id_identities">'; echo '<option selected value="1">Please select an identity</option>';
$firstname = $row["firstname"]; $lastname = $row["lastname"]; echo "{$login}\n"; } ?> <html> <HEAD> <TITLE>Add Modify skmadmins</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </HEAD> <BODY> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Add/Modify Admins"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <center> <form name="skmadmins_setup" action="skmadmins_setup.php" method="post"> <fieldset><legend>Add / Modify SKM admin account</legend> <table border='0' align='center' class="TypeContent"> <tr> <td class="Type">First name : </td> <td class="Content" width="80%"> <input name="firstname" size="50" type="text" maxlength="255" value="<?php echo "{$firstname}";
} else { $id = ""; } if (empty($id)) { ?> <html> <head> <title>Identity Accounts List</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Identity Accounts"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <fieldset><legend>Identities <a href="identities_setup.php">[create a new identity]<img src='images/add.gif' border='0'></a></legend> <table class='detail'> <?php $result = mysql_query("SELECT * FROM `identities` ORDER BY `name`") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result); if (empty($nr)) { echo "<tr><td class='detail1'>No Identity Account found</td><td class='detail2'></td></tr>\n";
$name = $row["name"]; $identity_file = $row["identity_file"]; echo "{$name}\n"; } ?> <html> <HEAD> <TITLE>Add Modify Identities</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </HEAD> <BODY> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Add/Modify Identities"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <center> <form name="identities_setup" action="identities_setup.php" enctype="multipart/form-data" method="post"> <fieldset><legend>Add / Modify an identity account</legend> <table border='0' align='center' class="modif_contact"> <tr> <td class="Type">Identity Name : </td> <td class="Content" width="80%"> <input name="name" size="50" type="text" maxlength="255" value="<?php echo "{$name}";
} else { $step = ""; } if ($step != 1) { ?> <html> <head> <title>SKM - Assign tags to host</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php $hostname = get_host_name($id); start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"host-view.php?hostgroup={$hostgroup}&id={$id}\">{$hostname}</a> > Assign tags"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); // -------------- Host details --------------- echo "<fieldset><legend>Currently assigned tags</legend>"; // We list current assigned tags $result_tags = mysql_query("SELECT * FROM `hosts-tags` where `id-hosts` like '{$id}' ") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result_tags); if (!empty($nr)) { echo "<table class=detail>"; echo "<tr><th>Tag name</th><th>actions</th></tr>"; while ($row_tag = mysql_fetch_array($result_tags)) { echo "<tr><td>" . get_tag_name($row_tag['id-tags']) . "</td><td><a href=\"tags_hosts_remove.php?id=" . $id . "&hostgroup=" . $hostgroup . "&tag_id=" . $row_tag['id-tags'] . "\"> [delete]</a></TD></TR>"; }
$hostname = "%"; } else { $hostname = $_POST["hostname"] . '%'; } ?> <html> <head> <title>SKM - Display Host list</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> <script src="sorttable.js"></script> </head> <body> <?php start_main_frame("<a href=\"hosts-view-tags.php\"> SKM </a> > {$tag}"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <!-- <form name="hostnameSearch" action="hosts-view.php" method="post"> hostname : <input name="hostname" type="text" value="<?php echo "{$hostname}"; ?> " > <input name="submit" type="submit" value="Search"> </form> -->
$action = ""; } if (empty($action)) { ?> <html> <head> <title>SKM - Display Account - Key</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php $name_account = get_account_name($id_account); $name = get_host_name($id); start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > <a href=\"host-view.php?id={$id}&hostgroup={$groupname}\"> {$name} </a> > {$name_account}"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); echo "<fieldset><legend><img src=\"images/mister.png\">{$name_account} [ <a href=\"hak_setup.php?id={$id}&host_name={$name}&id_account={$id_account}&account_name={$name_account}&hostgroup={$groupname}\"> add a keyring | </a><a href=\"hakk_setup.php?id={$id}&host_name={$name}&id_account={$id_account}&account_name={$name_account}&hostgroup={$groupname}\">add a key | </a><a href=\"deploy_account.php?id={$id}&id_account={$id_account}&hostgroup={$groupname}\">Deploy |</a><a href=\"view_aut_account.php?id={$id}&id_account={$id_account}&hostgroup={$groupname}\"> View Auth </a> | <a href='host-view.php?id={$id}&id_account={$id_account}&action=deleteAccount&hostgroup={$groupname}'> Delete ]</a></legend>"; // looking for keyrings and keys //------------------------------ $keyrings = mysql_query("SELECT * FROM `hak` WHERE `id_host` = '{$id}' and `id_account` ='{$id_account}' and `id_keyring` != '0' ") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keyrings = mysql_num_rows($keyrings); $keys = mysql_query("SELECT * FROM `hak` WHERE `id_host` = '{$id}' and `id_account` ='{$id_account}' and `id_key` != '0' ") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr_keys = mysql_num_rows($keys); echo "<table class=\"detail\"><tr>"; // if no key nor keyring found if (empty($nr_keys) and empty($nr_keyrings)) { echo "<tr><td class='detail1'>No keys or keyrings associated</td></tr>\n";
if (isset($_GET["action"])) { $action = $_GET["action"]; } else { $action = ""; } ?> <html> <HEAD> <TITLE>All Hosts Overview</TITLE> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </HEAD> <BODY> <?php start_main_frame("SKM > All hosts view"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); //print("<center><fieldset><legend>All Hosts Overview</legend>"); $result = mysql_query("SELECT * FROM `hosts` ORDER BY `name`") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result); if (empty($nr)) { echo "No hosts found ...\n"; } else { ?> <table class=detail> <?php echo "<thead><tr><th>icon</th><th>Hostname</th><th>Environment</th><th>Serial #</th><th>OS type</th><th>OS Version</th><th>Vendor</th><th>Model</th></tr></thead>";
} else { $id = ""; } if (empty($id)) { ?> <html> <head> <title>Accounts List</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <body> <?php start_main_frame("<a href=\"show_all_hosts.php\"> SKM </a> > Unix Accounts"); start_left_pane(); display_menu(); end_left_pane(); start_right_pane(); ?> <fieldset><legend>Accounts <a href="accounts_setup.php">[create a new account]<img src='images/add.gif' border='0'></a></legend> <table class='detail'> <?php $result = mysql_query("SELECT * FROM `accounts` ORDER BY `UID`") or die(mysql_error() . "<br>Couldn't execute query: {$query}"); $nr = mysql_num_rows($result); if (empty($nr)) { echo "<tr><td class='detail1'>No Account found</td><td class='detail2'></td></tr>\n";
} if (!empty($ip)) { $hostname = $ip; } ?> <html> <head> <title>Deployment process</title> <LINK REL=STYLESHEET HREF="skm.css" TYPE="text/css"> </head> <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);