使用 syslog 转发将 Azure Stack Hub 与监视解决方案集成

本文介绍如何使用 syslog 将 Azure Stack Hub 基础结构与已部署在数据中心的外部安全解决方案(s)集成。 例如,安全信息事件管理(SIEM)系统。 syslog 通道公开来自 Azure Stack Hub 基础结构的所有组件的审核、警报和安全日志。 使用 syslog 转发与安全监视解决方案集成,并检索所有审核、警报和安全日志以存储它们以供保留。

从 1809 更新开始,Azure Stack Hub 具有一个集成的 syslog 客户端,一旦配置,就会以通用事件格式(CEF)发出有效负载的 syslog 消息。

下图描述了 Azure Stack Hub 与外部 SIEM 的集成。 需要考虑两种集成模式:第一种(蓝色)是包含基础结构虚拟机和 Hyper-V 节点的 Azure Stack Hub 基础结构。 所有来自这些组件的审核、安全日志和警报都通过具有 CEF 有效负载的 syslog 进行集中收集和公开。 本文介绍了此集成模式。

第二种集成模式是橙色描述的集成模式,涵盖基板管理控制器(BMC)、硬件生命周期主机(HLH)、运行硬件合作伙伴监视和管理软件的虚拟机和虚拟设备,以及机架(TOR)交换机的顶部。 由于这些组件特定于硬件合作伙伴,因此请联系硬件合作伙伴,获取有关如何将其与外部 SIEM 集成的文档。

Syslog 转发关系图

配置 Syslog 转发

Azure Stack Hub 中的 syslog 客户端支持以下配置:

  1. 通过 TCP Syslog,使用相互身份验证(客户端和服务器)和 TLS 1.2 加密:在此配置中,syslog 服务器和 syslog 客户端都可以通过证书验证彼此的身份。 这些消息通过 TLS 1.2 加密通道发送。
  2. 通过 TCP 传输的 Syslog 使用服务器身份验证和 TLS 1.2 加密:在此配置中,syslog 客户端可以通过证书验证 syslog 服务器的身份。 这些消息通过 TLS 1.2 加密通道发送。
  3. TCP 上的 Syslog,没有加密:在此配置中,不会验证 syslog 客户端和 syslog 服务器标识。 消息通过 TCP 以明文形式发送。
  4. UDP 上的 Syslog,没有加密:在此配置中,不会验证 syslog 客户端和 syslog 服务器标识。 消息通过 UDP 以明文形式发送。

重要

为了防止中间人攻击和窃听消息,Microsoft强烈建议你对生产环境使用使用身份验证和加密(配置 #1 或至少为 #2)的 TCP。

用于配置 Syslog 转发的 cmdlet

配置 Syslog 转发需要访问特权终结点 (PEP)。 已将两个 PowerShell cmdlet 添加到 PEP 来配置 Syslog 转发:

### cmdlet to pass the syslog server information to the client and to configure the transport protocol, the encryption and the authentication between the client and the server

Set-SyslogServer [-ServerName <String>] [-ServerPort <UInt16>] [-NoEncryption] [-SkipCertificateCheck] [-SkipCNCheck] [-UseUDP] [-Remove]

### cmdlet to configure the certificate for the syslog client to authenticate with the server

Set-SyslogClient [-pfxBinary <Byte[]>] [-CertPassword <SecureString>] [-RemoveCertificate] [-OutputSeverity]

cmdlet 参数

Set-SyslogServer cmdlet 的参数:

参数 描述 类型 必须
ServerName syslog 服务器的 FQDN 或 IP 地址。 字符串 是的
ServerPort syslog 服务器侦听的端口号。 UInt16 是的
NoEncryption 强制客户端以明文形式发送 syslog 消息。
SkipCertificateCheck 在初始 TLS 握手期间跳过 syslog 服务器提供的证书的验证。
SkipCNCheck 在初始 TLS 握手期间,跳过 syslog 服务器提供的证书 公用名 值的验证。
UseUDP 将 syslog 与 UDP 一起使用作为传输协议。
Remove 从客户端中删除服务器的配置,并停止 syslog 转发。

Set-SyslogClient cmdlet 的参数:

参数 描述 类型
pfxBinary .pfx 文件的内容,通过管道传输到 Byte[],其中包含的证书可供客户端用作对 Syslog 服务器进行身份验证的标识。 Byte[]
CertPassword 导入与 pfx 文件关联的私钥的密码。 SecureString
RemoveCertificate 从客户端中删除证书。
OutputSeverity 输出日志记录的级别。 值为 DefaultVerbose默认 包括严重性级别:警告、严重或错误。 Verbose 包括所有严重性级别:“详细”、“信息”、“警告”、“严重”或“错误”。 字符串

使用 TCP、相互身份验证和 TLS 1.2 加密来配置 syslog 转发

在此配置中,Azure Stack Hub 中的 syslog 客户端使用 TLS 1.2 加密将消息转发到 syslog 服务器。 在初始握手期间,客户端验证服务器是否提供有效的受信任证书。 客户端还会向服务器提供证书作为其标识证明。 此配置是最安全的,因为它提供对客户端和服务器的标识的完整验证,并通过加密通道发送消息。

重要

Microsoft强烈建议将此配置用于生产环境。

若要使用 TCP、相互身份验证和 TLS 1.2 加密配置 syslog 转发,请在 PEP 会话上运行这两个 cmdlet:

# Configure the server
Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening>

# Provide certificate to the client to authenticate against the server
Set-SyslogClient -pfxBinary <Byte[] of pfx file> -CertPassword <SecureString, password for accessing the pfx file>

客户端证书的根必须与部署 Azure Stack Hub 期间提供的根证书相同。 它还必须包含私钥。

##Example on how to set your syslog client with the certificate for mutual authentication.
##This example script must be run from your hardware lifecycle host or privileged access workstation.

$ErcsNodeName = "<yourPEP>"
$password = ConvertTo-SecureString -String "<your cloudAdmin account password" -AsPlainText -Force
 
$cloudAdmin = "<your cloudAdmin account name>"
$CloudAdminCred = New-Object System.Management.Automation.PSCredential ($cloudAdmin, $password)
 
$certPassword = $password
$certContent = Get-Content -Path C:\cert\<yourClientCertificate>.pfx -Encoding Byte
 
$params = @{ 
    ComputerName = $ErcsNodeName 
    Credential = $CloudAdminCred 
    ConfigurationName = "PrivilegedEndpoint" 
}

$session = New-PSSession @params
 
$params = @{ 
    Session = $session 
    ArgumentList = @($certContent, $certPassword) 
}
Write-Verbose "Invoking cmdlet to set syslog client certificate..." -Verbose 
Invoke-Command @params -ScriptBlock { 
    param($CertContent, $CertPassword) 
    Set-SyslogClient -PfxBinary $CertContent -CertPassword $CertPassword }

使用 TCP、服务器身份验证和 TLS 1.2 加密配置 Syslog 转发

在此配置中,Azure Stack Hub 中的 syslog 客户端使用 TLS 1.2 加密将消息转发到 syslog 服务器。 在初始握手期间,客户端还会验证服务器是否提供有效的受信任证书。 此配置可防止客户端将消息发送到不受信任的目标。 使用身份验证和加密的 TCP 是默认配置,表示Microsoft建议用于生产环境的最低安全级别。

Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening>

如果要使用自签名或不受信任的证书测试 syslog 服务器与 Azure Stack Hub 客户端的集成,可以使用这些标志来跳过客户端在初始握手期间完成的服务器验证:

 # Skip validation of the Common Name value in the server certificate. Use this flag if you provide an IP address for your syslog server
 Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening>
 -SkipCNCheck

 # Skip the server certificate validation entirely
 Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening>
 -SkipCertificateCheck

重要

Microsoft建议不要在生产环境中使用 -SkipCertificateCheck 标志。

使用 TCP 配置 syslog 转发,不加密

在此配置中,Azure Stack Hub 中的 syslog 客户端通过 TCP 将消息转发到 syslog 服务器,无需加密。 客户端不会验证服务器的标识,也不会向服务器提供自己的标识进行验证:

Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening> -NoEncryption

重要

Microsoft建议不将此配置用于生产环境。

使用 UDP 配置 syslog 转发,无需加密

在此配置中,Azure Stack Hub 中的 syslog 客户端通过 UDP 将消息转发到 syslog 服务器,无需加密。 客户端不会验证服务器的标识,也不会向服务器提供自己的标识进行验证:

Set-SyslogServer -ServerName <FQDN or ip address of syslog server> -ServerPort <Port number on which the syslog server is listening> -UseUDP

虽然没有加密的 UDP 是最容易配置的,但它不提供针对中间人攻击和窃听消息的保护。

重要

Microsoft建议不将此配置用于生产环境。

删除 syslog 转发配置

若要从客户端中删除 syslog 服务器配置并停止 syslog 转发,请运行以下 cmdlet:

Set-SyslogServer -Remove

若要从客户端中删除客户端证书,请运行以下 cmdlet:

Set-SyslogClient -RemoveCertificate

验证 syslog 设置

如果已成功将 syslog 客户端连接到 syslog 服务器,应很快开始接收事件。 如果未看到任何事件,请运行以下 cmdlet 来验证 syslog 客户端的配置。

若要验证 syslog 客户端中的服务器配置,请执行以下操作:

Get-SyslogServer

若要验证 syslog 客户端中的证书设置,请执行以下操作:

Get-SyslogClient

Syslog 消息架构

Azure Stack Hub 基础结构的 syslog 转发会发送采用通用事件格式(CEF)格式的消息。 每个 syslog 消息都基于架构 <Time> <Host> <CEF payload>进行结构化。

CEF 有效负载基于以下结构,但每个字段的映射因消息类型而异(Windows 事件、创建警报、关闭警报):

# Common Event Format schema
CEF: <Version>|<Device Vendor>|<Device Product>|<Device Version>|<Signature ID>|<Name>|<Severity>|<Extensions>
* Version: 0.0
* Device Vendor: Microsoft
* Device Product: Microsoft Azure Stack Hub
* Device Version: 1.0

特权终结点事件的 CEF 映射

Prefix fields
* Signature ID: Microsoft-AzureStack-PrivilegedEndpoint: <PEP Event ID>
* Name: <PEP Task Name>
* Severity: mapped from PEP Level (details see the PEP Severity table below)
* Who: account used to connect to the PEP
* WhichIP: IP address of ERCS server hosting the PEP

特权终结点 (PEP) 的事件表:

活动 PEP 事件 ID PEP 任务名称 严重性
PrivilegedEndpointAccessed 1000 PrivilegedEndpointAccessedEvent 5
SupportSessionTokenRequested 1001 SupportSessionTokenRequestedEvent 5
SupportSessionDevelopmentTokenRequested 1002 SupportSessionDevelopmentTokenRequestedEvent 5
SupportSessionUnlocked 1003 SupportSessionUnlockedEvent 10
SupportSessionFailedToUnlock 1004 SupportSessionFailedToUnlockEvent 10
PrivilegedEndpointClosed 1005 PrivilegedEndpointClosedEvent 5
NewCloudAdminUser 1006 NewCloudAdminUserEvent 10
RemoveCloudAdminUser 1007 RemoveCloudAdminUserEvent 10
SetCloudAdminUserPassword 1008 SetCloudAdminUserPasswordEvent 5
获取云管理员密码恢复令牌 1009 GetCloudAdminPasswordRecoveryTokenEvent 10
ResetCloudAdminPassword 1010 ResetCloudAdminPasswordEvent 10
PrivilegedEndpointSessionTimedOut 1017 PrivilegedEndpointSessionTimedOutEvent 5

PEP 严重性表:

严重性 Level 数字值
0 未定义 值:0。 显示所有级别的日志
10 危急 值:1。 指示严重警报的日志
8 错误 值:2。 指示错误的日志
5 警告 值:3。 指示警告的日志
2 信息 值:4。 指示信息性消息的日志
0 详细 值:5。 显示各个级别的日志

恢复终结点事件的 CEF 映射

Prefix fields
* Signature ID: Microsoft-AzureStack-PrivilegedEndpoint: <REP Event ID>
* Name: <REP Task Name>
* Severity: mapped from REP Level (details see the REP Severity table below)
* Who: account used to connect to the REP
* WhichIP: IP address of the device used to connect to the REP

恢复终结点的事件表:

活动 REP 事件 ID REP 任务名称 严重性
RecoveryEndpointAccessed 1011 RecoveryEndpointAccessedEvent 5
RecoverySessionTokenRequested 1012 RecoverySessionTokenRequestedEvent 5
RecoverySessionDevelopmentTokenRequested 1013 RecoverySessionDevelopmentTokenRequestedEvent 5
RecoverySessionUnlocked 1014 RecoverySessionUnlockedEvent 10
RecoverySessionFailedToUnlock 1015 RecoverySessionFailedToUnlockEvent 10
恢复端点已关闭 1016 RecoveryEndpointClosedEvent 5

REP 严重性表:

严重性 Level 数字值
0 未定义 值:0。 显示所有级别的日志
10 危急 值:1。 指示严重警报的日志
8 错误 值:2。 指示错误的日志
5 警告 值:3。 指示警告的日志
2 信息 值:4。 指示信息性消息的日志
0 详细 值:5。 显示所有级别的日志

Windows 事件的 CEF 映射

* Signature ID: ProviderName:EventID
* Name: TaskName
* Severity: Level (for details, see the severity table below)
* Extension: Custom Extension Name (for details, see the Custom Extension table below)

Windows 事件的严重性表:

CEF 严重性值 Windows 事件级别 数字值
0 未定义 值:0。 表示所有级别的日志
10 危急 值:1。 指示严重警报的日志
8 错误 值:2。 指示错误的日志
5 警告 值:3。 指示警告的日志
2 信息 值:4。 指示信息性消息的日志
0 详细 值:5。 显示所有级别的日志

Azure Stack Hub 中 Windows 事件的自定义扩展表:

自定义扩展名称 Windows 事件示例
MasChannel 系统
MasComputer test.azurestack.contoso.com
MasCorrelationActivityID C8F40D7C-3764-423B-A4FA-C994442238AF
MasCorrelationRelatedActivityID C8F40D7C-3764-423B-A4FA-C994442238AF
MasEventData svchost!!4132,G,0!!!!EseDiskFlushConsistency!!ESENT!!0x800000
MasEventDescription 已成功处理用户的组策略设置。 自上次成功处理组策略以来,未检测到任何更改。
MasEventID 1501
MasEventRecordID 26637
MasExecutionProcessID 29380
MasExecutionThreadID 25480
MasKeywords 0x8000000000000000
MasKeywordName 审核成功
MasLevel 4
MasOpcode 1
MasOpcodeName info
MasProviderEventSourceName
MasProviderGuid AEA1B4FA-97D1-45F2-A64C-4D69FFFD92C9
MasProviderName Microsoft-Windows-GroupPolicy
MasSecurityUserId <Windows SID>
MasTask 0
MasTaskCategory 创建进程
MasUserData KB4093112!!5112!!Installed!!0x0!!WindowsUpdateAgent Xpath: /Event/UserData/*
MasVersion 0

已创建警报的 CEF 映射

* Signature ID: Microsoft Azure Stack Hub Alert Creation : FaultTypeId
* Name: FaultTypeId : AlertId
* Severity: Alert Severity (for details, see alerts severity table below)
* Extension: Custom Extension Name (for details, see the Custom Extension table below)

警报严重性表:

严重性 Level
0 未定义
10 危急
5 警告

为在 Azure Stack Hub 中创建的警报创建的自定义扩展表:

自定义扩展名称
MasEventDescription 说明:<TestUser> 为 <TestDomain>创建用户帐户。 这是潜在的安全风险。 -- 修正:请联系支持人员。 需要客户帮助才能解决此问题。 请勿在没有帮助的情况下尝试解决此问题。 在提出支持请求之前,请使用本指南 启动日志文件收集过程。

已关闭警报的 CEF 映射

* Signature ID: Microsoft Azure Stack Hub Alert Creation : FaultTypeId
* Name: FaultTypeId : AlertId
* Severity: Information

以下示例显示了带有 CEF 负载内容的 syslog 消息:

2018:05:17:-23:59:28 -07:00 TestHost CEF:0.0|Microsoft|Microsoft Azure Stack Hub|1.0|3|TITLE: User Account Created -- DESCRIPTION: A user account \<TestUser\> was created for \<TestDomain\>. It's a potential security risk. -- REMEDIATION: Please contact Support. Customer Assistance is required to resolve this issue. Do not try to resolve this issue without their assistance. Before you open a support request, start the log file collection process using the guidance from https://aka.ms/azurestacklogfiles|10

Syslog 事件类型

下表列出了通过 syslog 通道发送的所有事件类型、事件、消息架构或属性。 仅在 SIEM 集成需要 Windows 信息事件时,才应使用设置详细开关。

事件类型 事件或消息架构 需要详细设置 事件说明(可选)
Azure Stack Hub 警报 有关警报消息架构,请参阅已关闭警报的 CEF 映射

另外单独有一篇文档共享了所有警报的列表。
系统运行状况警报
特权终结点事件 有关特权终结点消息架构,请参阅 特权终结点事件的 CEF 映射

PrivilegedEndpointAccessed
SupportSessionTokenRequested
SupportSessionDevelopmentTokenRequested
SupportSessionUnlocked
SupportSessionFailedToUnlock
PrivilegedEndpointClosed
NewCloudAdminUser
RemoveCloudAdminUser
SetCloudAdminUserPassword
获取云管理员密码恢复令牌
ResetCloudAdminPassword
PrivilegedEndpointSessionTimedOut
恢复终结点事件 有关恢复终结点消息架构,请参阅 恢复终结点事件的 CEF 映射
RecoveryEndpointAccessed
RecoverySessionTokenRequested
RecoverySessionDevelopmentTokenRequested
RecoverySessionUnlocked
RecoverySessionFailedToUnlock
Recovand 恢复端点已关闭
Windows 安全事件
有关 Windows 事件消息架构,请参阅 Windows 事件的 CEF 映射。
是(用于获取信息事件) 类型:
-信息
-警告
-错误
-危急
ARM 事件 消息属性:

AzsSubscriptionId
AzsCorrelationId
AzsPrincipalOid
AzsPrincipalPuid
AzsTenantId
AzsOperationName
AzsOperationId
AzsEventSource
AzsDescription
AzsResourceProvider
AzsResourceUri
AzsEventName
AzsEventInstanceId
AzsChannels
AzsEventLevel
AzsStatus
AzsSubStatus
AzsClaims
AzsAuthorization
AzsHttpRequest
AzsProperties
AzsEventTimestamp
AzsAudience
AzsIssuer
AzsIssuedAt
AzsApplicationId
AzsUniqueTokenId
AzsArmServiceRequestId
AzsEventCategory


每个已注册的 ARM 资源都可以引发事件。
BCDR 事件 消息架构:

AuditingManualBackup {
}
AuditingConfig
{
间隔
保留
IsSchedulerEnabled
BackupPath
}
AuditingPruneBackupStore {
IsInternalStore
}
这些事件跟踪客户手动执行的基础结构备份管理操作,包括触发备份、更改备份配置和修剪备份数据。
基础结构故障创建和关闭事件 消息架构:

InfrastructureFaultOpen {
AzsFaultId,
AzsFaultTypeName,
AzsComponentType,
AzsComponentName,
AzsFaultHash,
AzsCreatedTimeUtc,
AzsSource
}

InfrastructureFaultClose {
AzsFaultId,
AzsFaultTypeName,
AzsComponentType,
AzsComponentName,
AzsFaultHash,
AzsLastUpdatedTimeUtc,
AzsSource
}
故障会触发尝试修正可能导致警报的错误的工作流。 如果故障没有修正,则直接会导致警报。
服务故障创建和关闭事件 消息架构:

ServiceFaultOpen {
AzsFaultId,
AzsFaultTypeName,
AzsSubscriptionId,
AzsResourceGroup,
AzsServiceName,
AzsResourceId
AzsFaultHash,
AzsCreatedTimeUtc,
AzsSource
}

ServiceFaultClose {
AzsFaultId,
AzsFaultTypeName,
AzsSubscriptionId,
AzsResourceGroup,
AzsServiceName,
AzsResourceId
AzsFaultHash,
AzsLastUpdatedTimeUtc,
AzsSource
}
故障会触发尝试修正可能导致警报的错误的工作流。
如果故障没有修正,则直接会导致警报。
PEP WAC 事件 消息架构:

前缀字段
* 签名 ID:Microsoft-AzureStack-PrivilegedEndpoint:<PEP 事件 ID>
* 名称:<PEP 任务名称>
* 严重性:从 PEP 级别映射(详细信息请参阅下面的 PEP 严重性表)
* Who:用于连接到 PEP 的帐户
* WhichIP:托管 PEP 的 ERCS 服务器的 IP 地址

WACServiceStartFailedEvent
WACConnectedUserNotRetrievedEvent
WACEnableExceptionEvent
WACUserAddedEvent
WACAddUserToLocalGroupFailedEvent
WACIsUserInLocalGroupFailedEvent
WACServiceStartTimeoutEvent
WACServiceStartInvalidOperationEvent
WACGetSidFromUserFailedEvent
WACDisableFirewallFailedEvent
WACCreateLocalGroupIfNotExistFailedEvent
WACEnableFlagIsTrueEvent
WACEnableFlagIsFalseEvent
WACServiceStartedEvent

后续步骤

Azure Stack Hub 服务策略