2012-05-30 Vanessa Gil <vanessa.gil@artica.es>

* pandoradb.sql
	  pandoradb.postgreSQL.sql
	  pandoradb.oracle.sql
	  pandoradb_data.sql
	  pandoradb.data.oracle.sql
	  pandoradb.data.postgreSQL.sql
	  extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql
	  extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql
	  extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql
	  index.php
	  godmode/users/configure_user.php
	  include/functions_config.php
	  include/auth/mysql.php
	  include/javascript/jquery.pandora.js: Added admin users to password policy
	and added password history.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6366 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-05-30 12:07:26 +00:00
parent e9a8e26a7e
commit e193f5a2c2
15 changed files with 150 additions and 17 deletions

View File

@ -1,3 +1,21 @@
2012-05-30 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql
pandoradb_data.sql
pandoradb.data.oracle.sql
pandoradb.data.postgreSQL.sql
extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql
extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql
extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql
index.php
godmode/users/configure_user.php
include/functions_config.php
include/auth/mysql.php
include/javascript/jquery.pandora.js: Added admin users to password policy
and added password history.
2012-05-30 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php: Added to API a test function

View File

@ -244,4 +244,19 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('pass_expire', 0),
('first_login', 0),
('mins_fail_pass', 5),
('number_attempts', 5);
('number_attempts', 5),
('enable_pass_policy_admin', 0),
('enable_pass_history', 0),
('compare_pass', 3);
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tpassword_history` (
`id_pass` int(10) unsigned NOT NULL auto_increment,
`id_user` varchar(60) NOT NULL,
`password` varchar(45) default NULL,
`date_begin` DATETIME NOT NULL DEFAULT 0,
`date_end` DATETIME NOT NULL DEFAULT 0,
PRIMARY KEY (`id_pass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -247,4 +247,20 @@ INSERT INTO tconfig (token, value) VALUES
('pass_expire', 0),
('first_login', 0),
('mins_fail_pass', 5),
('number_attempts', 5);
('number_attempts', 5),
('enable_pass_policy_admin', 0),
('enable_pass_history', 0),
('compare_pass', 3);
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS tpassword_history (
id_pass NUMBER(10) NOT NULL PRIMARY KEY,
id_user varchar2(60) NOT NULL,
password varchar2(45) default '',
date_begin TIMESTAMP DEFAULT 0,
date_end TIMESTAMP DEFAULT 0
);
CREATE SEQUENCE tpassword_history_s INCREMENT BY 1 START WITH 1;

View File

@ -236,4 +236,18 @@ INSERT INTO "tconfig" ("token", "value") VALUES
('pass_expire', 0),
('first_login', 0),
('mins_fail_pass', 5),
('number_attempts', 5);
('number_attempts', 5),
('enable_pass_policy_admin', 0),
('enable_pass_history', 0),
('compare_pass', 3);
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS "tpassword_history" (
"id_pass" INTEGER NOT NULL PRIMARY KEY,
"id_user" varchar(60) NOT NULL,
"password" varchar(45) default NULL,
"date_begin" BIGINT NOT NULL default 0,
"date_end" BIGINT NOT NULL default 0,
);

View File

@ -173,9 +173,16 @@ if ($create_user) {
case "mysql":
case "postgresql":
$result = create_user($id, $password_new, $values);
if ($result) {
$res = save_pass_history($id, $password_new);
}
break;
case "oracle":
$result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')');
if ($result) {
$res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')');
}
break;
}
@ -226,6 +233,9 @@ if ($update_user) {
if ($password_new != '') {
if ($password_confirm == $password_new) {
$res2 = update_user_password ($id, $password_new);
if ($res2) {
$res3 = save_pass_history($id, $password_new);
}
ui_print_result_message ($res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)'));

View File

@ -341,6 +341,19 @@ function create_user ($id_user, $password, $user_info) {
return (@db_process_sql_insert ("tusuario", $values)) !== false;
}
/**
* Save password history
*
* @return bool false
*/
function save_pass_history ($id_user, $password) {
$values["id_user"] = $id_user;
$values["password"] = md5 ($password);
$values["date_begin"] = date ("Y/m/d H:i:s", get_system_time());
return (@db_process_sql_insert ("tpassword_history", $values)) !== false;
}
/**
* Deletes the user
*

View File

@ -225,6 +225,9 @@ function config_update_config () {
$config['number_attempts'] = get_parameter('number_attempts', $config['number_attempts']);
$config['pass_needs_numbers'] = get_parameter('pass_needs_numbers', $config['pass_needs_numbers']);
$config['pass_needs_symbols'] = get_parameter('pass_needs_symbols', $config['pass_needs_symbols']);
$config['enable_pass_policy_admin'] = get_parameter('enable_pass_policy_admin', $config['enable_pass_policy_admin']);
$config['enable_pass_history'] = get_parameter('enable_pass_history', $config['enable_pass_history']);
$config['compare_pass'] = get_parameter('compare_pass', $config['compare_pass']);
}
# Update of Pandora FMS license

View File

@ -137,8 +137,8 @@ $(document).ready (function () {
resizable: true,
draggable: true,
modal: true,
height: 280,
width: 600,
height: 260,
width: 590,
overlay: {
opacity: 0.5,
background: "black"

View File

@ -186,7 +186,7 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
$expired_pass = false;
if (($nick_in_db != false)&&(!is_user_admin($nick)) && (defined('PANDORA_ENTERPRISE')) && ($config['enable_pass_policy'])) {
if (($nick_in_db != false)&& ((!is_user_admin($nick) || $config['enable_pass_policy_admin'])) && (defined('PANDORA_ENTERPRISE')) && ($config['enable_pass_policy'])) {
include_once(ENTERPRISE_DIR."/include/auth/mysql.php");
$blocked = login_check_blocked($nick);
@ -284,7 +284,7 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
else { //login wrong
$blocked = false;
if (!is_user_admin($nick)) {
if (!is_user_admin($nick) || $config['enable_pass_policy_admin']) {
$blocked = login_check_blocked($nick);
}

View File

@ -100,6 +100,9 @@ INSERT INTO tconfig (token, value) VALUES ('pass_expire', 0);
INSERT INTO tconfig (token, value) VALUES ('first_login', 0);
INSERT INTO tconfig (token, value) VALUES ('mins_fail_pass', 5);
INSERT INTO tconfig (token, value) VALUES ('number_attempts', 5);
INSERT INTO tconfig (token, value) VALUES ('enable_pass_policy_admin', 0);
INSERT INTO tconfig (token, value) VALUES ('enable_pass_history', 0);
INSERT INTO tconfig (token, value) VALUES ('compare_pass', 3);
COMMIT;
END;;

View File

@ -87,15 +87,18 @@ INSERT INTO "tconfig" ("token", "value") VALUES
('netflow_interval', '300'),
('netflow_daemon', '/usr/bin/nfcapd'),
('event_fields', 'evento,id_agente,estado,timestamp'),
('list_ACL_IPs_for_API_0', '127.0.0.1');
('enable_pass_policy', 0);
('pass_size', 4);
('pass_needs_numbers', 0);
('pass_needs_simbols', 0);
('pass_expire', 0);
('first_login', 0);
('mins_fail_pass', 5);
('number_attempts', 5);
('list_ACL_IPs_for_API_0', '127.0.0.1'),
('enable_pass_policy', 0),
('pass_size', 4),
('pass_needs_numbers', 0),
('pass_needs_simbols', 0),
('pass_expire', 0),
('first_login', 0),
('mins_fail_pass', 5),
('number_attempts', 5),
('enable_pass_policy_admin', 0),
('enable_pass_history', 0),
('compare_pass', 3);
COMMIT WORK;

View File

@ -1602,3 +1602,15 @@ CREATE TABLE IF NOT EXISTS ttimezone (
CREATE SEQUENCE ttimezone_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttimezone_inc BEFORE INSERT ON ttimezone REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttimezone_s.nextval INTO :NEW.ID_TZ FROM dual; END ttimezone_inc;;
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS tpassword_history (
id_pass NUMBER(10) NOT NULL PRIMARY KEY,
id_user varchar2(60) NOT NULL,
password varchar2(45) default '',
date_begin TIMESTAMP DEFAULT 0,
date_end TIMESTAMP DEFAULT 0
);
CREATE SEQUENCE tpassword_history_s INCREMENT BY 1 START WITH 1;

View File

@ -1297,3 +1297,14 @@ CREATE TABLE "ttimezone" (
"zone" varchar(60) NOT NULL,
"timezone" varchar(60) NOT NULL
);
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS "tpassword_history" (
"id_pass" INTEGER NOT NULL PRIMARY KEY,
"id_user" varchar(60) NOT NULL,
"password" varchar(45) default NULL,
"date_begin" BIGINT NOT NULL default 0,
"date_end" BIGINT NOT NULL default 0,
);

View File

@ -1403,3 +1403,15 @@ CREATE TABLE IF NOT EXISTS `ttimezone` (
`timezone` varchar(60) NOT NULL,
PRIMARY KEY (`id_tz`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tpassword_history`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tpassword_history` (
`id_pass` int(10) unsigned NOT NULL auto_increment,
`id_user` varchar(60) NOT NULL,
`password` varchar(45) default NULL,
`date_begin` DATETIME NOT NULL DEFAULT 0,
`date_end` DATETIME NOT NULL DEFAULT 0,
PRIMARY KEY (`id_pass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -94,7 +94,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('pass_expire', 0),
('first_login', 0),
('mins_fail_pass', 5),
('number_attempts', 5);
('number_attempts', 5),
('enable_pass_policy_admin', 0),
('enable_pass_history', 0),
('compare_pass', 3);
UNLOCK TABLES;