2009-01-30 Evi Vanoost <vanooste@rcbi.rochester.edu>

* include/config.inc.php: Updated documentation on LDAP implementation.
	
	* include/functions_db.php: Restored get_agent_modules_count function.
	
	* index.php, include/config_process.php, godmode/setup/setup.php: Now you
	can enforce https with a config variable

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1415 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-01-30 15:09:16 +00:00
parent 6e06021290
commit dc83eaee30
6 changed files with 82 additions and 16 deletions

View File

@ -1,3 +1,12 @@
2009-01-30 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/config.inc.php: Updated documentation on LDAP implementation.
* include/functions_db.php: Restored get_agent_modules_count function.
* index.php, include/config_process.php, godmode/setup/setup.php: Now you
can enforce https with a config variable
2009-01-30 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/alert_manager.php: Fixed the page title. Show the

View File

@ -51,11 +51,11 @@ if ($update_settings) {
$config["trap2agent"] = (string) get_parameter ('trap2agent', $config["trap2agent"]);
$config["autoupdate"] = (string) get_parameter ('autoupdate', $config["autoupdate"]);
$config["prominent_time"] = (string) get_parameter ('prominent_time', $config["prominent_time"]);
$config["loginhash_pwd"] = (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"]);
$config["loginhash_pwd"] = (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"]);
$config["timesource"] = (string) get_parameter ('timesource', $config["timesource"]);
$config["event_view_hr"] = (int) get_parameter ('event_view_hr', $config["event_view_hr"]);
$config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4);
$config["https"] = (bool) get_parameter ('https', $config["https"]);
process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'");
process_sql ("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE token = 'block_size'");
@ -76,6 +76,7 @@ if ($update_settings) {
process_sql ("UPDATE tconfig SET VALUE='".$config["timesource"]."' WHERE token = 'timesource'");
process_sql ("UPDATE tconfig SET VALUE='".$config["event_view_hr"]."' WHERE token = 'event_view_hr'");
process_sql ("UPDATE tconfig SET VALUE='".$config["loginhash_pwd"]."' WHERE token = 'loginhash_pwd'");
process_sql ("UPDATE tconfig SET VALUE='".$config["https"]."' WHERE token = 'https'");
}
echo "<h2>".__('Setup')." &gt; ";
@ -131,13 +132,13 @@ $table->data[14][1] = print_input_text ('block_size', $config["block_size"], '',
$table->data[14][0] = __('Default hours for event view');
$table->data[14][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true);
$table->data[15][0] = __('Timestamp or time comparation') . pandora_help("time_stamp-comparation", true);
$table->data[15][0] = __('Timestamp or time comparation') . pandora_help ("time_stamp-comparation", true);
$table->data[15][1] = __('Comparation in rollover').' ';
$table->data[15][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true);
$table->data[15][1] .= '<br />'.__('Timestamp in rollover').' ';
$table->data[15][1] .= print_radio_button ('prominent_time', "comparation", '', $config["prominent_time"], true);
$table->data[16][0] = __('Time source') . pandora_help("timesource", true);
$table->data[16][0] = __('Time source') . pandora_help ("timesource", true);
$sources["system"] = __('System');
$sources["sql"] = __('Database');
$table->data[16][1] = print_select ($sources, 'timesource', $config["timesource"], '', '', '', true);
@ -145,6 +146,9 @@ $table->data[16][1] = print_select ($sources, 'timesource', $config["timesource"
$table->data[17][0] = __('Automatic update check');
$table->data[17][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true);
$table->data[18][0] = __('Enforce https');
$table->data[18][1] = print_checkbox ('https', 1, $config["https"], true);
// 18
enterprise_hook ('load_snmpforward_enterprise');

View File

@ -27,8 +27,10 @@
// $config["homedir"]="/var/www/pandora_console/";
// $config["homeurl"]="/pandora_console/";
// $config["auth"]["scheme"] = "mysql";
///*************************** Start LDAP Config *****************************/
//------ LDAP General Server Settings ------//
// Only use the following if you have LDAP. Unnecessary for built-in
//
//Name or address of the LDAP server
// For SSL (not TLS) use 'ldaps://localhost'
@ -78,15 +80,17 @@
// Attributes to fetch from LDAP and corresponding user variables in the
// application. Do change according to your LDAP Schema
//$config["auth"]["ldap_user_attr"] = array (
// // LDAP attribute //Pandora FMS variable
// 'id_usuario' => 'uid', //login
// 'lastname' => 'sn', //last (sur) name
// 'firstname' => 'givenname', //first (given) name
// 'nombre_real' => 'cn', //full (common) name
// 'comentarios' => 'description', //comments - you can set this to anything
// 'fecha_registro' => 'lastlogin', //last login utimestamp or don't define
// 'direccion' => 'mail', //email - not necessary will default to empty
// 'telefono' => 'phone' //phone
// //Pandora attribute // LDAP attribute //Explanation
// 'id_user' => 'uid', //login
// 'lastname' => 'sn', //last (sur) name
// 'firstname' => 'givenname', //first (given) name
// 'fullname' => 'cn', //full (common) name
// 'comments' => 'description', //comments - you can set this to anything
// 'last_contact' => 'lastlogin', //last login utimestamp or don't define
// 'email' => 'mail', //email - not necessary will default to empty
// 'phone' => 'phone', //phone
// 'middlename' => 'mn', //not yet used except for representational purposes
// 'registered' => 'created' //created utimestamp or don't define
//);
///* You can uncomment the following only if you understand what it implies
//

View File

@ -171,10 +171,17 @@ if (!isset ($config["prominent_time"])) {
}
if (!isset ($config["timesource"])) {
// Prominent time tells us what to show prominently when a timestamp is
// displayed. The comparation (... days ago) or the timestamp (full date)
// Timesource says where time comes from (system or mysql)
$config["timesource"] = "system";
process_sql_insert ('tconfig', array ('token' => 'timesource',
'value' => $config['timesource']));
}
if (!isset ($config["https"])) {
// Sets whether or not we want to enforce https. We don't want to go to a
// potentially unexisting config by default
$config["https"] = false;
process_sql_insert ('tconfig', array ('token' => 'https',
'value' => $config["https"]));
}
?>

View File

@ -407,6 +407,28 @@ function get_agent_modules ($id_agent, $details = false, $filter = false) {
return $modules;
}
/**
* Get the number of all agent modules in the database
*
* @param mixed Array of integers with agent(s) id or a single agent id. Default
* value will select all.
*
* @return int The number of agent modules
*/
function get_agent_modules_count ($id_agent = 0) {
//Make sure we're all int's and filter out bad stuff
$id_agent = safe_int ($id_agent, 1);
if (empty ($id_agent)) {
//If the array proved empty or the agent is less than 1 (eg. -1)
$filter = '';
} else {
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
}
return (int) get_db_sql ("SELECT COUNT(*) FROM tagente_modulo".$filter);
}
/**
* Get a list of the reports the user can view.
*

View File

@ -77,6 +77,26 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
load_extensions ($config['extensions']);
if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
$query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
if (sizeof ($_REQUEST))
//Some (old) browsers don't like the ?&key=var
$query .= '?1=1';
//We don't clean these variables up as they're only being passed along
foreach ($_GET as $key => $value) {
/* Avoid the 1=1 */
if ($key == 1)
continue;
$query .= '&'.$key.'='.$value;
}
foreach ($_POST as $key => $value) {
$query .= '&'.$key.'='.$value;
}
header ('Location: '.$query);
exit; //Always exit after sending location headers
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>';
// Pure mode (without menu, header and footer).