tuxudo / audit_mr
munkireport模块。
v1.0
2023-07-26 19:42 UTC
README
这是一个非官方模块,需要修改两个核心MunkiReport文件。
审计和列表记录MunkiReport的登录、登出和登录失败。结果审计可以在“登录审计”管理员标签页中查看。
文件修改
需要编辑两个文件,以便此模块能够捕获和记录登录。
-
/munkireport-php/app/controllers/Auth.php
行 ~5 - 修改
use \Controller, \View;
改为
use \Controller, \View, \Audit_mr_model;
行 ~109 - 修改
} else { error('Wrong username or password', 'auth.wrong_user_or_pass'); }
改为
} else { // Load and audit the login $audit = new Audit_mr_model; $audit->add_audit_user("Login Failed", $login); error('Wrong username or password', 'auth.wrong_user_or_pass'); }
行 ~151 - 修改
// Initialize session $this->authorized(); // Check if saml
改为
// Initialize session $this->authorized(); // Load and audit the logout $audit = new Audit_mr_model; $audit->add_audit("Logout"); // Check if saml
-
/munkireport-php/app/lib/munkireport/AuthHandler.php
行 ~4 - 修改
use \Exception, \View, \Reportdata_model
改为
use \Exception, \View, \Reportdata_model, \Audit_mr_model;
行 ~38 - 修改
session_regenerate_id(); return true;
改为
session_regenerate_id(); // Load and audit the login $audit = new Audit_mr_model; $audit->add_audit("Login"); return true;
行 ~62 - 修改
if ($authObj->getAuthStatus() == 'failed'){ return false; } if ($authObj->getAuthStatus() == 'unauthorized'){ error('Not authorized', 'auth.not_authorized');
改为
if ($authObj->getAuthStatus() == 'failed'){ // Load and audit the login $audit = new Audit_mr_model; $audit->add_audit_user("Login Failed", $login); return false; } if ($authObj->getAuthStatus() == 'unauthorized'){ // Load and audit the login $audit = new Audit_mr_model; $audit->add_audit_user("Unauthorized", $login); error('Not authorized', 'auth.not_authorized');
备注
此模块很可能不会为MunkiReport v6更新。那个版本的MunkiReport将使用框架内置的审计功能。
表结构
- username - (字符串) - 执行动作的用户名
- ip_address - (文本) - 动作的IP地址
- user_agent - (文本) - 用户的用户代理
- timestamp - (大整数) - 动作发生的时间戳
- action - (字符串) - 发生了什么动作
- role - (字符串) - 用户在MunkiReport中的角色