nextcloud / nextcloud/serverinfo

Function `getAppsInfo()`as used by `serverinfo` provokes IP-ban (Connection refused) by apps.nextcloud.com

Open
#503 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug
Dominant language
JavaScript
Stars
130
Forks
64
Avg merge
1d 1h
Merged PRs (30d)
49

Description

I reported this already in the appstore issue-tracker: https://github.com/nextcloud/appstore/issues/1137
I'm posting this here, because I observed this behavior only when the AppstoreFetcher is called by serverinfo.

Steps to reproduce
  1. make sure apps.nextcloud.com is accessible:
serverprompt:~# echo -e "\nResponse-Code: $(curl -Lo /dev/null -w "%{http_code}" apps.nextcloud.com)\n==================\n"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   320  100   320    0     0   8396      0 --:--:-- --:--:-- --:--:--  8421
100  301k  100  301k    0     0   271k      0  0:00:01  0:00:01 --:--:--  319k

Response-Code: 200
==================
  1. tail -f your logfile: tail -F $(nextcloud logfile) | jq and keep it open
  2. open serverinfo in a browser tab
  3. whait for log message as below.
  4. close serverinfo tab, since the message repeates every 5 minutes.
  5. recheck accessibility as under 1:
serverprompt:~# echo -e "\nResponse-Code: $(curl -Lo /dev/null -w "%{http_code}" apps.nextcloud.com)\n==================\n"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to apps.nextcloud.com port 80 after 22 ms: Connection refused

Response-Code: 000
==================
Expected behaviour

no impairments in the connection to apps.nextcloud.com

Actual behaviour

The affected IP get banned/blocked by apps.nextcloud.com.
Since it is my home network, I can easily fetch a new IP but every time a serverinfo tab is opened (no matter what instance, even newly setup in a virtual machine) it get banned again.
Because in my case it's the WAN Ip of my home network, i can not reach the appstore in my browser eather.

Server configuration

Operating system:
Ubuntu 22.04.3 LTS
Web server:
Apache2
Database:
MySQL and PostgeSQL
PHP version:
8.1.0 and 8.2.10
Nextcloud version: (see Nextcloud admin page)
27+

Client configuration

Browser:
Chrome, Brave, Opera
Operating system:
Windows, Linux, Mac

Nextcloud log (data/owncloud.log)
{
  "reqId": "5snl2JvDWBJ4eLJYKjN7",
  "level": 2,
  "time": "2023-09-14T08:46:28+02:00",
  "remoteAddr": "192.168.188.36",
  "user": "ernolf",
  "app": "appstoreFetcher",
  "method": "GET",
  "url": "/apps/serverinfo/update",
  "message": "Could not connect to appstore: cURL error 7: Failed to connect to apps.nextcloud.com port 443 after 41 ms: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://apps.nextcloud.com/api/v1/apps.json",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
  "version": "27.1.0.5",
  "data": {
    "app": "appstoreFetcher"
  }
}
My workaround:

coment this line: https://github.com/nextcloud/serverinfo/blob/544bacf952cc94ea0d6ec1a828e1de4971acbb94/lib/SystemStatistics.php#L74

//			'apps' => $this->getAppsInfo()

I hope this helps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/SystemStatistics.php at the getAppsInfo() call referenced in the workaround, then trace the /apps/serverinfo/update request and the appstoreFetcher log entry for https://apps.nextcloud.com/api/v1/apps.json. Reproduce the request while monitoring connectivity to apps.nextcloud.com. Done means opening serverinfo no longer causes the appstore connection to be blocked or impaired.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.