Failed ssh login (Universal Linux)

Microsoft.ACS.Linux.Universal.Ssh.Failed (Rule)

Rule to collect events for failed ssh login

Knowledge Base article:

Summary

An unsuccessful ssh command has been detected in the system log files.

Configuration

This rule is disabled by default. It can be enabled with an override targeting a specific Universal Linux instance, all Universal Linux instances, or a group of Universal Linux instances. If this rule is enabled, the RegExpFilter parameter should be overridden with a Regular Expression pattern that is appropriate for the target Linux operating system and version. System log messages for specific conditions may vary between operating systems and version.

Causes

User was not granted access to the system remotely. This monitor allows system administrators to track 'ssh' usage.

Resolutions

The description of the alert and/or the output data item contains information on the event encountered. If the activity appears suspicious, please check the associated event details and any other events that happened around the time of this event.

Element properties:

TargetMicrosoft.ACS.Linux.Universal.ACSEndPoint
CategoryEventCollection
EnabledFalse
Alert GenerateFalse
RemotableTrue

Member Modules:

ID Module Type TypeId RunAs 
EventDS DataSource Microsoft.Unix.SCXLog.Privileged.Datasource Default
WA WriteAction Microsoft.ACS.Unix.SecureEventLogWriter Default

Source Code:

<Rule ID="Microsoft.ACS.Linux.Universal.Ssh.Failed" Enabled="false" Target="Microsoft.ACS.Linux.Universal.ACSEndPoint" Remotable="true">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="EventDS" TypeID="Unix!Microsoft.Unix.SCXLog.Privileged.Datasource">
<Host>$Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</Host>
<LogFile>/var/log/secure</LogFile>
<!-- [TYPE] Redhat6 SSH False -->
<!-- [INPUT] Oct 5 07:29:09 scxcrd-rhel6-01 sshd[20795]: Failed password for root from 172.30.170.215 port 42320 ssh2 -->
<!-- [INPUT] Oct 5 07:29:52 scxcrd-rhel6-01 sshd[20802]: Failed password for invalid user monuser from 172.30.170.215 port 42321 ssh2 -->
<!-- [EXPECTED] date="Oct 5 07:29:09"; hostname="scxcrd-rhel6-01"; process="sshd"; processId="20795"; user="root"; clientHost="172.30.170.215" -->
<!-- [EXPECTED] date="Oct 5 07:29:52"; hostname="scxcrd-rhel6-01"; process="sshd"; processId="20802"; user="monuser"; clientHost="172.30.170.215" -->
<RegExpFilter>\s+sshd\[[[:digit:]]+\]: Failed password for (invalid user )?\S+ from \S+</RegExpFilter>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA" TypeID="ACS.Unix!Microsoft.ACS.Unix.SecureEventLogWriter">
<RegExp>(?'date'\S+\s+\d+\s+\d+:\d+:\d+)\s+(?:\S+:)?(?'hostname'\S+)\s+(?'process'sshd)\[(?'processId'\d+)\]: Failed password for (?:invalid user )?(?'user'\S+) from (?'clientHost'\S+)</RegExp>
<EventType>0</EventType>
<EventId>27003</EventId>
</WriteAction>
</WriteActions>
</Rule>