Skip to content

Commit

Permalink
introduced an option to replace the dynamic login url check with a cu…
Browse files Browse the repository at this point in the history
…stom RegEx
  • Loading branch information
sbruggmann committed Aug 15, 2023
1 parent e60c526 commit b3a8c7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Classes/Middleware/IPAllowListMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
return $handler->handle($request);
}

preg_match('/^(' . ($this->settings['loginUri'] ?: 'neos') . ')?($|\/)/', $requestUri, $matches);
$regex = '/^(' . ($this->settings['loginUri'] ?: 'neos') . ')?($|\/)/';
if ($this->settings['loginUriRegex']) {
$regex = $this->settings['loginUriRegex'];
}
preg_match($regex, $requestUri, $matches);
if ($matches) {
$serverParamsIpKeys = Arrays::getValueByPath($this->settings, 'allowedIPs.serverParamsIpKeys');
ksort($serverParamsIpKeys);
Expand Down
2 changes: 2 additions & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ JvMTECH:
NeosHardening:
loginUri: ''
# loginUri: 'neos-random-suffix'
loginUriRegex: ''
# loginUriRegex: '/^(neos)?($|\/)/'

# allowedIPs: []
allowedIPs:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ composer require jvmtech/neos-hardening
NeosHardening:
loginUri: 'neos-random-suffix'
```
- Replace the dynamic login url check with a custom RegEx (not needed if you just replace `loginUri`):
```
JvMTECH:
NeosHardening:
loginUriRegex: '/^(neos)?($|\/)/'
```
- Limit login interface access to specified ip addresses:
```
JvMTECH:
Expand Down

0 comments on commit b3a8c7f

Please sign in to comment.