예제 #1
0
$validation_errors = validate_form_fields('POST', $validate);
//Database connection
$db = new ossim_db();
$conn = $db->connect();
if (empty($validation_errors)) {
    //Extra validations
    try {
        if (Asset_host::is_in_db($conn, $asset_id) == FALSE) {
            $e_msg = _('Unable to deploy HIDS agent. This asset no longer exists in the asset inventory. Please check with your system admin for more information');
            Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
        }
        $asset = new Asset_host($conn, $asset_id);
        $asset->load_from_db($conn);
        //Check asset context
        $ext_ctxs = Session::get_external_ctxs($conn);
        $ctx = $asset->get_ctx();
        if (!empty($ext_ctxs[$ctx])) {
            $e_msg = _('Asset can only be deployed at this USM');
            //Server related to CTX
            $server_obj = Server::get_server_by_ctx($conn, $ctx);
            if ($server_obj) {
                $s_name = $server_obj->get_name();
                $s_ip = $server_obj->get_ip();
                $server = $s_name . ' (' . $s_ip . ')';
                $e_msg = sprintf(_("Unable to deploy agent to assets on a child server. Please login to %s to deploy the HIDS agents"), $server);
            }
            Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
        }
    } catch (Exception $e) {
        $validation_errors['asset_id'] = $e->getMessage();
    }
예제 #2
0
$id = GET('id');
ossim_valid($id, OSS_HEX, 'illegal:' . _('Host ID'));
if (ossim_error()) {
    echo ossim_error(_('Error! Host not found'));
    exit;
}
/****************************************************
 ******************** Host data *********************
 ****************************************************/
//Database connection
$db = new ossim_db();
$conn = $db->connect();
$host = new Asset_host($conn, $id);
$host->load_from_db($conn);
//CTX
$ctx = $host->get_ctx();
$is_nagios_enabled = $host->is_nagios_enabled($conn);
$is_ext_ctx = FALSE;
$ext_ctxs = Session::get_external_ctxs($conn);
if (!empty($ext_ctxs[$ctx])) {
    $is_ext_ctx = TRUE;
}
//Closing database connection
$db->close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title><?php 
echo _('OSSIM Framework');
?>