I'm trying to add an alternative port for ssh in my policy file, but somehow it
doesn't work. I get the following error message:
bro@nsm$ bro -r test.lpc tcp weird alarm ssh test print-filter
./test.bro, line 12 (ssh_ports): error, "redef" used but not previously defined
bro@nsm$
When I check the ssh.bro policy I can see that it is possible to redefine the
ssh_ports:
[ssh.bro]
..
global ssh_ports = { 22/tcp, } &redef;
..
[/ssh.bro]
Below is my test policy file:
[test.bro] @load site
redef local_nets: set[subnet] = {
10.1.1.0/24,
};
redef capture_filters += {
["ssh-alt"] = "tcp port 2122",
};
redef ssh_ports += {
2122/tcp,
};
[/test.bro]
I have tried to add the module name, but no luck.
bro@nsm$ bro -r test.lpc tcp weird alarm ssh test print-filter
./test.bro, line 12 (SSH::ssh_ports): error, "redef" used but not previously
defined
bro@nsm$
Hi,
If I apply your patch to policy/ssh.bro (move to export{})
and if I change policy/snort.bro (for example):
redef SSH::ssh_ports += { 2122/tcp };
bro work, but if I have a signature use ssh_ports is not work:
signature sid-1812 {
ip-proto == tcp
# dst-port == ssh_ports # <-----
event "EXPLOIT gobbles SSH exploit attempt"
tcp-state established,originator
payload /.*GOBBLES/
}
brov140ipv6 error:
Error in signature (.../policy/sigs/snort-default.sig:32): unknown script-level identifier (ssh_ports)
thx for reply and sorry for delay,
ok I have changed signature to (for example):
30:signature sid-1812 {
31: ip-proto == tcp
32: dst-port == SSH::ssh_ports
33: event "EXPLOIT gobbles SSH exploit attempt"
34: tcp-state established,originator
35: payload /.*GOBBLES/
36: }
bro140ipv6 give an error:
Error in signature (policy/sigs/snort-default.sig:32): unknown script-level identifier (SSH)
Error in signature (policy/sigs/snort-default.sig:32): parse error
Error in signature (policy/sigs/dpd.sig:1): parse error
dpd.sig unmodified file first line is:
# ALS signatures for protocol detection.
Oh, that looks like the signature parser can actually not deal with
module prefixes. The signatures were there before we introduced
modules and it looks like that never got adapted. Something for
the todo list.