Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/robin/ssh-by-platform'
Browse files Browse the repository at this point in the history
* origin/topic/robin/ssh-by-platform:
  [authorized_keys] Split file globs by platform.
  • Loading branch information
rsmmr committed Jan 9, 2024
2 parents db8b9e1 + 18a419e commit c195ae4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.3.0-dev.5 | 2024-01-09 08:54:27 +0100

* `authorized_keys`: Split file globs by platform. Scanning
`/home/*` can cause trouble on macOS so we now maintain separate
globs per platform.

2.3.0-dev.3 | 2022-07-12 10:57:09 +0200

* By default, listen on 0.0.0.0 for WebSocket. Zeek's default is 127.0.0.1.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0-dev.3
2.3.0-dev.5
20 changes: 13 additions & 7 deletions scripts/table/ssh.zeek
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export {
"/etc/ssh/sshd_config.d/*");

## Paths to find `authorized_keys` files in.
option key_paths_to_watch = set("/home/*/.ssh/authorized_keys",
"/Users/*/.ssh/authorized_keys");
option key_paths_to_watch: table[string] of set[string] = {
["linux"] = set("/home/*/.ssh/authorized_keys"),
["darwin"] = set("/Users/*/.ssh/authorized_keys")
};

## Query frequency.
option query_interval = 30 secs;
Expand Down Expand Up @@ -119,12 +121,16 @@ event zeek_init()
$path="zeek-agent-ssh-authorized-keys",
$field_name_map=field_name_map_keys]);

for ( p in key_paths_to_watch )

for ( platform in key_paths_to_watch )
{
local stmt_keys = fmt("SELECT * FROM files_lines(\"%s\")", p);
ZeekAgent::query([$sql_stmt=stmt_keys, $event_=query_result_keys,
$schedule_=query_interval,
$subscription=subscription]);
for ( path in key_paths_to_watch[platform] )
{
local stmt_keys = fmt("SELECT * FROM files_lines(\"%s\")", path);
ZeekAgent::query([$sql_stmt=stmt_keys, $event_=query_result_keys,
$schedule_=query_interval,
$subscription=subscription], ZeekAgent::Group, platform);
}
}
}
}

0 comments on commit c195ae4

Please sign in to comment.