Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
MetaGer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
54
Issues
54
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
MetaGer
Commits
597b68c9
Commit
597b68c9
authored
Dec 23, 2020
by
Dominik Hebeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added logging to browserverification
parent
41fd2162
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
app/Http/Middleware/BrowserVerification.php
app/Http/Middleware/BrowserVerification.php
+26
-1
No files found.
app/Http/Middleware/BrowserVerification.php
View file @
597b68c9
...
...
@@ -61,7 +61,9 @@ class BrowserVerification
$request
->
request
->
add
([
"headerPrinted"
=>
false
,
"jskey"
=>
$mgv
]);
return
$next
(
$request
);
}
else
{
return
redirect
(
"/"
);
# We are serving that request but log it for fail2ban
self
::
logBrowserverification
(
$request
);
return
$next
(
$request
);
}
}
...
...
@@ -86,4 +88,27 @@ class BrowserVerification
->
with
(
'url'
,
$url
)
->
render
());
}
public
static
logBrowserverification
()
{
$fail2banEnabled
=
config
(
"metager.metager.fail2ban_enabled"
);
if
(
empty
(
$fail2banEnabled
)
||
!
$fail2banEnabled
||
!
env
(
"fail2banurl"
,
false
)
||
!
env
(
"fail2banuser"
)
||
!
env
(
"fail2banpassword"
)){
return
;
}
// Submit fetch job to worker
$mission
=
[
"resulthash"
=>
"captcha"
,
"url"
=>
env
(
"fail2banurl"
)
.
"/browserverification/"
,
"useragent"
=>
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0"
,
"username"
=>
env
(
"fail2banuser"
),
"password"
=>
env
(
"fail2banpassword"
),
"headers"
=>
[
"ip"
=>
$request
->
ip
()
],
"cacheDuration"
=>
0
,
"name"
=>
"Captcha"
,
];
$mission
=
json_encode
(
$mission
);
Redis
::
rpush
(
\
App\MetaGer
::
FETCHQUEUE_KEY
,
$mission
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment