Example #1
0
 if ($data['status'] == 'error') {
     $txt_error = "<div>" . _("We Found the following errors") . ":</div>\n    \t\t\t\t\t  <div style='padding: 2px 10px 5px 10px;'>" . implode("<br/>", $data['data']) . "</div>";
     $config_nt = array('content' => $txt_error, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
     $nt = new Notification('nt_1', $config_nt);
     $nt->show();
     Util::make_form("POST", "newserverform.php");
     $db->close();
     exit;
 }
 if (!Session::hostAllowed_by_ip_ctx($conn, $ip, Session::get_default_ctx())) {
     $db->close();
     die(ossim_error(_("You don't have permission to create a new server with this IP Address")));
 }
 // Try to attach a new server
 $client = new Alienvault_client();
 $response = $client->system()->set_component($ip, $rpass);
 $return = @json_decode($response, TRUE);
 if (!$return || $return['status'] == 'error') {
     $config_nt = array('content' => $return['message'], 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align:center;');
     $nt = new Notification('nt_1', $config_nt);
     $nt->show();
     Util::make_form("POST", "newserverform.php");
     $db->close();
     exit;
 } else {
     $new_id = strtoupper(str_replace('-', '', $return['data']['server_id']));
     if ($return['data']['hostname'] != '') {
         $sname = $return['data']['hostname'];
     }
 }
 if (!isset($resend_alarms)) {
Example #2
0
        }
        $location_name = $company != '' ? $company . ' ' . _('Location') : $title . ' ' . _('Location');
        $new_location_id = Locations::insert($conn, $default_ctx_id, $location_name, '', $location, $lat, $lng, $country);
        $sensors = Av_sensor::get_basic_list($conn);
        foreach ($sensors as $sensor) {
            Locations::insert_related_sensor($conn, $new_location_id, $sensor['id']);
        }
    }
    // Save Track Usage Information
    if ($track_usage_information == 1) {
        $tui_status = $track_usage_information > 0 ? 1 : 0;
        $config = new Config();
        $config->update('track_usage_information', $tui_status);
        $client = new Alienvault_client();
        $tui_status = $track_usage_information > 0 ? TRUE : FALSE;
        $client->system()->set_telemetry($tui_status);
    }
    $config->update('first_login', 'no');
    $db->close();
    $default_user = AV_DEFAULT_ADMIN;
}
// LOGIN
$cnd_1 = !empty($user) && is_string($user);
$cnd_2 = !empty($pass) && is_string($pass);
if ($cnd_1 && $cnd_2) {
    $session = new Session($user, $pass, '');
    $config = new Config();
    //Disable first_login
    if ($accepted == 'yes') {
        $config->update('first_login', 'no');
    }
Example #3
0
if ($data['status'] == 'error') {
    $txt_error = "<div>" . _("The following errors occurred") . ":</div>\n\t\t\t\t\t  <div style='padding: 2px 10px 5px 10px;'>" . implode("<br/>", $data['data']) . "</div>";
    $config_nt = array('content' => $txt_error, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    Util::make_form("POST", "newserverform.php");
    $db->close();
    exit;
}
if (!Session::hostAllowed_by_ip_ctx($conn, $ip, Session::get_default_ctx())) {
    $db->close();
    die(ossim_error(_("You don't have permission to create a new server with this IP Address")));
}
// Try to attach a new server
$client = new Alienvault_client();
$response = $client->system()->set_component($ip, $password, 'password');
$return = @json_decode($response, TRUE);
if (!$return || $return['status'] == 'error') {
    $config_nt = array('content' => $return['message'], 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align:center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    Util::make_form("POST", "newserverform.php");
    $db->close();
    exit;
} else {
    $new_id = strtoupper(str_replace('-', '', $return['data']['server_id']));
    if ($return['data']['hostname'] != '') {
        $sname = $return['data']['hostname'];
    } else {
        $sname = 'USM-Server';
    }
Example #4
0
     for ($i = 0; $i < POST('nconfs'); $i++) {
         if (isset($_POST["conf_{$i}"]) && isset($_POST["value_{$i}"])) {
             if ($pass_fields[POST("conf_{$i}")] == 1 && Util::is_fake_pass(POST("value_{$i}")) || POST("value_{$i}") == 'skip_this_config_value') {
                 continue;
             } else {
                 $before_value = $ossim_conf->get_conf(POST("conf_{$i}"));
                 $config->update(POST("conf_{$i}"), POST("value_{$i}"));
                 if (POST("value_{$i}") != $before_value) {
                     Log_action::log(7, array("variable: " . POST("conf_{$i}")));
                     // Special cases
                     if (POST("conf_{$i}") == 'idm_user_login_timeout') {
                         $restart_server = 1;
                     }
                     if (POST("conf_{$i}") == 'track_usage_information') {
                         $client = new Alienvault_client();
                         $client->system()->set_telemetry(POST("value_{$i}") > 0 ? TRUE : FALSE);
                     }
                 }
             }
         }
     }
 }
 // check valid pass length max
 if (intval($pass_length_max) < intval($pass_length_min) || intval($pass_length_max) < 1 || intval($pass_length_max) > 255) {
     $config->update('pass_length_max', 255);
 } else {
     $config->update('pass_length_max', intval($pass_length_max));
 }
 // check valid expire min - max
 if ($pass_expire_max * 60 * 24 < $pass_expire_min) {
     $config->update('pass_expire_min', 0);