Beispiel #1
0
}
//If we have permissions to see any sensor...
if (!empty($sensors_nagios)) {
    if ($ng_selected == -1) {
        $ng_selected = 0;
    }
    $_ip = $sensors_nagios[$ng_selected]['ip'];
    //Remote ossim sensors and remote nagios...
    if ($_ip != '' && $_ip != 'localhost' && $_ip != Util::get_default_admin_ip() && $_ip != $_SERVER['SERVER_NAME']) {
        $_sensor = new Av_sensor($sensors_nagios[$ng_selected]['id']);
        $_sensor->load_from_db($conn);
        $nagios_options = $_sensor->get_nagios_credentials($conn);
        $_s_user = $nagios_options['user'];
        $_s_pass = $nagios_options['password'];
        try {
            $nagios_url = $_sensor->get_nagios_url($_s_user, $_s_pass);
            $nagios = $nagios_url['url'];
            $nagios_opts = $nagios_url['s_context'];
            if (preg_match('/^http:\\/\\//', $nagios) && $_s_user != '' && $_s_pass != '') {
                $nagios = str_replace('http://', "http://{$_s_user}:{$_s_pass}@", $nagios);
            } elseif (preg_match('/^https:\\/\\//', $nagios) && $nagios_opts['http']['header'] != '') {
                $flag_login = TRUE;
                $_login = base64_encode(Util::encrypt($_s_user . "####" . md5($_s_pass), $conf->get_conf('remote_key')));
                $_SESSION['_remote_nagios_credential'] = array($_ip, $_login);
            }
        } catch (Exception $e) {
            $flag_opts = FALSE;
            // Exception message ignored, it will show messages.php?msg=2
        }
    } else {
        $nagios = $path;