Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to list available routes #23251

Closed
wants to merge 2 commits into from

Conversation

PVince81
Copy link
Member

@PVince81 PVince81 commented Oct 7, 2020

Can be useful for debugging or for setting up firewalls or gateways.

From owncloud/core#28901 and owncloud/core#28642

Tested manually with occ security:routes and occ security:routes -d

@PVince81 PVince81 added this to the Nextcloud 21 milestone Oct 7, 2020
@PVince81 PVince81 self-assigned this Oct 7, 2020
@nickvergessen nickvergessen added the 3. to review Waiting for reviews label Oct 7, 2020
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@PVince81
Copy link
Member Author

PVince81 commented Oct 7, 2020

thanks. seems this file was quite old already

@nickvergessen
Copy link
Member

It lists /ocsapp/ should we string replace that with /ocs/v{version}.php/?

@PVince81 PVince81 force-pushed the feature/noid/add-occ-list-routes branch 2 times, most recently from bcbb181 to ef9e35e Compare October 7, 2020 10:33
PVince81 and others added 2 commits October 7, 2020 14:57
Can be useful for debugging or for setting up firewalls or gateways.

Signed-off-by: Vincent Petry <[email protected]>
Co-authored-by: Joas Schilling <[email protected]>
Replace "/ocsapp/" with "/ocs/v{version.php}/" in the security:routes
output.

Signed-off-by: Vincent Petry <[email protected]>
@PVince81 PVince81 force-pushed the feature/noid/add-occ-list-routes branch from ef9e35e to 2700d9a Compare October 7, 2020 12:58
@PVince81
Copy link
Member Author

PVince81 commented Oct 7, 2020

adjusted and squashed


protected function configure(): void {
$this
->setName('security:routes')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this in security?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly because useful to evaluate what routes are available for firewalls/gateways/..., knowing what routes could be accessible

@@ -187,6 +187,7 @@
$application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
$application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));
$application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
$application->add(\OC::$server->get(OC\Core\Command\Security\ListRoutes::class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is for debugging we should maybe only add it when debud mode is on, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above: an admin can use it to find out what routes are exposed for firewall/gateway/... setup. sometimes there are strict firewalls in place and one needs to know what to add to the "allowed lists"

@faily-bot
Copy link

faily-bot bot commented Oct 7, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 33801: failure

checkers

Show full log
The autoloaders are not up to date
Please run: bash build/autoloaderchecker.sh
And commit the result

mysql8.0-php7.4

  • cancelled - typically means that the tests took longer than the drone CI allows them to run

@MorrisJobke
Copy link
Member

  • bug: -d option causes an exception for me:
php occ security:routes -d                                                                                                                                                       1 ↵
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
An unhandled exception has been thrown:
TypeError: preg_match_all() expects parameter 2 to be string, bool given in /Users/morris/Projects/nextcloud/server/core/Command/Security/ListRoutes.php:149
Stack trace:
#0 /Users/morris/Projects/nextcloud/server/core/Command/Security/ListRoutes.php(149): preg_match_all('/@([A-Z]\\w+)/', false, NULL)
#1 /Users/morris/Projects/nextcloud/server/core/Command/Security/ListRoutes.php(76): OC\Core\Command\Security\ListRoutes->buildController('logreader.log.g...')
#2 /Users/morris/Projects/nextcloud/server/apps2/deck/vendor/symfony/console/Command/Command.php(258): OC\Core\Command\Security\ListRoutes->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Users/morris/Projects/nextcloud/server/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /Users/morris/Projects/nextcloud/server/apps2/deck/vendor/symfony/console/Application.php(920): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /Users/morris/Projects/nextcloud/server/apps2/deck/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Security\ListRoutes), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /Users/morris/Projects/nextcloud/server/apps2/deck/vendor/symfony/console/Application.php(142): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /Users/morris/Projects/nextcloud/server/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /Users/morris/Projects/nextcloud/server/console.php(100): OC\Console\Application->run()
#9 /Users/morris/Projects/nextcloud/server/occ(11): require_once('/Users/morris/P...')
#10 {main}% 

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 31, 2020
@rullzer rullzer mentioned this pull request Dec 14, 2020
59 tasks
@rullzer rullzer modified the milestones: Nextcloud 21, Nextcloud 22 Dec 15, 2020
@MorrisJobke MorrisJobke mentioned this pull request May 20, 2021
@MorrisJobke
Copy link
Member

@PVince81 🏓

@PVince81
Copy link
Member Author

I have the feeling that there is no real use or interest for this feature, so I'll close it

@PVince81 PVince81 closed this May 20, 2021
@MorrisJobke MorrisJobke deleted the feature/noid/add-occ-list-routes branch May 21, 2021 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants