Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a93920c
feat(os): collect the operating system status
karlitschek Oct 19, 2026
cb03b1b
fix(os): treat missing package lists as unknown updates
karlitschek Oct 22, 2026
1239adb
fix(os): report unknown, exit 3, when the updates are not known
karlitschek Oct 22, 2026
3969aa9
fix(os): count a pending security update per package, not per version
karlitschek Oct 22, 2026
9506173
fix(os): no core-library reboot for systemd or in system containers
karlitschek Oct 22, 2026
d34987f
fix(os): keep each error threshold at or above its warning threshold
karlitschek Oct 22, 2026
44c5653
fix(os): collect the operating system status only from system cron
karlitschek Oct 22, 2026
99c5a70
fix(os): no support dates for Raspbian or NixOS unstable
karlitschek Oct 22, 2026
4f03654
docs(os): list what is read and run, the exit code 3 and the cron req…
karlitschek Oct 22, 2026
8b2e3ef
fix(build): regenerate the license files from the locked dependencies
karlitschek Oct 22, 2026
fd4824d
fix(os): never count interrupted command output as complete
karlitschek Oct 22, 2026
b657907
fix(os): try apt when open_basedir hides it, and remember missing bin…
karlitschek Oct 23, 2026
1646fa9
fix(os): take the package list age from verified files, not lists/par…
karlitschek Oct 23, 2026
b0abb69
fix(os): no permanent "kernel removed" for provider and netboot kernels
karlitschek Oct 23, 2026
339fe40
fix(os): require a package change before a core library asks for a re…
karlitschek Oct 23, 2026
1cf6bab
fix(os): keep the PHP process's first sighting under its own key
karlitschek Oct 23, 2026
a50c89a
perf(os): keep the collected status in app data, not in app config
karlitschek Oct 23, 2026
eb766cc
fix(os): warn about an old status, and keep one failing probe from en…
karlitschek Oct 23, 2026
dcb41d3
refactor(os): give SupportTable a constructor without a scalar parameter
karlitschek Oct 23, 2026
040fa0f
docs(os): describe only what this part of the stack delivers
karlitschek Oct 23, 2026
1e51140
fix(os): only store apt updates whose names and versions look like apt's
karlitschek Oct 23, 2026
e7077e7
fix(os): count apt updates as security only from the distribution's a…
karlitschek Oct 23, 2026
c9be88c
refactor(os): declare occ serverinfo:os-status with attributes
karlitschek Oct 23, 2026
fe47511
feat(os): add an optional root helper
karlitschek Oct 19, 2026
52b3db4
fix(os): run needrestart without its interpreter scan in the root helper
karlitschek Oct 23, 2026
3c2a461
fix(os): check the installed rpm version like every other report value
karlitschek Oct 23, 2026
25fa226
fix(os): read dnf restarts from the cache and parse every dnf update row
karlitschek Oct 23, 2026
3948f26
fix(os): count only system services in the helper's /proc fallback
karlitschek Oct 23, 2026
8dc0526
test(os): cover the root helper's report directory checks
karlitschek Oct 23, 2026
69dc0fa
fix(os): lock, time-limit and clean up root helper runs
karlitschek Oct 23, 2026
efadcd6
docs(os): install the root helper from a release archive
karlitschek Oct 23, 2026
fd07be3
fix(os): tell unreadable and future helper reports apart
karlitschek Oct 23, 2026
c517ecf
docs(os): extract the root helper into a private directory
karlitschek Oct 23, 2026
f3d1c12
fix(os): check every directory above the helper's report
karlitschek Oct 23, 2026
fb0801e
feat(os): support dnf, zypper, pacman and apk
karlitschek Oct 19, 2026
67acccf
refactor(os): share the file-age and error-line helpers, query rpm once
karlitschek Oct 23, 2026
678d1d8
fix(os): accept every rpm architecture
karlitschek Oct 23, 2026
19364f9
fix(os): run dnf 4 only as dnf-3 and leave any other dnf to the helper
karlitschek Oct 23, 2026
466bdfe
fix(os): count needs-restarting as a reboot only when it says so
karlitschek Oct 23, 2026
9f85968
fix(os): join the wrapped lines of dnf 4 check-update
karlitschek Oct 23, 2026
940aed0
fix(os): leave dnf updates unclassified without usable updateinfo
karlitschek Oct 23, 2026
3dbd330
fix(os): accept zypper's informational exit codes and report a lock a…
karlitschek Oct 23, 2026
c83e9f8
fix(os): no all-clear from failed pacman queries or months-old databases
karlitschek Oct 23, 2026
fc1686e
feat(os): let admins keep the Arch queries offline
karlitschek Oct 23, 2026
2c0bcd4
fix(os): apk on postmarketOS, every holding world constraint, offline
karlitschek Oct 23, 2026
e75d002
test(os): cover which package manager each distribution gets
karlitschek Oct 23, 2026
047656b
fix(os): name timeouts and try hidden package managers on every distr…
karlitschek Oct 23, 2026
7df36ce
docs(os): name where the Arch queries connect to
karlitschek Oct 23, 2026
f4766c2
feat(os): report operating system concerns where admins look
karlitschek Oct 19, 2026
2a2ba07
fix(os): fill in the release and date in support sentences
karlitschek Oct 23, 2026
8b7866b
fix(os): skip non-string items in list facts of a concern
karlitschek Oct 23, 2026
bdbd220
fix(os): link the setup checks to the absolute page URL
karlitschek Oct 23, 2026
4433991
fix(os): send the operating system block in the API only on request
karlitschek Oct 23, 2026
b8624e6
perf(os): read and judge the stored status once per request
karlitschek Oct 23, 2026
0d2b50f
fix(os): keep notifications of concerns that have not cleared
karlitschek Oct 23, 2026
d9a2fcb
fix(os): notify later admins once and never notify twice
karlitschek Oct 23, 2026
bfd0923
fix(os): hide the server health widget where nothing is checked
karlitschek Oct 23, 2026
78b57b5
fix(os): say in the setup checks and the widget when the status is old
karlitschek Oct 23, 2026
07ede78
fix(os): no "reboot required" headline when the reboot state is unknown
karlitschek Oct 23, 2026
095dbd2
docs(os): list the PHP library check where it starts to run
karlitschek Oct 23, 2026
f512c5b
fix(os): show the operating system setup checks to admins only
karlitschek Oct 23, 2026
0bf4e10
fix(os): escape the setup check text before the Overview renders it
karlitschek Oct 23, 2026
6a88ce7
fix(os): drop operating system notifications of users who are no long…
karlitschek Oct 23, 2026
d68de64
fix(os): do not sample the PHP process in restricted mode or off Linux
karlitschek Oct 23, 2026
263e61d
feat(os): add the Operating system page
karlitschek Oct 19, 2026
a4efd5f
chore(assets): recompile assets
karlitschek Oct 19, 2026
eeffcc4
fix(os): check now in the background instead of in the request
karlitschek Oct 23, 2026
7c59908
fix(os): install the root helper from a fresh copy of the app
karlitschek Oct 23, 2026
8173452
fix(os): send restart and reboot commands for the init system in use
karlitschek Oct 23, 2026
c4f1c80
fix(os): show all updates when none of them is a security update
karlitschek Oct 23, 2026
aecfdc2
fix(os): reject incomplete alert settings with 400
karlitschek Oct 23, 2026
2e7b34a
ci(actions): run the frontend tests
karlitschek Oct 23, 2026
32a87c3
fix(os): take the concern sentences from the server
karlitschek Oct 23, 2026
d07ae85
fix(os): name unsupported systems, plain-text translations, pill group
karlitschek Oct 23, 2026
00baa41
fix(os): show on the page when the status is old
karlitschek Oct 23, 2026
6e8013e
fix(os): spread the helper's cron runs in the setup dialog too
karlitschek Oct 23, 2026
5327fc7
fix(os): confirm the password before the alert settings change
karlitschek Oct 23, 2026
7cf25c3
fix(os): extract the helper into a private directory in the setup dialog
karlitschek Oct 23, 2026
1d4bed4
chore(assets): recompile assets
karlitschek Oct 23, 2026
34014ec
chore(assets): recompile assets
karlitschek Oct 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Node tests

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

concurrency:
group: node-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest-low
permissions:
contents: read
pull-requests: read

outputs:
src: ${{ steps.changes.outputs.src}}

steps:
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- '__tests__/**'
- '__mocks__/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '**.js'
- '**.ts'
- '**.vue'

test:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Read package.json node and npm engines version
uses: nextcloud-libraries/parse-package-engines-action@39fcc545a815c353dd0a3fd8fd2ef6e59fd02b92 # v0.2.0
id: versions

- name: Set up node ${{ steps.versions.outputs.node-version }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ steps.versions.outputs.node-version }}

- name: Set up npm ${{ steps.versions.outputs.package-manager-version }}
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present

- name: Test
run: npm run test --if-present

- name: Test and process coverage
run: npm run test:coverage --if-present

- name: Collect coverage
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: ./coverage/lcov.info

summary:
permissions:
contents: none
runs-on: ubuntu-latest-low
needs: [changes, test]

if: always()

name: test-summary

steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi
2 changes: 2 additions & 0 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.nextcloudignore
.php-cs-fixer.dist.php
.tx/
build/
eslint.config.mjs
l10n/.gitkeep
psalm.xml
Expand All @@ -14,3 +15,4 @@ src/
tests/
vendor-bin/
vite.config.mjs
vitest.config.mjs
146 changes: 146 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,123 @@ provided end-points.
This app is part of the standard Nextcloud package and can be found in the
directory **nextcloud/apps/serverinfo**

## Operating system

The **Operating system** page shows what keeps the Linux distribution under
Nextcloud secure:

- pending updates, security fixes first, with the packages Nextcloud itself
runs on (PHP, the web server, the database, Redis …) marked
- whether a reboot is needed, and why (a newer kernel, updated core libraries,
the distribution asking for one), with live kernel patches taken into account
- whether the PHP serving Nextcloud still runs libraries that an update
replaced, and which service to restart
- how long the release still receives security updates, and whether a paid
extension (Ubuntu Pro or Debian ELTS) is active
- automatic updates, package list age, held packages, failed system services,
time synchronisation, SELinux and AppArmor

Debian, Ubuntu, RHEL and its rebuilds, Fedora, openSUSE and SLES, Arch and
Alpine are supported. Inside Docker, Podman, Kubernetes or a snap the page says
what can and cannot be known from inside; LXC and systemd-nspawn guests are
treated like machines without a kernel of their own.

Nothing is installed or changed. Each command shown on the page is for the
admin to copy. To find out, the app reads `/etc/os-release`, `/proc` (uptime,
`/proc/1/cgroup`, its own process maps), `/sys/class/dmi/id`,
`/sys/kernel/livepatch`, the SELinux and AppArmor state under `/sys`, the
package manager's configuration, state and logs, `/run/reboot-required` and the
installed kernel modules. It runs the package manager's query commands (updates
only in simulation mode), `systemctl`, `timedatectl`, `chronyc` and
`systemd-detect-virt`. Anything it may not read or run is reported as unknown.

These queries stay offline, with one exception: on Arch, `checkupdates`
downloads the package databases from the mirrors in
`/etc/pacman.d/mirrorlist` into a temporary directory of the web server user,
and `arch-audit` fetches the security advisories from security.archlinux.org.
These are the only outbound connections the operating system status makes. To keep Arch offline as well, run
`occ config:app:set serverinfo os_allow_network --type=boolean --value=false`.
Pending updates then come from the databases root last synced, the age of
those databases counts as the package list age, and security fixes are not
told apart.

The status is collected by a background job once an hour, when background
jobs run from system cron; under AJAX or webcron the commands would hold a web
request for minutes. A status older than three job intervals (at least six
hours), or background jobs that do not run from system cron, count as a
warning, so an old all-clear is never shown as current. "Check now" on the page
queues a check for the next cron run and shows the result when it is done;
only one check runs at a time. Admins can also run:

```
occ serverinfo:os-status [--refresh] [--output=json]
```

The command shows how old the status is and exits with 0, 1, 2 or 3 for ok,
warning, error and unknown, so it can be used as a monitoring check. Unknown means the status has not been
collected yet, or nothing is wrong but the pending updates could not be
determined. The same verdict appears as setup checks on Settings → Overview
(only for admins; sub-admins, who may load the setup checks too, get no
details), in a notification to admins when a concern escalates, and in the
**Server health** dashboard widget for admins. When something counts as a
warning or an error can be adjusted on the page.

Release support dates are bundled with the app (see
`build/update-os-support.php`, data from [endoflife.date](https://endoflife.date),
MIT License); the app never looks them up online.

### Root helper

The web server cannot see everything: only root can tell which services still
run code an update replaced, and only root can refresh the package lists. On
Fedora and other systems with dnf 5, only root can list pending updates at all:
dnf 5 would first copy its whole cache into the web server's home. The
optional script `bin/serverinfo-os-report` adds all of that. Run as root, it writes a
small JSON report that the app reads. It only reads the system; it never
installs, upgrades, restarts or reboots anything.

Install it outside the Nextcloud directory: the web server can write there, so
a root cron job pointing into it would hand the web server root.

Take the file from a freshly extracted release archive, not from the
installed app: the Nextcloud server archive, checked against the SHA-256 sum
or signature published next to it on download.nextcloud.com, or the app's own
release archive. A copy taken from `apps/serverinfo/bin` is safe from changes
made after copying, but not from a web server that was already compromised
and changed the file before. `cmp` shows whether the installed app's file
still matches the release. Repeat this when an update ships a newer helper
(the app then reports the installed helper as outdated). The release archive
does not contain this README; the same instructions are at the top of the
script.

Extract the file into a new directory that only you can enter, which
`mktemp -d` creates, so that no one can swap it before root installs it.
Remove that directory afterwards.

```
d=$(mktemp -d) &&
tar -xjf nextcloud-<version>.tar.bz2 -C "$d" nextcloud/apps/serverinfo/bin/serverinfo-os-report &&
sudo install -o root -g root -m 0755 "$d"/nextcloud/apps/serverinfo/bin/serverinfo-os-report /usr/local/sbin/ &&
rm -r "$d"
echo '17 */6 * * * root /usr/local/sbin/serverinfo-os-report --refresh --random-delay' | sudo tee /etc/cron.d/serverinfo-os-report
```

`--random-delay` waits up to 30 minutes first, so that servers sharing this
cron line do not all reach the package mirrors at the same minute; leave it
out when running the helper by hand. Where `flock` is available, a run that
finds another one still going exits without doing anything. Package manager
calls are stopped after a time limit where `timeout` is available.

The report is written to `/var/lib/serverinfo/os-report.json`. Use
`--output` and `occ config:app:set serverinfo os_helper_report_path --value …`
to put it elsewhere. Every directory on the way to the report must be owned
by root, writable by no one else and no symbolic link; the helper refuses to
write anywhere else, such as below /tmp or the Nextcloud directory. The app
ignores a report that anyone but root could have written, on the same rules
as far as open_basedir lets it check, one written before the last reboot or
on another host, one older than 26 hours, and one dated more than five
minutes in the future (a clock problem).

## API

The API provides a lot of information about a running Nextcloud
Expand All @@ -31,6 +148,35 @@ https://<nextcloud-fqdn>/ocs/v2.php/apps/serverinfo/api/v1/info
- To request the information in JSON append the url parameter `format=json`
- Use the url parameter `skipUpdate=true` to omit server updates.
- Use the url parameter `skipApps=true` to omit app updates (including available app updates will send an external request to the app store).
- Use the url parameter `skipOs=false` to include the operating system status.

The operating system status in `server.os` holds counts and flags only, never
package names, package or kernel versions, or advisories, so a leaked token
does not reveal what is unpatched. Values that could not be determined are
`null`:

```json
"os": {
"state": "ok",
"level": "warning",
"collectedAt": 1792411200,
"outdated": false,
"name": "Ubuntu 24.04.3 LTS",
"environment": "host",
"container": null,
"updates": { "classified": true, "security": 7, "total": 23, "pendingDays": 5, "held": 0 },
"rebootRequired": true,
"rebootPendingDays": 2,
"phpRestartRequired": false,
"servicesNeedRestart": null,
"support": { "state": "supported", "ends": "2029-05-31", "daysLeft": 954 },
"automaticUpdates": "enabled",
"listsAgeHours": 4,
"timeSynchronized": true,
"failedUnits": 0,
"helper": "absent"
}
```

### Example XML output:
```
Expand Down
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ path = "css/**.css"
precedence = "aggregate"
SPDX-FileCopyrightText = "Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = "resources/os-support.json"
precedence = "aggregate"
SPDX-FileCopyrightText = "2020 endoflife.date contributors"
SPDX-License-Identifier = "MIT"
6 changes: 4 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<id>serverinfo</id>
<name>Monitoring</name>
<summary>Monitoring app with useful server information</summary>
<description>Provides useful server information, such as CPU load, RAM usage, disk usage, number of users, etc.</description>
<version>8.0.0-dev.0</version>
<description>Provides useful server information, such as CPU load, RAM usage, disk usage, number of users, etc. Shows pending operating system updates, required reboots and service restarts, and how long the Linux distribution is still supported.</description>
<version>8.0.0-dev.1</version>
<licence>AGPL-3.0-or-later</licence>
<author>Bjoern Schiessle</author>
<author>Ivan Sein Santiago</author>
Expand All @@ -24,10 +24,12 @@
<background-jobs>
<job>OCA\ServerInfo\Jobs\UpdateStorageStats</job>
<job>OCA\ServerInfo\Jobs\UpdateJobStats</job>
<job>OCA\ServerInfo\Jobs\UpdateOsStatus</job>
</background-jobs>
<commands>
<command>OCA\ServerInfo\Commands\UpdateStorageStats</command>
<command>OCA\ServerInfo\Commands\UpdateJobStats</command>
<command>OCA\ServerInfo\Commands\ShowOsStatus</command>
</commands>
<settings>
<admin>OCA\ServerInfo\Settings\AdminSettings</admin>
Expand Down
3 changes: 3 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
['name' => 'database#settings', 'url' => '/database/settings', 'verb' => 'GET'],
['name' => 'database#updateSettings', 'url' => '/database/settings', 'verb' => 'PUT'],
['name' => 'database#testConnection', 'url' => '/database/test-connection', 'verb' => 'POST'],
['name' => 'os#status', 'url' => '/os', 'verb' => 'GET'],
['name' => 'os#refresh', 'url' => '/os/refresh', 'verb' => 'POST'],
['name' => 'os#updateSettings', 'url' => '/os/settings', 'verb' => 'PUT'],
],
'ocs' => [
['name' => 'api#info', 'url' => '/api/v1/info', 'verb' => 'GET'],
Expand Down
Loading
Loading