<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why is my real-time search correlation for SSH detecting false positives with user sshd? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Why-is-my-real-time-search-correlation-for-SSH-detecting-false/m-p/157040#M2574</link>
    <description>&lt;P&gt;Your problem is that the &lt;CODE&gt;sshd&lt;/CODE&gt; returned from your subsearch appears to be matching the &lt;CODE&gt;sshd&lt;/CODE&gt; in the name of the process, not the user name.&lt;/P&gt;

&lt;P&gt;To fix this, you need to &lt;CODE&gt;rex&lt;/CODE&gt; your event into fields, assign the username to a field name, and then at the end of your subsearch, assign the result to that field name rather than &lt;CODE&gt;query&lt;/CODE&gt;. That ought to get you what you want.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Apr 2015 20:46:52 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2015-04-24T20:46:52Z</dc:date>
    <item>
      <title>Why is my real-time search correlation for SSH detecting false positives with user sshd?</title>
      <link>https://community.splunk.com/t5/Alerting/Why-is-my-real-time-search-correlation-for-SSH-detecting-false/m-p/157039#M2573</link>
      <description>&lt;P&gt;After searching for a bit, I can't find an exact fix to this issue--&lt;BR /&gt;
I'm having some weird edge cases with a  realtime search that we're using to alert on SSH logins.&lt;/P&gt;

&lt;P&gt;Under normal circumstances the search below triggers an alert if there is a successful login by a user after 4 failed logins in 5 minutes. Normally this works fine, however yesterday we showed brute force attempts from someone trying to log in as a user called "sshd". &lt;/P&gt;

&lt;P&gt;This caused the search to trigger for &lt;EM&gt;any&lt;/EM&gt; users successfully logging in within 5 minutes of the attempt, I'm assuming because it interpeted their successful authentication attempts as successes by the "sshd" user.&lt;/P&gt;

&lt;P&gt;Is there any good way to modify my search to account for this?&lt;/P&gt;

&lt;P&gt;Search code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ssh* authenticated [search ssh* "authentication failure" | rex field=_raw "rhost=(?&amp;lt;ipfrom&amp;gt;.*) user=(?&amp;lt;username&amp;gt;.*)" | stats count by username | where count &amp;gt;= 4 | rename username AS query | fields query ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sanitized logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Apr 23 14:15:55 hostX auth.debug&amp;lt;39&amp;gt;: sshd[12243]: debug1: monitor_child_preauth: bob has been authenticated by privileged process
Apr 23 14:15:53 hostX authpriv.info&amp;lt;86&amp;gt;: sshd[12245]: pam_krb5(sshd:auth): user bob authenticated as bob@myhost.net
Apr 23 14:12:27 hostX authpriv.notice&amp;lt;85&amp;gt;: sshd[15524]: pam_sss(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=100.100.100.555 user=sshd
Apr 23 14:12:13 hostX authpriv.notice&amp;lt;85&amp;gt;: sshd[15524]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=100.100.100.555 user=sshd
Apr 23 14:11:44 hostX authpriv.notice&amp;lt;85&amp;gt;: sshd[15440]: pam_sss(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=100.100.100.555 user=sshd
Apr 23 14:10:32 hostX authpriv.notice&amp;lt;85&amp;gt;: sshd[15440]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=100.100.100.555 user=sshd
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 19:13:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Why-is-my-real-time-search-correlation-for-SSH-detecting-false/m-p/157039#M2573</guid>
      <dc:creator>reljssplunk</dc:creator>
      <dc:date>2015-04-24T19:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my real-time search correlation for SSH detecting false positives with user sshd?</title>
      <link>https://community.splunk.com/t5/Alerting/Why-is-my-real-time-search-correlation-for-SSH-detecting-false/m-p/157040#M2574</link>
      <description>&lt;P&gt;Your problem is that the &lt;CODE&gt;sshd&lt;/CODE&gt; returned from your subsearch appears to be matching the &lt;CODE&gt;sshd&lt;/CODE&gt; in the name of the process, not the user name.&lt;/P&gt;

&lt;P&gt;To fix this, you need to &lt;CODE&gt;rex&lt;/CODE&gt; your event into fields, assign the username to a field name, and then at the end of your subsearch, assign the result to that field name rather than &lt;CODE&gt;query&lt;/CODE&gt;. That ought to get you what you want.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 20:46:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Why-is-my-real-time-search-correlation-for-SSH-detecting-false/m-p/157040#M2574</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-04-24T20:46:52Z</dc:date>
    </item>
  </channel>
</rss>

