Example #1
0
<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>
    <td class="deployment">

      <?php 
    echo "{$output}\n";
    ?>

    </td>
  </tr>
Example #2
0
    start_left_pane();
    display_menu();
    end_left_pane();
    start_right_pane();
    // we're looking for accounts that have the requested keyring....
    $result = mysql_query("SELECT * FROM `hak` where `id_keyring` = '{$id_keyring}' ORDER BY `id_host`") or die(mysql_error() . "<br>Couldn't execute query: {$query}");
    $nr = mysql_num_rows($result);
    if (empty($nr)) {
        echo "<fieldset><legend>Error</legend>This keyring does not seem to be in use...</fieldset>\n";
    } else {
        echo "<fieldset><legend>Deploying keyring {$keyring_name}</legend>\n";
        while ($row = mysql_fetch_array($result)) {
            // Afecting values
            $id_host = $row["id_host"];
            $id_account = $row["id_account"];
            $hostname = get_host_name($id_host);
            $account_name = get_account_name($id_account);
            echo "<fieldset><legend>Processing account {$account_name} on host {$hostname}</legend>\n";
            $output = prepare_authorizedkey_file($id_host, $id_account);
            //echo("prepare_authorizedkey_file($id_host,$id_account)");
            echo "<table class='detail'><tr><td class='deployment'>{$output}</td></tr></table>\n";
            $output = deploy_authorizedkey_file($id_host, $id_account);
            //echo("deploy_authorizedkey_file($id_host,$id_account)");
            echo "<table class='detail'><tr><td class='deployment'>{$output}</td></tr></table></fieldset>\n";
        }
        echo "</fieldset>\n";
    }
    end_right_pane();
    end_main_frame();
    ?>
Example #3
0
<?php

include "common.php";
include "database.php";
include "credentials.php";
$type = sql_string($_REQUEST['type']);
$name = sql_string($_REQUEST['name']);
$email = sql_string($_REQUEST['email']);
$country = sql_string($_REQUEST['country']);
$text = sql_string($_REQUEST['text']);
$version = sql_string($_REQUEST['version']);
$platform = sql_string($_REQUEST['platform']);
$host = sql_string(get_host_name());
$tmpfile = $_FILES['attachment']['tmp_name'];
$filename = $_FILES['attachment']['name'];
switch ($type) {
    case sql_string($TYPE_NEGATIVE_FEEDBACK):
        $typename = "Feedback :(";
        break;
    case sql_string($TYPE_POSITIVE_FEEDBACK):
        $typename = "Feedback :)";
        break;
    case sql_string($TYPE_NEUTRAL_FEEDBACK):
        $typename = "Feedback :|";
        break;
    case sql_string($TYPE_BUG_REPORT):
        $typename = "Bug report";
        break;
    case sql_string($TYPE_FEATURE_REQUEST):
        $typename = "Feature request";
        break;
Example #4
0
         }
         //bind service
         $lb_weight = '';
         update_instance_lb_weight($pdo, $instance_id, $lb_weight);
         add_instance_into_service($pdo, $instance_id, $service_id, $username);
         $instance_list = get_instance_list_complex($pdo, array('service_id' => $service_id));
     }
     $template = 'service_done';
     //msg_redirect('service_detail.php?service_id='.$service_id);
     break;
 case 'change_mode':
     //service.php?action=change_mode&service_id=$service_id
     $service_id = $params['service_id'];
     $username = check_login($req_url);
     $service_info = pdo_get_service_byid($pdo, $service_id);
     $zk_host = get_host_name($pdo, $cfg['zk_host_id']);
     if ($zk_host && $service_info) {
         if ($service_info['zk']) {
             $zk = '';
         } else {
             $zk = $zk_host . ":10" . $service_id;
         }
         set_mode($pdo, $service_id, $zk);
         if ($zk) {
             insert_action_queue_new($pdo, CREATE_ZK, $service_id, $cfg['zk_host_id'], $username);
         }
     }
     $service_list = get_service_list($pdo);
     $template = 'service';
     break;
 default:
Example #5
0
</HEAD>
<BODY>

<?php 
        start_main_frame();
        start_left_pane();
        display_menu();
        end_left_pane();
        start_right_pane();
        ?>

    <fieldset><legend>Deploying <?php 
        print get_gfile_name($id);
        ?>
 on host <?php 
        print get_host_name($host);
        ?>
</legend>
       <?php 
        echo deploy_globalfile($id, $host);
        ?>
    </fieldset>

<?php 
        end_right_pane();
        end_main_frame();
        ?>


</body>
</html>
Example #6
0
function deploy_globalfile($id_file, $id_host)
{
    $hostname = get_host_name($id_host);
    $hostip = get_host_ip($id_host);
    $gfiles = mysql_query("SELECT * FROM `globalfiles` WHERE `id` = '{$id_file}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}");
    $nr_gbfiles = mysql_num_rows($gfiles);
    if (!empty($nr_gbfiles)) {
        // Preparing file,path, etc...
        $gfilerow = mysql_fetch_array($gfiles);
        $path = $gfilerow['path'];
        $name = $gfilerow['name'];
        //$filecontents=$gfilerow['text'];
        $localfile = $gfilerow['localfile'];
        $now = date("Ymd-His");
        // Testing connectivity...
        if (test_connection($hostname) != "OK") {
            $message .= "<img src='images/error.gif'>Connection failed. Please see output below.<br>\n";
            return $message;
        } else {
            $message .= "<img src='images/ok.gif'>SSH connection is OK.<br>\n";
        }
        // Testing presence of file
        if (test_presence($hostname, $path / $name) == 1) {
            $message .= "<img src='images/warning.gif'>{$path}/{$name} was not found...<br>\n";
        } else {
            // File is present, we try to back it up
            // Archiving current file
            $output = shell_exec("ssh " . $GLOBALS['sudousr'] . "@{$hostname} cp {$path}/{$name} {$path}/{$name}.{$now} 2>&1");
            if (empty($output)) {
                // Archiving is OK
                $message .= "<img src='images/ok.gif'>{$path}/{$name} has been backup successfully.<br>\n";
            } else {
                $message .= "<img src='images/error.gif'>{$path}/{$name} could not be backed up.<br>\n";
                return $message;
            }
        }
        // Deploying
        $output = shell_exec("scp {$localfile} " . $GLOBALS['sudousr'] . "@{$hostname}:{$path}/{$name} 2>&1");
        if (empty($output)) {
            // File was correctly transfered
            $message .= "<img src='images/ok.gif'>{$path}/{$name} was correctly updated.<br>\n";
            $output = shell_exec("ssh " . $GLOBALS['sudousr'] . "@{$hostname} chmod 440 {$path}/{$name} 2>&1");
            if (empty($output)) {
                $message .= "<img src='images/ok.gif'>Permission changed successfully to 440 for file {$path}/{$name}.<br>\n";
            } else {
                $message .= "<img src='images/error.gif'>Could not change permission to 440 for file {$path}/{$name}.<br>\n";
            }
        } else {
            $message .= "<img src='images/error.gif'>An error occured during the update.<br>\n";
        }
    } else {
        $message .= "<img src='images/error.gif'>No global file found with id {$id}<br>\n";
    }
    return $message;
}