Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden - archive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
713
Warden
Warden - archive
Commits
59fa5883
Commit
59fa5883
authored
10 years ago
by
Tomáš Plesník
Browse files
Options
Downloads
Patches
Plain Diff
uprava info hlasek a doplneni komentaru
parent
2d1d429a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/warden-server/lib/Warden.pm
+16
-14
16 additions, 14 deletions
src/warden-server/lib/Warden.pm
with
16 additions
and
14 deletions
src/warden-server/lib/Warden.pm
+
16
−
14
View file @
59fa5883
...
...
@@ -206,7 +206,7 @@ sub saveNewEvent
my
$valid
=
'
t
';
# registered sender has valid events
my
$received
=
DateTime
->
now
;
# time of event delivery (UTC)
# parse object (event)
parameters
# parse object (event)
item
my
$service
=
$data
->
{'
SERVICE
'};
my
$detected
=
$data
->
{'
DETECTED
'};
my
$type
=
$data
->
{'
TYPE
'};
...
...
@@ -222,31 +222,33 @@ sub saveNewEvent
# authorize incoming client
my
%client
=
authorizeClient
(
$alt_names
,
$ip
,
$service
,
$client_type
,
$function_name
);
if
(
defined
%client
)
{
# log incoming event
sendMsg
("
debug
",
"
Incoming event: [client_id: '
$client
{'client_id'}', service: '
$service
', detected: '
$detected
', type: '
$type
', source_type: '
$source_type
', source: '
$source
', target_proto: '
$target_proto
', target_port: '
$target_port
', attack_scale: '
$attack_scale
', note: '
$note
', priority: '
$priority
', timeout: '
$timeout
']
",
undef
);
# check event entries 'event_type' and 'source_type' (based on VALIDATION HASH)
if
(
%
WardenCommon::
VALID_STRINGS
)
{
# check if hash is not empty - use VALIDATION HASH
# check event item: 'detected'
# http://my.safaribooksonline.com/book/programming/regular-expressions/9780596802837/4dot-validation-and-formatting/id2983571
if
(
$detected
!~
/^((?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?/
)
{
sendMsg
("
err
",
"
Unknown item 'detected' from client '
$client
{'client_id'}': '
$detected
'
",
"
Unknown detected time format: '
$detected
'
");
}
# check event item: 'event_type' and 'source_type' (based on VALIDATION HASH)
if
(
%
WardenCommon::
VALID_STRINGS
)
{
if
(
!
(
exists
$
WardenCommon::
VALID_STRINGS
{'
type
'}
&&
grep
$type
eq
$_
,
@
{
$
WardenCommon::
VALID_STRINGS
{'
type
'}}))
{
sendMsg
("
err
",
"
Unknown event_type from client '
$client
{'client_id'}': '
$type
'
",
"
Unknown
item '
event_type
'
from client '
$client
{'client_id'}': '
$type
'
",
"
Unknown event type: '
$type
'
");
}
elsif
(
!
(
exists
$
WardenCommon::
VALID_STRINGS
{'
source_type
'}
&&
grep
$source_type
eq
$_
,
@
{
$
WardenCommon::
VALID_STRINGS
{'
source_type
'}}))
{
sendMsg
("
err
",
"
Unknown source_type from client '
$client
{'client_id'}': '
$source_type
'
",
"
Unknown
item '
source_type
'
from client '
$client
{'client_id'}': '
$source_type
'
",
"
Unknown source type: '
$source_type
'
");
}
}
# http://my.safaribooksonline.com/book/programming/regular-expressions/9780596802837/4dot-validation-and-formatting/id2983571
if
(
$detected
!~
/^((?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?/
)
{
sendMsg
("
err
",
"
Unknown detected time format from client '
$client
{'client_id'}': '
$detected
'
",
"
Unknown detected time format: '
$detected
'
");
}
# check other event entries
# check event items: target_port, attack_scale, priority, timeout
my
@change_list
;
if
(
defined
$target_port
&&
$target_port
!~
/^\d+\z/
)
{
push
(
@change_list
,
"
target_port: '
$target_port
'
");
...
...
@@ -271,7 +273,7 @@ sub saveNewEvent
my
$change_string
=
join
("
,
",
@change_list
);
unless
(
$change_string
eq
"")
{
sendMsg
("
info
",
"
Unknown other event
entrie
s from client '
$client
{'client_id'}': (
$change_string
)
",
"
Unknown other event
item
s from client '
$client
{'client_id'}': (
$change_string
)
",
undef
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment