当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 检测服务器上未经授权的软件安装

作者:精品下载站 日期:2024-12-14 06:09:05 浏览:13 分类:玩电脑

检测服务器上未经授权的软件安装


Windows Server 上的可疑软件可能是您自己的员工未经授权安装的结果,或者源自黑客的攻击。任何可疑软件都可能导致敏感数据泄露,更不用说服务器性能下降或违反合规策略了。

这就是为什么了解任何软件安装的发生并查看安装的内容、是谁以及何时安装(在安装发生后不久)至关重要。

本机审核

1. 运行 eventvwr.msc > Windows 日志 > 右键单击“应用程序”日志 > 属性:

  • 确保选中“启用日志记录”复选框
  • 将日志大小增加至少 1 GB
  • 将保留方法设置为“根据需要覆盖事件”或“日志满时存档”

2. 打开事件查看器并使用 MsiInstaller 事件源在应用程序日志中搜索 11707 事件 ID,以查找上次安装的软件。

3. 要创建在安装任何软件时触发的即时警报,您需要通过设置参数来编辑以下 PowerShell 脚本并将其保存为 .ps1 文件(例如,Detect_software)。

$Subject = “New Software Has Been Installed” # Message Subject 
$Server = “smtp.server” # SMTP Server 
$From = “[email protected]” # From whom we are sending an e-mail(add anonymous logon permission if needed) 
$To = “[email protected]” # To whom we are sending
$Pwd = ConvertTo-SecureString “enterpassword” -AsPlainText –Force #Sender account password 
#(Warning! Use a very restricted account for the sender, because the password stored in the script will be not encrypted)
$Cred = New-Object System.Management.Automation.PSCredential(“[email protected]” , $Pwd) #Sender account credentials 
$encoding = [System.Text.Encoding]::UTF8 #Setting encoding to UTF8 for message correct display
#Powershell command for filtering the security log about created user account event  
$Body=Get-WinEvent -FilterHashtable @{LogName=”Application”;ID=11707;ProviderName='MsiInstaller'} | Select TimeCreated, Message, UserID | select-object -first 1 
#Sending an e-mail. 
Send-MailMessage -From $From -To $To -SmtpServer $Server -Body “$Body” -Subject $Subject -Credential $Cred -Encoding $encoding

4. 运行任务计划程序 > 创建新计划任务 > 输入其名称 > 触发器选项卡 > 新触发器 > 设置以下选项:

  • 在事件上开始任务
  • 日志 - 应用程序
  • 来源 - 空白
  • 事件ID - 11707

5. 转到“操作”选项卡 > 使用以下参数的新操作:

  • 行动——启动一个程序
  • 程序脚本:PowerShell
  • 添加参数(可选):-File“指定脚本的文件路径”

6. 单击“确定”

7. 现在,您将通过电子邮件收到 Windows Server 上每个软件安装的通知,其中包含软件安装时间、软件名称和安装者用户 ID (SID) 的详细信息。

8. 要将用户 SID 转换为帐户名称,请在 PowerShell ISE 中打开以下脚本,输入 SID 并单击“运行”:

$objSID = New-Object System.Security.Principal.SecurityIdentifier("Enter your SID Here") 
$objUser = $objSID.Translate([System.Security.Principal.NTAccount]) 
$objUser.Value

适用于 Windows Server 的 Netwrix Auditor

1. 运行 Netwrix Auditor > Managed Objects > Windows Server > 单击“运行”来收集日志(日志收集是按照特定计划自动执行的;这里您可能需要手动单击“运行”按钮,以避免等待下一次)计划的数据收集)> 打开日志收集后收到的电子邮件。

2. 要创建在安装任何软件时触发的即时警报,请转至“托管对象”> Windows Server > 事件日志 > 右键单击“实时警报”> 新建实时警报 > 设置警报名称,然后单击“下一步” > 单击“添加事件过滤器” > 设置过滤器的名称 > 设置应用程序事件日志 > 转到“事件过滤器”选项卡 > 设置事件 ID=11707 > 单击“确定”和“完成”。

3. 现在,每次在服务器上安装软件时,您都可以收到一封电子邮件。

不要错过检测 Windows Server 上未经授权的软件安装的实际用例!

[玩转系统] 检测服务器上未经授权的软件安装

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯