SU 命令成功警示規則

Microsoft.Linux.Universal.LogFile.Syslog.SU.Command.Root.Success.Alert (Rule)

「SU 切換至 root 命令」成功訊息的警示規則。

Knowledge Base article:

摘要

在系統記錄檔中偵測到執行成功的 'su' 命令。

設定

根據預設會停用此規則。可針對特定通用 Linux 執行個體或通用 Linux 執行個體群組,透過覆寫方式來啟用。如果啟用此規則,應使用適用於目標 Linux 作業系統和版本的規則運算式模式來覆寫 RegExpFilter 參數。特定條件的系統記錄檔訊息可能會因作業系統和版本而異。

原因

使用者可能已使用 'su' 提升權限獲得存取特殊權限帳戶的授權。此警示規則可讓系統管理員追蹤 'su' 的使用狀況。

解決方式

警示及/或輸出資料項目的描述包含所發生事件的資訊。如果'su' 的使用狀況似乎有問題,請檢查相關聯的事件詳細資訊,以及與此事件同時間發生的其他任何事件。

Element properties:

TargetMicrosoft.Linux.Universal.Computer
CategoryEventCollection
EnabledFalse
Alert GenerateTrue
Alert SeverityInformation
Alert PriorityNormal
RemotableTrue
Alert Message
偵測到使用 SU 切換為 Root 成功
{0}

Member Modules:

ID Module Type TypeId RunAs 
EventDS DataSource Microsoft.Unix.SCXLog.Privileged.Datasource Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.Linux.Universal.LogFile.Syslog.SU.Command.Root.Success.Alert" Target="Universal!Microsoft.Linux.Universal.Computer" Enabled="false" Remotable="true">
<Category>EventCollection</Category>
<DataSources>
<!-- [TYPE] Redhat6 SU True -->
<!-- [INPUT] Dec 6 01:24:06 scxcrd64-rhel6-01 su: pam_unix(su-l:session): session opened for user root by zoyang(uid=504) -->
<!-- [TYPE] Redhat8 SU True -->
<!-- Dec 25 05:36:46 ost64-rh8-01 su[77788]: pam_unix(su:session): session opened for user root by root(uid=1000) -->
<DataSource ID="EventDS" TypeID="Unix!Microsoft.Unix.SCXLog.Privileged.Datasource">
<Host>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Host>
<LogFile>/var/log/secure</LogFile>
<RegExpFilter>\s+su\[*[[:digit:]]*\]*: \S+\(\S+\): session opened for user root by \S+\(uid=[[:digit:]]+\)</RegExpFilter>
<IndividualAlerts>false</IndividualAlerts>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>0</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.Linux.Universal.LogFile.Syslog.SU.Command.Root.Success.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>