On May 13, 6:32 pm, "Jordan Sissel" <
psio...@gmail.com> wrote:
> On Tue, May 13, 2008 at 4:20 AM, text-dude <
newsbo...@gmail.com> wrote:
...
> > root# info_dialog.py "Successful ssh-login by (user) from (IP-
> > address)"
>
> > root# info_dialog.py "Failed ssh-login by (user) from (IP-address)"
>
> If you posted your code I might be able to help better.
Ok:
-----------------------------------
root# cat `which info_dialog.py`
#!/usr/bin/pythonw
import wx
import sys
import time
class MyFrame(wx.Frame):
"""
This is MyFrame. It just shows a few controls on a wxPanel,
and has a simple menu.
"""
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title,
pos=(150, 150), size=(550, 200))
# Now create the Panel to put the other controls on.
panel = wx.Panel(self)
# and a few controls
if len(sys.argv) <= 1:
print 'Use 1 command line argument!'
time.sleep(2)
sys.exit()
text = wx.StaticText(panel, -1, sys.argv[1])
text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
text.SetSize(text.GetBestSize())
btn = wx.Button(panel, -1, "Close")
# bind the button events to handlers
self.Bind(wx.EVT_BUTTON, self.OnTimeToClose, btn)
# Use a sizer to layout the controls, stacked vertically and
with
# a 10 pixel border around each
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(text, 0, wx.ALL, 10)
sizer.Add(btn, 0, wx.ALL, 10)
panel.SetSizer(sizer)
panel.Layout()
def OnTimeToClose(self, evt):
"""Event handler for the button click."""
self.Close()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, "Simple wxPython App")
self.SetTopWindow(frame)
frame.Show(True)
return True
app = MyApp(redirect=True)
app.MainLoop()
-----------------------------------
> Are you saying doing the following works as you expect?
> info_dialog.py "foo bar baz"
>
> But doing the same in grok.conf fails?
> reaction = 'info_dialog.py "foo bar baz"'; ?
Ah, great suggestion... It partly works... This is my config-file:
--------------------------
file "/var/log/secure.log" {
type "correct login valid user" {
match = "Accepted keyboard-interactive/pam for %USER% from %IP%";
threshold = 0;
interval = 100;
reaction = 'info_dialog.py "SSH: %USER% LOGGED IN FROM %IP%!"';
};
type "bad password valid user" {
match = "Failed keyboard-interactive/pam for %USER% from %IP%";
threshold = 0;
interval = 100;
reaction = 'info_dialog.py "SSH: WRONG PASSWORD FOR %USER% FROM %IP
%!"';
};
type "INVALID user" {
match = "PAM: Authentication failure for illegal user %USER%
from";
threshold = 0;
interval = 100;
reaction = 'info_dialog.py "SSH: INVALID USER %USER% HACKING?"';
};
};
--------------------------
The above works! But: I don't understand why the last match doesn't
work if it instead say:
type "INVALID user" {
match = "PAM: Authentication failure for illegal user %USER% from
%IP%";
threshold = 0;
interval = 100;
reaction = 'info_dialog.py "SSH: INVALID USER %USER% HACKING? FROM
%IP%"';
};
Then no reaction appears for the last match....
I must be really stupid or else something is wrong. Log example:
----------------------------
May 11 02:06:36 Apple com.apple.SecurityServer: authinternal
authenticated user macster (uid 502).
May 11 02:06:36 Apple com.apple.SecurityServer: Succeeded authorizing
right system.login.tty by process /usr/sbin/sshd for authorization
created by /usr/sbin/sshd.
May 11 02:06:36 Apple sshd[1748]: Accepted keyboard-interactive/pam
for macster from 192.38.95.23 port 38045 ssh2
May 13 20:25:24 Apple sshd[4519]: error: PAM: Authentication failure
for illegal user bg from localhost
May 13 20:25:24 Apple sshd[4519]: Failed keyboard-interactive/pam for
invalid user bg from 127.0.0.1 port 59703 ssh2
May 13 20:26:04 Apple sshd[4531]: Invalid user bg from 127.0.0.1
May 13 20:26:04 Apple sshd[4531]: Failed none for invalid user bg from
127.0.0.1 port 59705 ssh2
May 13 20:26:05 Apple com.apple.SecurityServer: authinternal failed to
authenticate user bg.
May 13 20:26:05 Apple com.apple.SecurityServer: Failed to authorize
right system.login.tty by process /usr/sbin/sshd for authorization
created by /usr/sbin/sshd.
May 13 20:26:05 Apple sshd[4531]: error: PAM: Authentication failure
for illegal user bg from localhost
May 13 20:26:05 Apple sshd[4531]: Failed keyboard-interactive/pam for
invalid user bg from 127.0.0.1 port 59705 ssh2
May 13 20:28:03 Apple sshd[4535]: error: ssh_msg_send: write
May 13 20:28:03 Apple sshd[4535]: error: ssh_msg_send: write
May 13 20:28:03 Apple sshd[4535]: error: ssh_msg_send: write
May 13 20:30:36 Apple sshd[4541]: Invalid user bg from 127.0.0.1
May 13 20:30:36 Apple sshd[4541]: Failed none for invalid user bg from
127.0.0.1 port 59717 ssh2
May 13 20:30:37 Apple com.apple.SecurityServer: authinternal failed to
authenticate user bg.
May 13 20:30:37 Apple com.apple.SecurityServer: Failed to authorize
right system.login.tty by process /usr/sbin/sshd for authorization
created by /usr/sbin/sshd.
May 13 20:30:37 Apple sshd[4541]: error: PAM: Authentication failure
for illegal user bg from localhost
May 13 20:30:37 Apple sshd[4541]: Failed keyboard-interactive/pam for
invalid user bg from 127.0.0.1 port 59717 ssh2
----------------------------
Can %IP% understand "localhost" instead of a number? Anything else
that could be wrong? hmmm.... I also tried to use %IP_first%,
%IP_second% and %IP_third% if perhaps grok wanted that... But no
luck.... hmmm...
Oh, well - in all cases everything works except that I didn't/don't
get the IP-address for the last match/case...