diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d225c765..24afdbf1c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,73 @@ # Changelog +## [16.2.3] - 2026-10-21 + +Added: + +- PHP: 20 apps load a shared hardening ini against CVE-2026-109618/109619 +- PHP: Moodle, Nextcloud and Shopware FPM workers restart every 200 requests +- Agents: *i8-release-article* drafts release articles, banners and posts + +Changed: + +- PHP: *expose_php* and *session.upload_progress* are off in all hardened apps +- PHP: *memory_limit* is unlimited for now; Joomla and Magento keep theirs +- Proxy: no openresty version and no *X-Powered-By*; HSTS lasts one year + +Fixed: + +- Install: an end-of-life distro Node.js is replaced by the current LTS +- Install: the upstream Node.js install stops on non-Linux hosts +- Moodle: ES module URLs ending in *.js* reach Moodle instead of a 404 +- BigBlueButton: the welcome help link points at the documentation +- Tests: the Bluesky public API CSP origin is no longer probed as a page +- CI: swarm diagnostics collect package manager logs first, on every node + +Version jumps (net since 16.2.2): + +- *web-app-erpnext*: v16.51.2 to v16.52.0 +- *web-app-gitlab*: v19.5.0 to v19.5.1 +- *web-app-n8n*: 2.45.0 to 2.45.1 +- *web-app-pixelfed*: 20261020 to 20261021 +- *web-app-prometheus*: v3.15.0 to v3.15.1 + +Upgrade notes: + +- PHP: the first deploy recreates every PHP container once for the new mount +- PHP: pull patched images (PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12) and redeploy +- PHP: drop *memory_limit = -1* from *hardening.ini* after patched images +- Friendica: account imports are capped at 64 MiB while the limit is unlimited +- Akaunting (PHP 8.1) and FusionDirectory (PHP 7.4) stay unpatched; see TODOs + +Contributors: + +- [Kevin Veen-Birkenbach](https://veen.world): PHP hardening, Node.js, Moodle + +## [16.2.2] - 2026-10-21 + +Fixed: + +- Moodle: a fresh install with MCP enabled mints its token on Moodle 5.3 +- Moodle: debug deployments keep the component cache; swarm pages load fast +- Playwright: a stuck image pull times out and retries instead of hanging + +Version jumps (net since 16.2.1): + +- *svc-ai-ollama*: 0.40.6 to 0.40.7 +- *svc-runner*: BuildKit v0.34.0 to v0.34.1 +- *web-app-erpnext*: v16.51.1 to v16.51.2 +- *web-app-opentalk*: RabbitMQ 4.3.6 to 4.4.0 +- *web-app-wazuh*: 4.14.6 to 4.14.9 +- *web-app-xwiki*: AI LLM 0.10 to 0.11, OIDC authenticator 2.29.0 to 2.29.1 + +Upgrade notes: + +- Device backup: the device needs a filesystem like ext4 or xfs, not FAT + +Contributors: + +- [Kevin Veen-Birkenbach](https://veen.world): Moodle, Playwright pull + ## [16.2.1] - 2026-10-20 Fixed: diff --git a/Dockerfile b/Dockerfile index 25e3f98710..a2213d53d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ RUN set -euo pipefail; \ COPY default.env ${INFINITO_SRC_DIR}/default.env COPY scripts/install ${INFINITO_SRC_DIR}/scripts/install COPY roles/dev-python/files/shell ${INFINITO_SRC_DIR}/roles/dev-python/files/shell +COPY roles/update/files/shell/centos_mirror.sh ${INFINITO_SRC_DIR}/roles/update/files/shell/centos_mirror.sh COPY requirements ${INFINITO_SRC_DIR}/requirements COPY utils/__init__.py ${INFINITO_SRC_DIR}/utils/__init__.py COPY utils/install/__init__.py ${INFINITO_SRC_DIR}/utils/install/__init__.py @@ -36,6 +37,7 @@ COPY utils/install/collections.py ${INFINITO_SRC_DIR}/utils/install/collections. # hadolint ignore=DL3008,DL3033,DL3041,SC1090,SC3040 RUN set -euo pipefail; \ + /bin/bash "${INFINITO_SRC_DIR}/roles/update/files/shell/centos_mirror.sh"; \ source <(grep -hE '^INFINITO_PYTHON_INSTALL_SCRIPT=' "${INFINITO_SRC_DIR}/default.env"); \ /bin/bash "${INFINITO_SRC_DIR}/${INFINITO_PYTHON_INSTALL_SCRIPT:?}" ensure; \ VENV="${INFINITO_VENV_DIR}" bash "${INFINITO_SRC_DIR}/scripts/install/venv.sh"; \ @@ -54,6 +56,7 @@ RUN set -euo pipefail; \ /bin/bash "${INFINITO_SRC_DIR}/${INFINITO_DOCKER_CLI_INSTALL_SCRIPT:?}"; \ /bin/bash "${INFINITO_SRC_DIR}/${INFINITO_PACKAGE_INSTALL_SCRIPT:?}"; \ /bin/bash "${INFINITO_SRC_DIR}/${INFINITO_FILESYSTEM_INSTALL_SCRIPT:?}"; \ + /bin/bash "${INFINITO_SRC_DIR}/roles/update/files/shell/centos_mirror.sh"; \ /bin/bash "${INFINITO_SRC_DIR}/${INFINITO_INTERPRETERS_INSTALL_SCRIPT:?}" RUN set -euo pipefail; \ diff --git a/TODO.md b/TODO.md index 48cc42d59f..e5edb52ecf 100644 --- a/TODO.md +++ b/TODO.md @@ -4,6 +4,7 @@ - Implement rbac administration interface - Enable IP6 for docker. - backup docker to local für ca optimieren +- Drop `memory_limit = -1` from [hardening.ini](roles/sys-svc-compose-php/files/hardening.ini) once every PHP image ships PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12 or later. It is the interim mitigation for CVE-2026-109618 and overrides the per-role `service_memory_mb` share, so a single request can exhaust the container instead of hitting a PHP limit. `web-app-joomla` keeps its own `memory_limit` because its media API compares uploads against it, and `web-app-magento` keeps the 756M its `nginx.conf.sample` (`PHP_VALUE`) and `pub/.user.ini` set; both keep `post_max_size` below a quarter of that limit. While the override is in place, `web-app-nextcloud` (`upload_limit` 5G at 3g) accepts POST bodies above a quarter of its container memory, `web-app-friendica` caps account imports at 64 MiB instead of half the memory limit, EspoCRM's System Requirements page flags `memory_limit` as failed, and Pixelfed (`InstanceService`), phpMyAdmin (import and export) and Snipe-IT (imports and LDAP sync) set a finite limit again via `ini_set` after the request has started. - Fork [rpardini/docker-registry-proxy](https://github.com/rpardini/docker-registry-proxy) and teach the bundled nginx to handle GCP Artifact Registry redirect URLs (`/artifacts-downloads/namespaces//repositories//downloads/`). Currently `gcr.io` blob pulls are bypassed via `NO_PROXY=…,gcr.io,storage.googleapis.com,googleusercontent.com` in [compose/registry-cache/proxy.conf](compose/registry-cache/proxy.conf), which is a workaround that disables caching for those registries. Long-term: rebase upstream's `proxy.conf` / `sub_filter` rules to recognise the new redirect shape, ship the fix in our fork, point `compose/registry-cache/Dockerfile` (or its image tag) at the fork, and drop the `NO_PROXY` bypass. ## Testing diff --git a/docs/agents/action/release-article.md b/docs/agents/action/release-article.md new file mode 100644 index 0000000000..a1c5e735f8 --- /dev/null +++ b/docs/agents/action/release-article.md @@ -0,0 +1,50 @@ +# Release Articles + +Write the [blog](https://blog.infinito.nexus/) article for a release, its banner image, and the Mastodon and LinkedIn posts that announce it. +The article is one HTML file for a single WordPress Custom HTML block; the banner is a separate PNG for the post's Featured image and the image of both social posts. + +## Inputs + +- The release version (for example `16.0`) and its tag. When the `.0` tag was never published, the first published patch tag is the release tag and its upgrade notes count too. +- The release sections of [CHANGELOG.md](../../../CHANGELOG.md). +- The latest article in the Release category of the blog, as the reference for length, tone and structure. + +## Output + +- You MUST write every file to a work folder outside the repository and MUST NOT commit the article or the banner. +- The work folder holds `article.html`, `banner.svg`, `banner.png` (1500 × 1000), `banner-alt.txt`, `mastodon.txt`, `linkedin.txt` and `post.md` (title, category, tags). + +## Procedure + +1. Read the release sections of the changelog. Take the headline feature from the operator, otherwise the largest `Added` entry. Read the README of the role behind it so every claim is right. +2. Fetch the reference article and measure its body, from `
` to its end: visible text characters (SVG icons excluded), words and markup lines. The new article MUST land within ±5 % on characters and on lines. +3. Copy [templates/article.html](../../../skills/i8-release-article/templates/article.html) and fill it in its order: badge; intro and a second paragraph; the warning (major releases only, otherwise drop the block); three feature cards; one or two sections on the headline feature with a bold-lead list; the callout; an optional "Also New" section; Before You Upgrade; More Reliable (three or four fixes); Updated Applications (about thirteen chips from the version jumps, major versions first); the closing section. Repeat card, list item, table row and chip blocks as needed and remove every `{{…}}` placeholder. +4. Write every sentence to the standard below. +5. Copy [templates/banner.svg](../../../skills/i8-release-article/templates/banner.svg) and fill it: `{{LOGO}}` with the `file://` URL of [assets/img/logo.png](../../../assets/img/logo.png), `{{VERSION}}`, two subtitle lines of at most 34 characters, four `{{ICON_n}}` (24 × 24 outline icons) and four `{{LABEL_n}}` (plain words, at most 14 characters) for the headline feature's benefits. +6. Render the banner with Playwright's headless shell (`~/.cache/ms-playwright/chromium_headless_shell-*/chrome-headless-shell-linux64/chrome-headless-shell`) and the flags `--disable-gpu --hide-scrollbars --allow-file-access-from-files --window-size=1500,1000 --screenshot=/banner.png file:///banner.svg`. Look at the PNG and fix overlaps or cut text before you go on. +7. Write `banner-alt.txt` (one to three sentences that describe the banner and repeat its title) and the two social posts to the Social Posts rules below, with `{{ARTICLE_URL}}` where the article link goes. +8. Verify: no `{{` left in the article; no ``, command, flag, path or variable in the visible text of the article or the posts; lengths within range on every platform; every number and version matches the changelog. Render the article on a dark page at about 860 px width and look at it. +9. Hand over the paths, the title, the category `Release`, ten to twenty tags, and the steps: paste the whole `article.html` into one WordPress Custom HTML block and set `banner.png` as the Featured image; once the article is live, replace `{{ARTICLE_URL}}` in both posts with its link and post them with `banner.png` and the alt text. + +## Writing Standard + +The article, the banner alt text and both social posts follow this standard. Their readers are outside the project, so deep technical detail stays out. + +- Feature-oriented: say what the reader gets and why it matters, not how it is built. +- No commands, flags, file paths, variable names, role names, inventory keys or code, and no `` tags. Product names, application names and version numbers are fine. +- Second person ("your servers"), present tense, short sentences, American English. +- Every claim MUST trace back to the changelog or to the README of the role behind it. No invented numbers, benefits or comparisons. Beta features say "beta". +- Section titles name a benefit ("A Private Network Between Your Servers"); list items open with a bold benefit lead. +- Before You Upgrade keeps every upgrade note of the changelog and phrases the action the reader takes, not the mechanism behind it. + +## Social Posts + +Both posts follow the Writing Standard like the article: no commands, role names or deep technical detail, only what the reader gets. They lead with the headline feature and carry the banner with its alt text. + +- **Mastodon** (`mastodon.txt`): at most 500 characters, counting the link as 23. An opening line naming the release, two or three sentences on the headline feature, one line on the rest of the release, a pointer to the upgrade notes, the link, then three to five CamelCase hashtags (`#InfinitoNexus`, `#SelfHosting`, `#OpenSource`, plus the headline technology). At most two emoji; plain and direct, no marketing superlatives. +- **LinkedIn** (`linkedin.txt`): 1,000 to 1,600 characters. A hook in the first line of at most 200 characters, since LinkedIn shows only the first lines before "see more"; then short paragraphs: what the headline feature gives an organization, three benefit lines each opened by one emoji, one paragraph on the rest of the release, the upgrade pointer, the link, and three to five hashtags. Professional tone, second person, no hype words. + +## Rules + +- You MUST NOT publish to, or sign in to, the blog, Mastodon or LinkedIn. The operator publishes. +- You MUST NOT add the banner to the article HTML; it belongs in the Featured image. diff --git a/docs/contributing/tools/agents/cheatsheet.md b/docs/contributing/tools/agents/cheatsheet.md index 1233c92a11..aa208454c5 100644 --- a/docs/contributing/tools/agents/cheatsheet.md +++ b/docs/contributing/tools/agents/cheatsheet.md @@ -37,5 +37,6 @@ from its procedure file. Run `make install-skills` to (re)install them. | Staged changes are ready to be committed | `i8-commit` | | A branch is ready to be opened as a pull request | `i8-pull-request` | | Pushing a branch through the manual-CI draft → ready-for-review cycle | `i8-push-trigger-pull` | +| Writing the blog article, banner image and social posts for a release | `i8-release-article` | | Writing a new requirement | `i8-requirement-create` | | Implementing an existing requirement file end to end | `i8-requirement-implement` | diff --git a/group_vars/all/05_paths.yml b/group_vars/all/05_paths.yml index c9f8cbe1e9..9683796ccf 100644 --- a/group_vars/all/05_paths.yml +++ b/group_vars/all/05_paths.yml @@ -29,6 +29,12 @@ FILE_DATABASE_SECRETS: "{{ [DIR_SECRETS, 'databases.csv'] | path_join }}" DIR_METRICS_TEXTFILE: "{{ [DIR_VAR_LIB, 'metrics'] | path_join }}" +DIR_PHP_HARDENING: "/etc/{{ SOFTWARE_DOMAIN }}/php" +PHP_HARDENING_INI_DIGEST: "{{ (lookup('file', lookup('path_absolute', 'roles/sys-svc-compose-php/files/hardening.ini')) | hash('sha1'))[:8] }}" +PHP_FPM_HARDENING_CONF_DIGEST: "{{ (lookup('template', lookup('path_absolute', 'roles/sys-svc-compose-php/templates/fpm-hardening.conf.j2')) | hash('sha1'))[:8] }}" +FILE_PHP_HARDENING_INI: "{{ [DIR_PHP_HARDENING, 'hardening-' ~ PHP_HARDENING_INI_DIGEST ~ '.ini'] | path_join }}" +FILE_PHP_FPM_HARDENING_CONF: "{{ [DIR_PHP_HARDENING, 'fpm-hardening-' ~ PHP_FPM_HARDENING_CONF_DIGEST ~ '.conf'] | path_join }}" + DIR_RESCUE_DIAGNOSTICS: "/tmp/infinito-rescue-diagnostics" FILE_DNS53_SAMPLER_LOG: "/var/log/infinito/dns53-sampler.log" diff --git a/group_vars/all/17_resource.yml b/group_vars/all/17_resource.yml index 4392f54ade..9facac24fe 100644 --- a/group_vars/all/17_resource.yml +++ b/group_vars/all/17_resource.yml @@ -49,4 +49,6 @@ POSTGRES_SUPERUSER_RESERVED_CONNECTIONS: 3 POSTGRES_MAX_LOCKS_PER_TRANSACTION: 256 POSTGRES_DELAY: 2 +PHP_FPM_MAX_REQUESTS: 200 + TIMEOUT_FACTOR: 1 diff --git a/library/database_query.py b/library/database_query.py index 5cf6971b15..30ec772d6b 100755 --- a/library/database_query.py +++ b/library/database_query.py @@ -109,7 +109,7 @@ _ENGINES: dict[str, dict[str, object]] = { "user_flag": "-U", "db_flag": "-d", "shared_flags": ["-v", "ON_ERROR_STOP=1"], - "rows_flags": ["-tA"], + "rows_flags": ["-qtA"], "row_separator": "|", "password_env": "PGPASSWORD", "string_quote": "'", diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index 3d0f24b702..7202b5daf5 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Kevin Veen-Birkenbach pkgname=infinito-nexus -pkgver=16.2.1 +pkgver=16.2.3 pkgrel=1 pkgdesc="Meta package for Infinito.Nexus host dependencies (dev + CI)." arch=('any') diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 103fd7dd93..a7dfb7c7f8 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,75 @@ +infinito-nexus (16.2.3-1) unstable; urgency=medium + + Added: + + - PHP: 20 apps load a shared hardening ini against CVE-2026-109618/109619 + - PHP: Moodle, Nextcloud and Shopware FPM workers restart every 200 requests + - Agents: *i8-release-article* drafts release articles, banners and posts + + Changed: + + - PHP: *expose_php* and *session.upload_progress* are off in all hardened apps + - PHP: *memory_limit* is unlimited for now; Joomla and Magento keep theirs + - Proxy: no openresty version and no *X-Powered-By*; HSTS lasts one year + + Fixed: + + - Install: an end-of-life distro Node.js is replaced by the current LTS + - Install: the upstream Node.js install stops on non-Linux hosts + - Moodle: ES module URLs ending in *.js* reach Moodle instead of a 404 + - BigBlueButton: the welcome help link points at the documentation + - Tests: the Bluesky public API CSP origin is no longer probed as a page + - CI: swarm diagnostics collect package manager logs first, on every node + + Version jumps (net since 16.2.2): + + - *web-app-erpnext*: v16.51.2 to v16.52.0 + - *web-app-gitlab*: v19.5.0 to v19.5.1 + - *web-app-n8n*: 2.45.0 to 2.45.1 + - *web-app-pixelfed*: 20261020 to 20261021 + - *web-app-prometheus*: v3.15.0 to v3.15.1 + + Upgrade notes: + + - PHP: the first deploy recreates every PHP container once for the new mount + - PHP: pull patched images (PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12) and redeploy + - PHP: drop *memory_limit = -1* from *hardening.ini* after patched images + - Friendica: account imports are capped at 64 MiB while the limit is unlimited + - Akaunting (PHP 8.1) and FusionDirectory (PHP 7.4) stay unpatched; see TODOs + + Contributors: + + - [Kevin Veen-Birkenbach](https://veen.world): PHP hardening, Node.js, Moodle + + -- Kevin Veen-Birkenbach Wed, 21 Oct 2026 22:02:43 +0200 + +infinito-nexus (16.2.2-1) unstable; urgency=medium + + Fixed: + + - Moodle: a fresh install with MCP enabled mints its token on Moodle 5.3 + - Moodle: debug deployments keep the component cache; swarm pages load fast + - Playwright: a stuck image pull times out and retries instead of hanging + + Version jumps (net since 16.2.1): + + - *svc-ai-ollama*: 0.40.6 to 0.40.7 + - *svc-runner*: BuildKit v0.34.0 to v0.34.1 + - *web-app-erpnext*: v16.51.1 to v16.51.2 + - *web-app-opentalk*: RabbitMQ 4.3.6 to 4.4.0 + - *web-app-wazuh*: 4.14.6 to 4.14.9 + - *web-app-xwiki*: AI LLM 0.10 to 0.11, OIDC authenticator 2.29.0 to 2.29.1 + + Upgrade notes: + + - Device backup: the device needs a filesystem like ext4 or xfs, not FAT + + Contributors: + + - [Kevin Veen-Birkenbach](https://veen.world): Moodle, Playwright pull + + -- Kevin Veen-Birkenbach Wed, 21 Oct 2026 13:00:11 +0200 + infinito-nexus (16.2.1-1) unstable; urgency=medium Fixed: diff --git a/packaging/fedora/infinito-nexus.spec b/packaging/fedora/infinito-nexus.spec index 198d8b1f29..e8587b6019 100644 --- a/packaging/fedora/infinito-nexus.spec +++ b/packaging/fedora/infinito-nexus.spec @@ -1,5 +1,5 @@ Name: infinito-nexus -Version: 16.2.1 +Version: 16.2.3 Release: 1%{?dist} Summary: Meta package for Infinito.Nexus host dependencies @@ -58,6 +58,72 @@ install -d %{buildroot}%{_docdir}/%{name} %doc %{_docdir}/%{name}/DEPENDENCIES %changelog +* Wed Oct 21 2026 Kevin Veen-Birkenbach - 16.2.3-1 +- Added: + +- - PHP: 20 apps load a shared hardening ini against CVE-2026-109618/109619 +- - PHP: Moodle, Nextcloud and Shopware FPM workers restart every 200 requests +- - Agents: *i8-release-article* drafts release articles, banners and posts + +- Changed: + +- - PHP: *expose_php* and *session.upload_progress* are off in all hardened apps +- - PHP: *memory_limit* is unlimited for now; Joomla and Magento keep theirs +- - Proxy: no openresty version and no *X-Powered-By*; HSTS lasts one year + +- Fixed: + +- - Install: an end-of-life distro Node.js is replaced by the current LTS +- - Install: the upstream Node.js install stops on non-Linux hosts +- - Moodle: ES module URLs ending in *.js* reach Moodle instead of a 404 +- - BigBlueButton: the welcome help link points at the documentation +- - Tests: the Bluesky public API CSP origin is no longer probed as a page +- - CI: swarm diagnostics collect package manager logs first, on every node + +- Version jumps (net since 16.2.2): + +- - *web-app-erpnext*: v16.51.2 to v16.52.0 +- - *web-app-gitlab*: v19.5.0 to v19.5.1 +- - *web-app-n8n*: 2.45.0 to 2.45.1 +- - *web-app-pixelfed*: 20261020 to 20261021 +- - *web-app-prometheus*: v3.15.0 to v3.15.1 + +- Upgrade notes: + +- - PHP: the first deploy recreates every PHP container once for the new mount +- - PHP: pull patched images (PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12) and redeploy +- - PHP: drop *memory_limit = -1* from *hardening.ini* after patched images +- - Friendica: account imports are capped at 64 MiB while the limit is unlimited +- - Akaunting (PHP 8.1) and FusionDirectory (PHP 7.4) stay unpatched; see TODOs + +- Contributors: + +- - [Kevin Veen-Birkenbach](https://veen.world): PHP hardening, Node.js, Moodle + +* Wed Oct 21 2026 Kevin Veen-Birkenbach - 16.2.2-1 +- Fixed: + +- - Moodle: a fresh install with MCP enabled mints its token on Moodle 5.3 +- - Moodle: debug deployments keep the component cache; swarm pages load fast +- - Playwright: a stuck image pull times out and retries instead of hanging + +- Version jumps (net since 16.2.1): + +- - *svc-ai-ollama*: 0.40.6 to 0.40.7 +- - *svc-runner*: BuildKit v0.34.0 to v0.34.1 +- - *web-app-erpnext*: v16.51.1 to v16.51.2 +- - *web-app-opentalk*: RabbitMQ 4.3.6 to 4.4.0 +- - *web-app-wazuh*: 4.14.6 to 4.14.9 +- - *web-app-xwiki*: AI LLM 0.10 to 0.11, OIDC authenticator 2.29.0 to 2.29.1 + +- Upgrade notes: + +- - Device backup: the device needs a filesystem like ext4 or xfs, not FAT + +- Contributors: + +- - [Kevin Veen-Birkenbach](https://veen.world): Moodle, Playwright pull + * Tue Oct 20 2026 Kevin Veen-Birkenbach - 16.2.1-1 - Fixed: diff --git a/plugins/lookup/compose_file_args.py b/plugins/lookup/compose_file_args.py index e935d8f6c6..1f05a45e29 100644 --- a/plugins/lookup/compose_file_args.py +++ b/plugins/lookup/compose_file_args.py @@ -30,6 +30,7 @@ from ansible.errors import AnsibleError from ansible.plugins.loader import lookup_loader from ansible.plugins.lookup import LookupBase +from plugins.filter.role_path_by_app_id import abs_role_path_by_application_id from utils.docker.paths_utils import get_docker_paths from utils.templating.jinja import render_strict @@ -80,7 +81,7 @@ def _has_domain(domains: Any, application_id: str) -> bool: return _value_has_domain(domains) -def _role_provides_override(*, application_id: str, templar: Any) -> bool: +def _role_provides_override(*, application_id: str) -> bool: """ Mirror tasks/04_files.yml "with_first_found" logic: @@ -89,22 +90,10 @@ def _role_provides_override(*, application_id: str, templar: Any) -> bool: Only if one of these exists, we append "-f ". """ - tpl = getattr(templar, "template", None) - if not callable(tpl): - raise AnsibleError( - "compose_file_args: templar is required to resolve abs_role_path_by_application_id" - ) - - role_base = _as_str(tpl("{{ application_id | abs_role_path_by_application_id }}")) - if not role_base: - raise AnsibleError( - "compose_file_args: abs_role_path_by_application_id resolved to empty" - ) - - c1 = str(Path(role_base) / "templates" / "compose.override.yml.j2") - c2 = str(Path(role_base) / "files" / "compose.override.yml") - - return Path(c1).is_file() or Path(c2).is_file() + role_base = Path(abs_role_path_by_application_id(application_id)) + return (role_base / "templates" / "compose.override.yml.j2").is_file() or ( + role_base / "files" / "compose.override.yml" + ).is_file() class LookupModule(LookupBase): @@ -174,7 +163,7 @@ class LookupModule(LookupBase): parts = [f"{flag} {base}"] - if _role_provides_override(application_id=application_id, templar=templar): + if _role_provides_override(application_id=application_id): if not _as_str(override): raise AnsibleError( "compose_file_args: compose.files.compose_override is required " diff --git a/pyproject.toml b/pyproject.toml index a00a1d1f0b..6f8410cf74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "infinito-nexus" -version = "16.2.1" +version = "16.2.3" description = "Infinito.Nexus" readme = "README.md" requires-python = ">=3.11" diff --git a/roles/svc-ai-ollama/meta/services.yml b/roles/svc-ai-ollama/meta/services.yml index 94cc4f4124..b5c56f4140 100644 --- a/roles/svc-ai-ollama/meta/services.yml +++ b/roles/svc-ai-ollama/meta/services.yml @@ -13,7 +13,7 @@ ollama: backup: no_stop_required: true image: ollama/ollama - version: 0.40.6 + version: 0.40.8 name: ollama min_storage: 3473MB cpus: "4.0" diff --git a/roles/svc-db-qdrant/meta/services.yml b/roles/svc-db-qdrant/meta/services.yml index 7b363b9248..07111c24fd 100644 --- a/roles/svc-db-qdrant/meta/services.yml +++ b/roles/svc-db-qdrant/meta/services.yml @@ -12,7 +12,7 @@ qdrant: bond: 1 image: qdrant/qdrant name: qdrant - version: v1.19.2 + version: v1.20.0 min_storage: 270MB backup: database_routine: true diff --git a/roles/svc-opt-ssd-hdd/files/python/script.py b/roles/svc-opt-ssd-hdd/files/python/script.py index ba59e5caa3..91a12bb98e 100644 --- a/roles/svc-opt-ssd-hdd/files/python/script.py +++ b/roles/svc-opt-ssd-hdd/files/python/script.py @@ -38,10 +38,34 @@ def start_containers(containers): run_command(f"container start {container_list}") +DATABASE_IMAGES = { + "elasticsearch", + "mariadb", + "memcached", + "mongo", + "mysql", + "openldap", + "opensearch", + "postgis", + "postgres", + "qdrant", + "rabbitmq", + "redis", + "typesense", + "valkey", +} + + def is_database(image): - databases = {"postgres", "mariadb", "redis", "memcached", "mongo"} - prefix = image.split(":")[0] - return prefix in databases + """Tell whether an image reference names a database engine. + + Args: + image: reference as the container's `.Config.Image` reports it, with + optional registry, namespace, tag and digest; a locally built + `_custom` image counts as its engine. + """ + name = image.rsplit("/", 1)[-1].split("@")[0].split(":")[0] + return name.removesuffix("_custom") in DATABASE_IMAGES def is_symbolic_link(file_path): diff --git a/roles/sys-front-tls/templates/nginx_ssl_header.j2 b/roles/sys-front-tls/templates/nginx_ssl_header.j2 index 4ed2b5e9b2..6fc4b4f1a7 100644 --- a/roles/sys-front-tls/templates/nginx_ssl_header.j2 +++ b/roles/sys-front-tls/templates/nginx_ssl_header.j2 @@ -11,7 +11,7 @@ ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets on; -add_header Strict-Transport-Security max-age=15768000 always; +add_header Strict-Transport-Security max-age=31536000 always; ssl_stapling on; ssl_stapling_verify on; diff --git a/roles/sys-svc-compose-php/README.md b/roles/sys-svc-compose-php/README.md new file mode 100644 index 0000000000..c908bc9196 --- /dev/null +++ b/roles/sys-svc-compose-php/README.md @@ -0,0 +1,39 @@ +# sys-svc-compose-php + +## Description + +Internal helper role that installs the shared PHP hardening assets on the +stack host. PHP services of Docker Compose and Swarm stacks mount them as +configs from their own `meta/volumes.yml`. + +## Overview + +This role installs one PHP ini (`FILE_PHP_HARDENING_INI`) and one PHP-FPM pool +drop-in (`FILE_PHP_FPM_HARDENING_CONF`). A PHP role opts in by declaring a +`type: config` entry with that file as `source` and a file inside the scan dir +of its image as `target`, e.g. `conf.d/zz-infinito-hardening.ini` or, for the +pool, `php-fpm.d/zz-infinito-hardening.conf`. + +## Cosmos + +The diagram places sys-svc-compose-php in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks). + +```mermaid +flowchart LR + subgraph role [sys-svc-compose-php 💻] + svc_svc_compose_php["svc-compose-php"] + end +``` + +Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional (enabled only in matching deployments); red `0..0` edges are turned off in this role. Node markers show the role's deploy modes (💻 host, 🐳 compose, 🐝 swarm); ❌ marks a service that is explicitly turned off, and ⚙️ an Ansible role dependency declared in `meta/main.yml`. + +## Features + +- **PHP ini hardening:** `expose_php` off; `session.upload_progress.enabled = 0` and, on PHP 8.5 only, `fatal_error_backtraces = 0` against CVE-2026-109619; the interim `memory_limit = -1` against CVE-2026-109618. +- **PHP-FPM worker recycling:** `pm.max_requests` from `PHP_FPM_MAX_REQUESTS` for images whose `[www]` pool reads `php-fpm.d/*.conf`. + +## Credits + +Implemented by **[Kevin Veen-Birkenbach](https://www.veen.world)**. +Part of the [Infinito.Nexus Project](https://s.infinito.nexus/code) and maintained by [Kevin Veen-Birkenbach](https://www.veen.world). +Licensed under the [Infinito.Nexus Community License (Non-Commercial)](https://s.infinito.nexus/license). diff --git a/roles/sys-svc-compose-php/files/hardening.ini b/roles/sys-svc-compose-php/files/hardening.ini new file mode 100644 index 0000000000..2e5a25ec09 --- /dev/null +++ b/roles/sys-svc-compose-php/files/hardening.ini @@ -0,0 +1,4 @@ +expose_php = Off +session.upload_progress.enabled = 0 +fatal_error_backtraces = 0 +memory_limit = -1 diff --git a/roles/sys-svc-compose-php/meta/main.yml b/roles/sys-svc-compose-php/meta/main.yml new file mode 100644 index 0000000000..87d860482a --- /dev/null +++ b/roles/sys-svc-compose-php/meta/main.yml @@ -0,0 +1,32 @@ +--- +galaxy_info: + author: Kevin Veen-Birkenbach + description: Shared PHP hardening ini and PHP-FPM pool drop-in that PHP services of compose and swarm stacks mount as configs + license: Infinito.Nexus Community License (Non-Commercial) + company: | + Kevin Veen-Birkenbach + https://www.veen.world + galaxy_tags: + - docker + - compose + - php + - security + - hardening + issue_tracker_url: https://s.infinito.nexus/issues + min_ansible_version: "2.9" + platforms: + - name: ArchLinux + versions: + - all + - name: Debian + versions: + - all + - name: EL + versions: + - all + - name: Fedora + versions: + - all + - name: Ubuntu + versions: + - all diff --git a/roles/sys-svc-compose-php/meta/services.yml b/roles/sys-svc-compose-php/meta/services.yml new file mode 100644 index 0000000000..bc7ec96ead --- /dev/null +++ b/roles/sys-svc-compose-php/meta/services.yml @@ -0,0 +1,8 @@ +--- +svc-compose-php: + lifecycle: beta + required_by: + compose: + categories: [web] + swarm: + categories: [web] diff --git a/roles/sys-svc-compose-php/tasks/00_core.yml b/roles/sys-svc-compose-php/tasks/00_core.yml new file mode 100644 index 0000000000..c974b5eee9 --- /dev/null +++ b/roles/sys-svc-compose-php/tasks/00_core.yml @@ -0,0 +1,29 @@ +--- +- name: "📁 PHP hardening | ensure directory exists" + become: true + ansible.builtin.file: + path: "{{ DIR_PHP_HARDENING }}" + state: directory + mode: "0755" + owner: root + group: root + +- name: "🛡️ PHP hardening | install ini" + become: true + stack_host_copy: + src: "hardening.ini" + dest: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + owner: root + group: root + +- name: "🛡️ PHP hardening | render FPM pool" + become: true + stack_host_template: + src: "fpm-hardening.conf.j2" + dest: "{{ FILE_PHP_FPM_HARDENING_CONF }}" + mode: "0444" + owner: root + group: root + +- include_tasks: utils/once/flag.yml diff --git a/roles/sys-svc-compose-php/tasks/main.yml b/roles/sys-svc-compose-php/tasks/main.yml new file mode 100644 index 0000000000..8a06eb65a2 --- /dev/null +++ b/roles/sys-svc-compose-php/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include_tasks: 00_core.yml + when: run_once_sys_svc_compose_php is not defined diff --git a/roles/sys-svc-compose-php/templates/fpm-hardening.conf.j2 b/roles/sys-svc-compose-php/templates/fpm-hardening.conf.j2 new file mode 100644 index 0000000000..2a6019f93f --- /dev/null +++ b/roles/sys-svc-compose-php/templates/fpm-hardening.conf.j2 @@ -0,0 +1,2 @@ +[www] +pm.max_requests = {{ PHP_FPM_MAX_REQUESTS }} diff --git a/roles/sys-svc-compose/tasks/02_stack_host_prep.yml b/roles/sys-svc-compose/tasks/02_stack_host_prep.yml index 051a2bb18a..37631527a3 100644 --- a/roles/sys-svc-compose/tasks/02_stack_host_prep.yml +++ b/roles/sys-svc-compose/tasks/02_stack_host_prep.yml @@ -6,6 +6,10 @@ mode: "0755" with_dict: "{{ lookup('container', application_id, 'directories') }}" +- name: "🛡️ Ensure PHP hardening assets are installed" + ansible.builtin.include_role: + name: sys-svc-compose-php + - name: "📂 Include git-repo based installation routines for '{{ application_id }}'." include_tasks: "03_repository.yml" when: compose_repository_pull | bool diff --git a/roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2 b/roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2 index cb1b7e2a13..d01d61cdac 100644 --- a/roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2 +++ b/roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2 @@ -14,3 +14,4 @@ proxy_hide_header X-Frame-Options; proxy_hide_header X-XSS-Protection; proxy_hide_header X-Download-Options; proxy_hide_header X-Permitted-Cross-Domain-Policies; +proxy_hide_header X-Powered-By; diff --git a/roles/sys-svc-webserver-core/templates/nginx.conf.j2 b/roles/sys-svc-webserver-core/templates/nginx.conf.j2 index 7ee2aaa105..e8cfe19861 100644 --- a/roles/sys-svc-webserver-core/templates/nginx.conf.j2 +++ b/roles/sys-svc-webserver-core/templates/nginx.conf.j2 @@ -19,6 +19,7 @@ http } include mime.types; default_type text/html; + server_tokens off; add_header 'Vary' 'Origin' always; proxy_cache_path {{ lookup('nginx','directories.cache.general') }} levels=1:2 keys_zone=cache:20m max_size=20g inactive=14d use_temp_path=off; proxy_cache_path {{ lookup('nginx','directories.cache.image') }} levels=1:2 keys_zone=imgcache:10m inactive=60m use_temp_path=off; diff --git a/roles/update/README.md b/roles/update/README.md index fbdb3e21fd..17001c37cd 100644 --- a/roles/update/README.md +++ b/roles/update/README.md @@ -13,18 +13,21 @@ installed package on the host. This role refreshes the package index and upgrades every installed package on the host. `tasks/main.yml` reads `ansible_facts['distribution']` and dispatches -to one of three task files grouped by package-manager family. Debian and -Ubuntu both use `apt`, Fedora and CentOS both use `dnf`, so each pair shares a -single task file. A separate `unsupported.yml` fails loudly with a clear +to one task file per package-manager family. Debian and Ubuntu both use +`apt`, so they share a single task file; Fedora and CentOS both use `dnf`, and +CentOS reaches `fedora.yml` through `centos.yml`. A separate `unsupported.yml` fails loudly with a clear message when a host runs a distribution that this role does not yet cover. | `ansible_facts['distribution']` | Task file | Module | | ------------------------------- | ----------------- | -------------------------- | | `Archlinux` | `arch.yml` | `community.general.pacman` | | `Debian` / `Ubuntu` | `debian.yml` | `ansible.builtin.apt` | -| `Fedora` / `CentOS` | `fedora.yml` | `ansible.builtin.dnf` | +| `Fedora` | `fedora.yml` | `ansible.builtin.dnf` | +| `CentOS` | `centos.yml` | `ansible.builtin.dnf` | | anything else | `unsupported.yml` | `ansible.builtin.fail` | +`centos.yml` first runs [centos_mirror.sh](files/shell/centos_mirror.sh), which replaces every `metalink=` of the CentOS Stream repo files with a `baseurl=` on `mirror.stream.centos.org` and every `metalink=` of the EPEL repo files with the file's own `baseurl` template on `dl.fedoraproject.org`, and then includes `fedora.yml`. The [Dockerfile](../../Dockerfile) runs the same script before its first `dnf` call, so the CentOS dev and swarm-node images resolve against the same source. + ## Cosmos The diagram places Package update in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks). diff --git a/roles/update/files/shell/centos_mirror.sh b/roles/update/files/shell/centos_mirror.sh new file mode 100755 index 0000000000..0c69851241 --- /dev/null +++ b/roles/update/files/shell/centos_mirror.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +# Param: none. Rewrites the CentOS Stream and EPEL repo files in /etc/yum.repos.d in place and prints the metalink repo or EPEL file of everything it pinned; prints nothing when there is nothing left to pin, exits 1 on an EPEL file whose metalinks lack their baseurl template. +set -euo pipefail + +master="https://mirror.stream.centos.org" +repo_dir="/etc/yum.repos.d" + +[[ -f "${repo_dir}/centos.repo" ]] || exit 0 + +pin() { + local metalink_repo="$1" path="$2" file + for file in "${repo_dir}/centos.repo" "${repo_dir}/centos-addons.repo"; do + [[ -f "${file}" ]] || continue + grep -q -E "^metalink=https://mirrors\.centos\.org/metalink\?repo=${metalink_repo}&" "${file}" || continue + sed -i -E "s|^metalink=https://mirrors\.centos\.org/metalink\?repo=${metalink_repo}&.*\$|baseurl=${master}/${path}/|" "${file}" + echo "${metalink_repo/\[\$\]stream/\$stream}" + done +} + +declare -A directories=( + [baseos]=BaseOS + [appstream]=AppStream + [crb]=CRB + [highavailability]=HighAvailability + [nfv]=NFV + [rt]=RT + [resilientstorage]=ResilientStorage +) + +for name in "${!directories[@]}"; do + directory="${directories[${name}]}" + pin "centos-${name}-[\$]stream" "\$stream/${directory}/\$basearch/os" + pin "centos-${name}-debug-[\$]stream" "\$stream/${directory}/\$basearch/debug/tree" + pin "centos-${name}-source-[\$]stream" "\$stream/${directory}/source/tree" +done + +pin "centos-extras-sig-extras-common-[\$]stream" "SIGs/\$stream/extras/\$basearch/extras-common" +pin "centos-extras-sig-extras-common-source-[\$]stream" "SIGs/\$stream/extras/source/extras-common" + +pin_epel() { + local file="$1" metalinks templates + metalinks="$(awk '/^metalink=https:\/\/mirrors\.fedoraproject\.org\// { n++ } END { print n + 0 }' "${file}")" + templates="$(awk '/^#baseurl=https:\/\/download\.example\/pub\/epel\// { n++ } END { print n + 0 }' "${file}")" + [[ "${metalinks}" -gt 0 ]] || return 0 + if [[ "${templates}" -ne "${metalinks}" ]]; then + echo "ERROR: ${file} has ${metalinks} Fedora metalinks but ${templates} download.example baseurl templates" >&2 + exit 1 + fi + sed -i -E \ + -e 's|^#baseurl=https://download\.example/pub/epel/|baseurl=https://dl.fedoraproject.org/pub/epel/|' \ + -e '/^metalink=https:\/\/mirrors\.fedoraproject\.org\//d' \ + "${file}" + echo "${file##*/}" +} + +for file in "${repo_dir}"/epel*.repo; do + [[ -f "${file}" ]] || continue + pin_epel "${file}" +done diff --git a/roles/update/tasks/centos.yml b/roles/update/tasks/centos.yml new file mode 100644 index 0000000000..f09165b328 --- /dev/null +++ b/roles/update/tasks/centos.yml @@ -0,0 +1,8 @@ +--- +- name: "📌 update (dnf) | pin the CentOS Stream and EPEL repos to their master mirrors" + become: true + ansible.builtin.script: shell/centos_mirror.sh + register: update_centos_pinned + changed_when: update_centos_pinned.stdout | length > 0 + +- include_tasks: fedora.yml diff --git a/roles/update/tasks/fedora.yml b/roles/update/tasks/fedora.yml index dcbae4c85c..a7ad389c9f 100644 --- a/roles/update/tasks/fedora.yml +++ b/roles/update/tasks/fedora.yml @@ -7,8 +7,34 @@ line: "retries=10" insertafter: "^\\[main\\]" -- name: "🔄 update (dnf) | refresh dnf cache and upgrade all installed packages" - ansible.builtin.dnf: # nocheck: dynamic-package - full-system upgrade, not a package install - name: "*" - state: latest - update_cache: true +# Exception: under dnf5, ansible.builtin.dnf's update_cache expires no repo (it queries the repos before loading them), so cached metadata survives until metadata_expire. +- name: "🔄 update (dnf) | re-fetch the metadata of every enabled repository" + become: true + ansible.builtin.command: + argv: [dnf, makecache, --refresh] + changed_when: false + +- name: "🔄 update (dnf) | upgrade all installed packages" + block: + - name: "🔄 update (dnf) | refresh dnf cache and upgrade all installed packages" + ansible.builtin.dnf: # nocheck: dynamic-package - full-system upgrade, not a package install + name: "*" + state: latest + update_cache: true + rescue: + - name: "🛑 update (dnf) | re-raise anything but packages no mirror serves" # nocheck: rescue-recovery re-fetches metadata a mirror on the previous push served and retries once; the retry fails loud + ansible.builtin.fail: + msg: "{{ ansible_failed_result.msg }}" + when: ansible_failed_result.msg is not match('Failed to download packages') + + - name: "🧹 update (dnf) | drop the metadata a mirror still on the previous push served" + become: true + ansible.builtin.command: + argv: [dnf, clean, metadata] + changed_when: true + + - name: "🔄 update (dnf) | upgrade once more against fresh metadata" + ansible.builtin.dnf: # nocheck: dynamic-package - full-system upgrade, not a package install + name: "*" + state: latest + update_cache: true diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index 7592fdf08e..6a4341e2b8 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -10,7 +10,7 @@ 'Debian': 'debian.yml', 'Ubuntu': 'debian.yml', 'Fedora': 'fedora.yml', - 'CentOS': 'fedora.yml', + 'CentOS': 'centos.yml', }[ansible_facts['distribution']] | default('unsupported.yml') }} diff --git a/roles/web-app-akaunting/TODO.md b/roles/web-app-akaunting/TODO.md index 08cc6561fb..437f188b19 100644 --- a/roles/web-app-akaunting/TODO.md +++ b/roles/web-app-akaunting/TODO.md @@ -1,4 +1,5 @@ # To-dos - Enable OIDC +- Move off PHP 8.1. The role builds the image from `akaunting/docker` (`master`), whose Dockerfile starts `FROM php:8.1-apache` and runs PHP 8.1.34, which is end of life and gets no upstream fix for CVE-2026-109618 and CVE-2026-109619. Build on a PHP 8.2 or later base instead. - Add OIDC auto-provisioning so a fresh Keycloak user that lands on the akaunting tile lands on a working akaunting user account instead of a "no permission" surface. Until that is wired, BOTH the playwright biber and administrator personas are blocked via `PERSONA_BIBER_BLOCKED=true` and `PERSONA_ADMINISTRATOR_BLOCKED=true` in `templates/playwright.env.j2` (req 019 Rule 11 explicit opt-out). Once auto-provisioning works, drop both opt-out flags so the personas drive the real journey. diff --git a/roles/web-app-akaunting/meta/volumes.yml b/roles/web-app-akaunting/meta/volumes.yml index 285c180388..cb9b9ae88c 100644 --- a/roles/web-app-akaunting/meta/volumes.yml +++ b/roles/web-app-akaunting/meta/volumes.yml @@ -5,3 +5,10 @@ data: mounts: - service: akaunting target: /var/www/html +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: akaunting + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-bigbluebutton/README.md b/roles/web-app-bigbluebutton/README.md index b51b67a0ff..9a4911a4c2 100644 --- a/roles/web-app-bigbluebutton/README.md +++ b/roles/web-app-bigbluebutton/README.md @@ -48,8 +48,7 @@ flowchart LR svc_bbb_web["bbb-web"] svc_freeswitch["freeswitch"] svc_nginx["nginx"] - svc_etherpad["etherpad"] - svc_bbb_pads["bbb-pads"] + svc_bbb_shared_notes_server["bbb-shared-notes-server"] svc_bbb_export_annotations["bbb-export-annotations"] svc_webrtc_sfu["webrtc-sfu"] svc_fsesl_akka["fsesl-akka"] @@ -91,7 +90,7 @@ Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional ( - 🧱 Automatic `.env` templating and domain/NGINX integration - 🛠 Volume patching and Docker Compose customization - 📬 SMTP integration and Greenlight admin creation -- 🧪 Workarounds for known Docker Compose or Etherpad issues +- 🧪 Workarounds for known Docker Compose issues ## Quick Setup diff --git a/roles/web-app-bigbluebutton/files/javascript/ep_redis_publisher_index.js b/roles/web-app-bigbluebutton/files/javascript/ep_redis_publisher_index.js deleted file mode 100644 index 47fcdd9c15..0000000000 --- a/roles/web-app-bigbluebutton/files/javascript/ep_redis_publisher_index.js +++ /dev/null @@ -1,148 +0,0 @@ -// nocheck: mirrored-unit-test - requires ep_etherpad-lite's Settings module at load -// time and reads settings.ep_redis_publisher, so it cannot be imported outside an -// Etherpad install -const redis = require('redis'); -const settings = require('ep_etherpad-lite/node/utils/Settings'); -const logger = { error: (...args) => console.error('[ep_redis_publisher]', ...args) }; - -const CHANNEL = settings.ep_redis_publisher.channel || 'from-etherpad-redis-channel'; - -const sanitizeMessageBody = (body) => { - let response = { ...body }; - - if (response.pad && response.pad._db) { - response = { - ...response, - pad: { - ...response.pad, - _db: undefined, - }, - }; - } - - if (body?.pad?.id) { body.pad.padId = body.pad.id; } - - return response; -}; - -const getCircularReplacer = () => { - const seen = new WeakSet(); - - return (key, value) => { - if (typeof value === "object" && value !== null) { - if (seen.has(value)) return; - - seen.add(value); - } - - return value; - }; -}; - -const retry = (options) => { - if (options.error && options.error.code === 'ECONNREFUSED') { - logger.error('redis', 'connection refused'); - - return new Error('refused'); - } - - if (options.total_retry_time > 1000 * 60 * 60) { - logger.error('redis', 'retry exhausted'); - - return new Error('exhausted'); - } - - if (options.attempt > 10) { - logger.error('redis', 'attempt limit'); - - return undefined; - } - - return Math.min(options.attempt * 100, 3000); -}; - -const options = { - host: settings.ep_redis_publisher.host || '127.0.0.1', - port: settings.ep_redis_publisher.port || 6379, - retry_strategy: retry, -}; - -if (settings.ep_redis_publisher.password) { - options.password = settings.ep_redis_publisher.password; -} - -const publisher = redis.createClient(options); - -const buildEnvelope = (name) => { - - return { - name, - routing: { sender: 'etherpad' }, - timestamp: (new Date()).getTime(), - }; -}; - -const buildCore = (name, body) => { - - return { - header: { name }, - body, - }; -}; - -const build = (name, body) => { - - return JSON.stringify({ - envelope: buildEnvelope(name), - core: buildCore(name, sanitizeMessageBody(body)), - }, getCircularReplacer()); -}; - -exports.publish = (event, body) => { - let message; - switch (event) { - case 'loadSettings': - message = build('PadLoadSettingsSysMsg', body); - break; - case 'shutdown': - message = build('PadShutdownSysMsg', body); - break; - case 'expressConfigure': - message = build('PadConfigureSysMsg', body); - break; - case 'expressCreateServer': - message = build('PadCreateServerSysMsg', body); - break; - case 'expressCloseServer': - message = build('PadCloseServerSysMsg', body); - break; - case 'onAccessCheck': - message = build('PadAccessCheckSysMsg', body); - break; - case 'padCreate': - message = build('PadCreateSysMsg', body); - break; - case 'padLoad': - message = build('PadLoadSysMsg', body); - break; - case 'padUpdate': - message = build('PadUpdateSysMsg', body); - break; - case 'padCopy': - message = build('PadCopySysMsg', body); - break; - case 'padRemove': - message = build('PadRemoveSysMsg', body); - break; - case 'userLeave': - message = build('PadUserLeaveSysMsg', body); - break; - - default: - return; - } - - if (message) { - publisher.publish(CHANNEL, message); - } -}; diff --git a/roles/web-app-bigbluebutton/files/shell/etherpad_pg_entrypoint.sh b/roles/web-app-bigbluebutton/files/shell/etherpad_pg_entrypoint.sh deleted file mode 100644 index 64ede8aef2..0000000000 --- a/roles/web-app-bigbluebutton/files/shell/etherpad_pg_entrypoint.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -sed -i \ - -e 's#"dbType": "redis"#"dbType": "postgres"#' \ - -e "s#\"url\": \"redis://redis:6379\"#\"host\": \"${ETHERPAD_DB_HOST}\", \"port\": ${ETHERPAD_DB_PORT}, \"database\": \"${ETHERPAD_DB_NAME}\", \"user\": \"${ETHERPAD_DB_USER}\", \"password\": \"${ETHERPAD_DB_PASSWORD}\"#" \ - /opt/etherpad-lite/settings.json - -exec /entrypoint.sh diff --git a/roles/web-app-bigbluebutton/files/shell/postgres_initdb_etherpad.sh b/roles/web-app-bigbluebutton/files/shell/postgres_initdb_etherpad.sh deleted file mode 100644 index 11364c0015..0000000000 --- a/roles/web-app-bigbluebutton/files/shell/postgres_initdb_etherpad.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -eu - -: "${POSTGRES_USER:?set by the upstream compose file}" -: "${ETHERPAD_DB_NAME:?set in env.j2 and broadcast to every service}" - -if ! psql --username "${POSTGRES_USER}" --dbname postgres -tAc \ - "SELECT 1 FROM pg_database WHERE datname = '${ETHERPAD_DB_NAME}'" | grep -q 1; then - psql --username "${POSTGRES_USER}" --dbname postgres \ - -c "CREATE DATABASE \"${ETHERPAD_DB_NAME}\"" -fi diff --git a/roles/web-app-bigbluebutton/filter_plugins/compose_mods.py b/roles/web-app-bigbluebutton/filter_plugins/compose_mods.py index 24d0413510..fb7e5a8514 100644 --- a/roles/web-app-bigbluebutton/filter_plugins/compose_mods.py +++ b/roles/web-app-bigbluebutton/filter_plugins/compose_mods.py @@ -3,7 +3,9 @@ import re from utils.cache.yaml import dump_yaml_str, load_yaml_str -def compose_mods(yml_text, compose_repository_path, env_file, extra_hosts=None): +def compose_mods( + yml_text, compose_repository_path, env_file, extra_hosts=None, pinned=None +): """Normalize the upstream-generated bigbluebutton compose file. Args: @@ -14,6 +16,9 @@ def compose_mods(yml_text, compose_repository_path, env_file, extra_hosts=None): env_file: env file broadcast to every service via ``env_file``. extra_hosts: optional host mappings added to every service that is not on the host network. + pinned: names of services whose image the role pins in + compose.override.yml; their upstream ``build`` is dropped even + where the upstream file names no image. Returns: Transformed compose YAML text. Structural deltas (named data @@ -32,7 +37,7 @@ def compose_mods(yml_text, compose_repository_path, env_file, extra_hosts=None): data = load_yaml_str(yml_text) or {} services = data.get("services", {}) or {} - for svc in services.values(): + for name, svc in services.items(): if not isinstance(svc, dict): continue @@ -49,7 +54,7 @@ def compose_mods(yml_text, compose_repository_path, env_file, extra_hosts=None): hosts.append(entry) svc["extra_hosts"] = hosts - if "build" in svc and svc.get("image"): + if "build" in svc and (svc.get("image") or name in (pinned or [])): svc.pop("build") data["services"] = services diff --git a/roles/web-app-bigbluebutton/meta/secrets.yml b/roles/web-app-bigbluebutton/meta/secrets.yml index 8a14f2b6f1..e3683a6e83 100644 --- a/roles/web-app-bigbluebutton/meta/secrets.yml +++ b/roles/web-app-bigbluebutton/meta/secrets.yml @@ -4,10 +4,6 @@ credentials: description: Shared secret for BigBlueButton API authentication algorithm: sha256 validation: ^[a-f0-9]{64}$ - etherpad_api_key: - description: API key for Etherpad integration - algorithm: random_hex_32 - validation: ^[a-zA-Z0-9]{32}$ rails_secret: description: Secret key for Rails backend algorithm: random_hex diff --git a/roles/web-app-bigbluebutton/meta/services.yml b/roles/web-app-bigbluebutton/meta/services.yml index 887ca0d0da..b9a026c7b9 100644 --- a/roles/web-app-bigbluebutton/meta/services.yml +++ b/roles/web-app-bigbluebutton/meta/services.yml @@ -35,7 +35,7 @@ bigbluebutton: enabled: true shared: true repository: https://github.com/bigbluebutton/docker.git - ref: v3.0.23 + ref: v3.0.39 update: key: ref type: http_regex @@ -105,7 +105,7 @@ prometheus: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated bbb-web: image: alangecker/bbb-docker-web - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -115,7 +115,7 @@ bbb-web: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated freeswitch: image: alangecker/bbb-docker-freeswitch - version: "v1.10.12-v3.0.23" + version: "v1.11.3-v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -126,7 +126,7 @@ freeswitch: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated nginx: image: alangecker/bbb-docker-nginx - version: "v3.0.23-v5.4.4-1.29" + version: "v3.0.39-v5.4.8-1.29" update: type: http_regex url: @@ -137,32 +137,19 @@ nginx: enabled: false # nocheck: playwright-service-flag: prebuilt upstream-compose image, mirror pre-pull only # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated -etherpad: - image: alangecker/bbb-docker-etherpad - version: "2.4.2-s8328b77-p88f3f6b" - update: - type: http_regex - url: - - https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags - - https://raw.githubusercontent.com/bigbluebutton/docker/develop/docker-compose.tmpl.yml - pattern: "repos/bbb-etherpad-plugin (?P[0-9a-f]+)\\nrepos/bbb-etherpad-skin (?P[0-9a-f]+)\\n(?:.*\\n)*?.*bbb-docker-etherpad:(?P[0-9.]+)-s" - template: "{base}-s{skin}-p{plugin}" - enabled: false -# nocheck: playwright-service-flag: prebuilt upstream-compose image, mirror pre-pull only -# nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated -bbb-pads: - image: alangecker/bbb-docker-pads - version: "v1.5.8" +bbb-shared-notes-server: + image: alangecker/bbb-shared-notes-server + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags - pattern: "repos/bbb-pads (v[0-9.]+)" + pattern: "repos/bigbluebutton (v[0-9.]+)" enabled: false # nocheck: playwright-service-flag: prebuilt upstream-compose image, mirror pre-pull only # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated bbb-export-annotations: image: alangecker/bbb-docker-bbb-export-annotations - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -172,7 +159,7 @@ bbb-export-annotations: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated webrtc-sfu: image: alangecker/bbb-docker-webrtc-sfu - version: "v2.22.0" + version: "v2.24.0" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -182,7 +169,7 @@ webrtc-sfu: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated fsesl-akka: image: alangecker/bbb-docker-fsesl-akka - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -192,7 +179,7 @@ fsesl-akka: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated apps-akka: image: alangecker/bbb-docker-apps-akka - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -207,7 +194,7 @@ bbb-graphql-server: timeout: 10s retries: 5 image: alangecker/bbb-docker-graphql-server - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -217,7 +204,7 @@ bbb-graphql-server: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated bbb-graphql-actions: image: alangecker/bbb-docker-graphql-actions - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -227,7 +214,7 @@ bbb-graphql-actions: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated bbb-graphql-middleware: image: alangecker/bbb-docker-graphql-middleware - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -247,7 +234,7 @@ periodic: # nocheck: dynamic-flag: fixed upstream-compose sub-service, not group-gated recordings: image: alangecker/bbb-docker-recordings - version: "v3.0.23" + version: "v3.0.39" update: type: http_regex url: https://raw.githubusercontent.com/bigbluebutton/docker/develop/repos/tags @@ -267,7 +254,7 @@ bbb-webrtc-recorder: # nocheck: dynamic-flag: fixed upstream-compose helper, not group-gated dockerize: image: ghcr.io/jwilder/dockerize - version: "v0.15.2" + version: "v0.16.0" enabled: false # nocheck: playwright-service-flag, dynamic-flag infrastructure backup consumer diff --git a/roles/web-app-bigbluebutton/meta/volumes.yml b/roles/web-app-bigbluebutton/meta/volumes.yml index fc48d4e670..478bbded2f 100644 --- a/roles/web-app-bigbluebutton/meta/volumes.yml +++ b/roles/web-app-bigbluebutton/meta/volumes.yml @@ -62,25 +62,3 @@ coturn: mounts: - service: coturn target: /var/lib/coturn -ep_redis_publisher_patch: - type: bind - source: "{{ [lookup('container', 'web-app-bigbluebutton', 'directories.instance'), 'ep_redis_publisher_index.js'] | path_join }}" - read_only: true - mounts: - - service: etherpad - target: /opt/etherpad-lite/src/plugin_packages/.versions/ep_redis_publisher@0.0.3/index.js -etherpad_pg_entrypoint: - type: config - source: "{{ [lookup('container', 'web-app-bigbluebutton', 'directories.instance'), 'etherpad_pg_entrypoint.sh'] | path_join }}" - mode: "0444" - mounts: - - service: etherpad - target: /etherpad_pg_entrypoint.sh - -postgres_initdb_etherpad: - type: config - source: "{{ [lookup('container', 'web-app-bigbluebutton', 'directories.instance'), 'postgres_initdb_etherpad.sh'] | path_join }}" - mode: "0555" - mounts: - - service: postgres - target: /docker-entrypoint-initdb.d/zz-etherpad.sh diff --git a/roles/web-app-bigbluebutton/tasks/00_core/manager_ops.yml b/roles/web-app-bigbluebutton/tasks/00_core/manager_ops.yml index 24c5e4b44c..afb9259865 100644 --- a/roles/web-app-bigbluebutton/tasks/00_core/manager_ops.yml +++ b/roles/web-app-bigbluebutton/tasks/00_core/manager_ops.yml @@ -31,27 +31,6 @@ dest: "{{ [lookup('container', application_id, 'directories.instance'), 'compose.override.yml'] | path_join }}" notify: compose-up -- name: "🩹 Vendor the ep_redis_publisher fix mounted over the etherpad plugin" - stack_host_copy: - src: javascript/ep_redis_publisher_index.js - dest: "{{ [lookup('container', application_id, 'directories.instance'), 'ep_redis_publisher_index.js'] | path_join }}" - mode: "0444" - notify: compose-up - -- name: "🩹 Vendor the etherpad postgres-DB entrypoint wrapper" - stack_host_copy: - src: shell/etherpad_pg_entrypoint.sh - dest: "{{ [lookup('container', application_id, 'directories.instance'), 'etherpad_pg_entrypoint.sh'] | path_join }}" - mode: "0444" - notify: compose-up - -- name: "🩹 Vendor the initdb hook that creates the etherpad database" - stack_host_copy: - src: shell/postgres_initdb_etherpad.sh - dest: "{{ [lookup('container', application_id, 'directories.instance'), 'postgres_initdb_etherpad.sh'] | path_join }}" - mode: "0555" - notify: compose-up - - name: 📁 Create symbolic link from .env file to target location file: src: "{{ BBB_ENV_FILE_ORIGINE }}" diff --git a/roles/web-app-bigbluebutton/tasks/01_compose/bootstrap_compose_project.yml b/roles/web-app-bigbluebutton/tasks/01_compose/bootstrap_compose_project.yml index 31542c38c4..58e6f60662 100644 --- a/roles/web-app-bigbluebutton/tasks/01_compose/bootstrap_compose_project.yml +++ b/roles/web-app-bigbluebutton/tasks/01_compose/bootstrap_compose_project.yml @@ -27,7 +27,8 @@ extra_hosts=( [lookup('domain', 'web-app-keycloak') ~ ':host-gateway'] if 'web-app-keycloak' in group_names else [] - ) + ), + pinned=BBB_PINNED_SERVICES ) }} dest: "{{ BBB_COMPOSE_FILE_FINAL }}" notify: diff --git a/roles/web-app-bigbluebutton/tasks/01_compose/postgres_password_sync.yml b/roles/web-app-bigbluebutton/tasks/01_compose/postgres_password_sync.yml index d36a6d7a0a..960638dd8f 100644 --- a/roles/web-app-bigbluebutton/tasks/01_compose/postgres_password_sync.yml +++ b/roles/web-app-bigbluebutton/tasks/01_compose/postgres_password_sync.yml @@ -30,26 +30,3 @@ delay: 3 until: bbb_pg_alter.rc == 0 changed_when: false - -- name: "🔎 Check whether the etherpad database exists" - ansible.builtin.shell: > # nocheck: container-address-quote compose_mode_force role - container exec -i {{ BBB_POSTGRES_CONTAINER_ADDRESS | quote }} - psql -U postgres -d postgres -tAc - "SELECT 1 FROM pg_database WHERE datname = 'etherpad'" - register: bbb_etherpad_db - retries: 20 - delay: 3 - until: bbb_etherpad_db.rc == 0 - changed_when: false - -- name: "🗄️ Create the etherpad database" - ansible.builtin.shell: > # nocheck: container-address-quote compose_mode_force role - container exec -i {{ BBB_POSTGRES_CONTAINER_ADDRESS | quote }} - psql -U postgres -d postgres -c "CREATE DATABASE etherpad" - register: bbb_etherpad_create - retries: 20 - delay: 3 - until: bbb_etherpad_create.rc == 0 or 'already exists' in bbb_etherpad_create.stderr - failed_when: bbb_etherpad_create.rc != 0 and 'already exists' not in bbb_etherpad_create.stderr - when: (bbb_etherpad_db.stdout | trim) != '1' - changed_when: bbb_etherpad_create.rc == 0 diff --git a/roles/web-app-bigbluebutton/templates/compose.override.yml.j2 b/roles/web-app-bigbluebutton/templates/compose.override.yml.j2 index 7d17058e94..fbcaaa9711 100644 --- a/roles/web-app-bigbluebutton/templates/compose.override.yml.j2 +++ b/roles/web-app-bigbluebutton/templates/compose.override.yml.j2 @@ -5,7 +5,7 @@ services: {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_extra_hosts') | indent(4) }} {% if BBB_COLLABORA_ENABLED | bool %} - {{ lookup('depends_on', ['redis', 'etherpad', 'bbb-pads']) }} + {{ lookup('depends_on', ['redis']) }} {% endif %} {% set service_name = 'freeswitch' %} {{ service_name }}: @@ -15,19 +15,10 @@ services: {{ service_name }}: {{ lookup('container_image', application_id, service_name) }} {{ lookup('container_volumes', service_name) | indent(4) }} -{% set service_name = 'etherpad' %} - {{ service_name }}: - {{ lookup('container_image', application_id, service_name) }} - {{ lookup('container_volumes', service_name) | indent(4) }} - entrypoint: ["sh", "{{ lookup('volume', 'web-app-bigbluebutton', 'etherpad_pg_entrypoint').target }}"] -{% if BBB_COLLABORA_ENABLED | bool %} - {{ lookup('depends_on', ['redis', 'postgres']) }} -{% else %} - {{ lookup('depends_on', ['postgres']) }} -{% endif %} -{% set service_name = 'bbb-pads' %} +{% set service_name = 'bbb-shared-notes-server' %} {{ service_name }}: {{ lookup('container_image', application_id, service_name) }} + {{ lookup('compose_restart') }} {% set service_name = 'bbb-export-annotations' %} {{ service_name }}: {{ lookup('container_image', application_id, service_name) }} @@ -68,6 +59,8 @@ services: {% set service_name = 'greenlight' %} {{ service_name }}: {{ lookup('container_volumes', service_name) | indent(4) }} + environment: + URL_HOST: "{{ domain }}" {% endif %} {% if BBB_RECORDING_ENABLED | bool %} {% set service_name = 'recordings' %} diff --git a/roles/web-app-bigbluebutton/templates/env.j2 b/roles/web-app-bigbluebutton/templates/env.j2 index b0e4c7d4dc..9b99d0331b 100644 --- a/roles/web-app-bigbluebutton/templates/env.j2 +++ b/roles/web-app-bigbluebutton/templates/env.j2 @@ -23,12 +23,6 @@ REMOVE_OLD_RECORDING={{ BBB_RECORDING_CLEANUP_ENABLED | lower }} RECORDING_MAX_AGE_DAYS={{ BBB_RECORDING_MAX_AGE_DAYS }} SHARED_SECRET={{ BBB_SHARED_SECRET }} -ETHERPAD_API_KEY={{ BBB_ETHERPAD_API_KEY }} -ETHERPAD_DB_HOST=postgres -ETHERPAD_DB_PORT=5432 -ETHERPAD_DB_NAME=etherpad -ETHERPAD_DB_USER=postgres -ETHERPAD_DB_PASSWORD={{ BBB_POSTGRESQL_SECRET | dotenv_quote }} RAILS_SECRET={{ BBB_RAILS_SECRET }} POSTGRESQL_SECRET={{ BBB_POSTGRESQL_SECRET }} FSESL_PASSWORD={{ BBB_FSESL_PASSWORD | dotenv_quote }} @@ -50,7 +44,7 @@ SIP_IP_ALLOWLIST= CLIENT_TITLE=BigBlueButton -WELCOME_MESSAGE=Welcome to %%CONFNAME%%!

For help on using BigBlueButton see these (short) tutorial videos.

To join the audio bridge click the speaker button. Use a headset to avoid causing background noise for others. +WELCOME_MESSAGE=Welcome to %%CONFNAME%%!

For help on using BigBlueButton see the documentation.

To join the audio bridge click the speaker button. Use a headset to avoid causing background noise for others. WELCOME_FOOTER=This server is running BigBlueButton. DEFAULT_PRESENTATION=./mod/nginx/default.pdf diff --git a/roles/web-app-bigbluebutton/vars/main.yml b/roles/web-app-bigbluebutton/vars/main.yml index b7eafd9df5..3356e3faa2 100644 --- a/roles/web-app-bigbluebutton/vars/main.yml +++ b/roles/web-app-bigbluebutton/vars/main.yml @@ -9,11 +9,11 @@ http_port: "{{ lookup('config', application_id, 'services.bigbluebutton.ports.lo BBB_REPOSITORY: "{{ lookup('config', 'web-app-bigbluebutton', 'services.' ~ ('web-app-bigbluebutton' | get_entity_name) ~ '.repository') }}" BBB_REF: "{{ lookup('config', 'web-app-bigbluebutton', 'services.' ~ ('web-app-bigbluebutton' | get_entity_name) ~ '.ref') }}" +BBB_PINNED_SERVICES: "{{ lookup('config', application_id, 'services') | dict2items | selectattr('value.image', 'defined') | map(attribute='key') | list }}" _BBB_COTURN_ROLE: "web-svc-coturn" BBB_SHARED_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.shared_secret') }}" -BBB_ETHERPAD_API_KEY: "{{ lookup('config', application_id, 'secrets.credentials.etherpad_api_key') }}" BBB_RAILS_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.rails_secret') }}" BBB_POSTGRESQL_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.postgresql_secret') }}" BBB_FSESL_PASSWORD: "{{ lookup('config', application_id, 'secrets.credentials.fsesl_password') }}" diff --git a/roles/web-app-bluesky/meta/csp.yml b/roles/web-app-bluesky/meta/csp.yml index 93b46c9338..7b5b76566d 100644 --- a/roles/web-app-bluesky/meta/csp.yml +++ b/roles/web-app-bluesky/meta/csp.yml @@ -8,8 +8,8 @@ whitelist: - https://plc.directory - https://bsky.social - https://api.bsky.app - - https://public.api.bsky.app - https://events.bsky.app + - https://public.api.bsky.app # nocheck: url Reason: CSP origin, not a page; its root intermittently answers HTTP 404 to CI runners - https://*.workers.bsky.app # nocheck: url - https://statsigapi.net # nocheck: url - https://ip.bsky.app # nocheck: url diff --git a/roles/web-app-bluesky/meta/services.yml b/roles/web-app-bluesky/meta/services.yml index 30c33306f8..47083d70fa 100644 --- a/roles/web-app-bluesky/meta/services.yml +++ b/roles/web-app-bluesky/meta/services.yml @@ -62,7 +62,7 @@ web: view: enabled: false repository: https://github.com/bluesky-social/social-app.git - ref: "1.135.0" + ref: "1.136.0" ports: local: http: 8051 diff --git a/roles/web-app-bluesky/templates/extra_locations.conf.j2 b/roles/web-app-bluesky/templates/extra_locations.conf.j2 index adf9f6d102..169661909b 100644 --- a/roles/web-app-bluesky/templates/extra_locations.conf.j2 +++ b/roles/web-app-bluesky/templates/extra_locations.conf.j2 @@ -10,6 +10,7 @@ location = /config { set $up_host "{{ BLUESKY_CONFIG_UPSTREAM_URL | regex_replace('^https?://', '') | regex_replace('/.*$', '') }}"; set $bluesky_config_upstream "{{ BLUESKY_CONFIG_UPSTREAM_URL }}"; proxy_pass $bluesky_config_upstream; + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_set_header Host $up_host; proxy_http_version 1.1; proxy_set_header Connection ""; @@ -24,6 +25,7 @@ location = /ipcc { set $up_host "bsky.app"; set $bluesky_ipcc_upstream "https://bsky.app/ipcc"; proxy_pass $bluesky_ipcc_upstream; + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_set_header Host $up_host; proxy_http_version 1.1; proxy_set_header Connection ""; diff --git a/roles/web-app-checkmk/meta/services.yml b/roles/web-app-checkmk/meta/services.yml index 7baace9bb4..7790cd70ba 100644 --- a/roles/web-app-checkmk/meta/services.yml +++ b/roles/web-app-checkmk/meta/services.yml @@ -71,7 +71,7 @@ checkmk: pids_limit: 2048 min_storage: 1053MB image: checkmk/check-mk-raw - version: "2.4.0p37" + version: "2.4.0p38" backup: no_stop_required: true name: checkmk diff --git a/roles/web-app-dashboard/tasks/02_manager_ops.yml b/roles/web-app-dashboard/tasks/02_manager_ops.yml index c90c1d5dbd..4225d4732a 100644 --- a/roles/web-app-dashboard/tasks/02_manager_ops.yml +++ b/roles/web-app-dashboard/tasks/02_manager_ops.yml @@ -53,59 +53,62 @@ - src: "{{ DASHBOARD_CONFIG_INV_PATH if config_file.stat.exists else DASHBOARD_CONFIG_YML_SRC_FILE }}" dest: "{{ DASHBOARD_CONFIG_YML_DEST }}" -- name: 🧩 Load rendered dashboard config before first compose start - slurp: - src: "{{ DASHBOARD_CONFIG_YML_DEST }}" - register: dashboard_rendered_config_raw +- name: ⏳ Wait for branding assets this deployment serves + when: DASHBOARD_ASSET_ENABLED | bool + block: + - name: 🧩 Load rendered dashboard config before first compose start + slurp: + src: "{{ DASHBOARD_CONFIG_YML_DEST }}" + register: dashboard_rendered_config_raw -- name: 📊 Collect branding asset URLs served by the shared file service - set_fact: - dashboard_branding_asset_urls: >- - {{ - [ - ( - dashboard_platform_logo_source - if dashboard_platform_logo_source.startswith(dashboard_asset_url_base) - else '' - ), - ( - dashboard_platform_favicon_source - if dashboard_platform_favicon_source.startswith(dashboard_asset_url_base) - else '' - ), - ( - dashboard_company_logo_source - if dashboard_company_logo_source.startswith(dashboard_asset_url_base) - else '' - ) - ] - | select('string') - | reject('equalto', '') - | unique - | list - }} - vars: - dashboard_rendered_config: "{{ dashboard_rendered_config_raw.content | b64decode | from_yaml }}" - dashboard_asset_url_base: "{{ lookup('config', 'web-svc-asset', 'services.asset.url') }}" - dashboard_platform_logo_source: "{{ ((dashboard_rendered_config.get('platform') or {}).get('logo') or {}).get('source', '') }}" - dashboard_platform_favicon_source: "{{ ((dashboard_rendered_config.get('platform') or {}).get('favicon') or {}).get('source', '') }}" - dashboard_company_logo_source: "{{ ((dashboard_rendered_config.get('company') or {}).get('logo') or {}).get('source', '') }}" - changed_when: false + - name: 📊 Collect branding asset URLs served by the shared file service + set_fact: + dashboard_branding_asset_urls: >- + {{ + [ + ( + dashboard_platform_logo_source + if dashboard_platform_logo_source.startswith(dashboard_asset_url_base) + else '' + ), + ( + dashboard_platform_favicon_source + if dashboard_platform_favicon_source.startswith(dashboard_asset_url_base) + else '' + ), + ( + dashboard_company_logo_source + if dashboard_company_logo_source.startswith(dashboard_asset_url_base) + else '' + ) + ] + | select('string') + | reject('equalto', '') + | unique + | list + }} + vars: + dashboard_rendered_config: "{{ dashboard_rendered_config_raw.content | b64decode | from_yaml }}" + dashboard_asset_url_base: "{{ lookup('config', 'web-svc-asset', 'services.asset.url') }}" + dashboard_platform_logo_source: "{{ ((dashboard_rendered_config.get('platform') or {}).get('logo') or {}).get('source', '') }}" + dashboard_platform_favicon_source: "{{ ((dashboard_rendered_config.get('platform') or {}).get('favicon') or {}).get('source', '') }}" + dashboard_company_logo_source: "{{ ((dashboard_rendered_config.get('company') or {}).get('logo') or {}).get('source', '') }}" + changed_when: false -- name: ⏳ Wait for dashboard branding assets before first compose start - uri_retry: - url: "{{ item }}" - status_code: 200 - validate_certs: false - register: dashboard_branding_asset_http - retries: 60 - delay: 5 - until: dashboard_branding_asset_http.status == 200 - loop: "{{ dashboard_branding_asset_urls }}" - loop_control: - label: "{{ item }}" - delegate_to: "{{ STACK_HOST }}" - run_once: true + - name: ⏳ Wait for dashboard branding assets before first compose start + uri_retry: + url: "{{ item }}" + status_code: 200 + validate_certs: false + register: dashboard_branding_asset_http + retries: 60 + delay: 5 + until: dashboard_branding_asset_http.status == 200 + loop: "{{ dashboard_branding_asset_urls }}" + loop_control: + label: "{{ item }}" + delegate_to: "{{ STACK_HOST }}" + run_once: true - name: "🚿 Flush compose handlers" meta: flush_handlers diff --git a/roles/web-app-dashboard/vars/main.yml b/roles/web-app-dashboard/vars/main.yml index 214e678e77..8469859a34 100644 --- a/roles/web-app-dashboard/vars/main.yml +++ b/roles/web-app-dashboard/vars/main.yml @@ -3,6 +3,7 @@ application_id: "web-app-dashboard" DASHBOARD_APPLICATION_ID: "web-app-dashboard" http_port: "{{ lookup('config', DASHBOARD_APPLICATION_ID, 'services.dashboard.ports.local.http') }}" +DASHBOARD_ASSET_ENABLED: "{{ lookup('config', DASHBOARD_APPLICATION_ID, 'services.asset.enabled') }}" DASHBOARD_SIMPLEICONS_ENABLED: "{{ lookup('config', DASHBOARD_APPLICATION_ID, 'services.simpleicons.enabled') }}" DASHBOARD_SIMPLEICONS_URL_BASE: "{{ lookup('tls', 'web-svc-simpleicons', 'url.base') }}" DASHBOARD_SIMPLEICONS_SYNC_URL_BASE: "{{ 'http://' ~ DOCKER_REACH_HOST ~ ':' ~ (lookup('config', 'web-svc-simpleicons', 'services.simpleicons.ports.local.http') | diff --git a/roles/web-app-erpnext/meta/services.yml b/roles/web-app-erpnext/meta/services.yml index dd03db4544..58af583995 100644 --- a/roles/web-app-erpnext/meta/services.yml +++ b/roles/web-app-erpnext/meta/services.yml @@ -65,7 +65,7 @@ erpnext: enabled: true shared: true image: frappe/erpnext - version: "v16.51.1" + version: "v16.52.1" name: erpnext min_storage: 1017MB ports: diff --git a/roles/web-app-espocrm/meta/volumes.yml b/roles/web-app-espocrm/meta/volumes.yml index af4f0557eb..b611677e28 100644 --- a/roles/web-app-espocrm/meta/volumes.yml +++ b/roles/web-app-espocrm/meta/volumes.yml @@ -31,3 +31,10 @@ client_custom: target: *var_www_html_client_custom_target - service: websocket target: *var_www_html_client_custom_target +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: espocrm + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-fediwall/meta/services.yml b/roles/web-app-fediwall/meta/services.yml index ed2eb8fb31..f9cb518dac 100644 --- a/roles/web-app-fediwall/meta/services.yml +++ b/roles/web-app-fediwall/meta/services.yml @@ -52,7 +52,7 @@ fediwall: swarm: enabled: true image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine custom: true upstream: version: "1.4.0" diff --git a/roles/web-app-friendica/meta/volumes.yml b/roles/web-app-friendica/meta/volumes.yml index a6fceae867..58344c4e77 100644 --- a/roles/web-app-friendica/meta/volumes.yml +++ b/roles/web-app-friendica/meta/volumes.yml @@ -19,3 +19,10 @@ ldapauth_config: - service: friendica target: /var/www/html/config/ldapauth.config.php when: "{{ lookup('config', 'web-app-friendica', 'services.ldap.enabled') | bool }}" +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: friendica + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-fusiondirectory/TODO.md b/roles/web-app-fusiondirectory/TODO.md new file mode 100644 index 0000000000..dc647a5fa8 --- /dev/null +++ b/roles/web-app-fusiondirectory/TODO.md @@ -0,0 +1,4 @@ +# To-dos + +- Move off PHP 7.4. The pinned `nfrastack/fusiondirectory:1.5` image builds on `ghcr.io/nfrastack/container-nginx-php-fpm` with PHP 7.4 on Alpine 3.15, which is end of life and gets no fix for CVE-2026-109618 and CVE-2026-109619. +- Mount the shared PHP hardening ini (`FILE_PHP_HARDENING_INI`) once the image's scan dir is verified. The nfrastack init scripts manage `conf.d` at runtime, so a read-only mount there has to be tested before it ships. diff --git a/roles/web-app-gitlab/meta/services.yml b/roles/web-app-gitlab/meta/services.yml index 5c13f96c19..9c7cd70687 100644 --- a/roles/web-app-gitlab/meta/services.yml +++ b/roles/web-app-gitlab/meta/services.yml @@ -76,7 +76,7 @@ gitlab: lifecycle: beta webservice: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-webservice-ce - version: v19.5.0 + version: v19.5.1 name: gitlab-webservice healthcheck: test: ["CMD", "/scripts/healthcheck"] @@ -95,7 +95,7 @@ sidekiq: flavor: tcp path: liveness image: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ce - version: v19.5.0 + version: v19.5.1 name: gitlab-sidekiq cpus: "1.0" mem_reservation: 2g @@ -106,7 +106,7 @@ sidekiq: http: 3808 workhorse: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ce - version: v19.5.0 + version: v19.5.1 name: gitlab-workhorse healthcheck: test: ["CMD", "/scripts/healthcheck"] @@ -118,7 +118,7 @@ gitaly: # nocheck: single-replica replicas: 1 image: registry.gitlab.com/gitlab-org/build/cng/gitaly - version: v19.5.0 + version: v19.5.1 healthcheck: test: ["CMD", "/scripts/healthcheck"] name: gitlab-gitaly @@ -131,7 +131,7 @@ gitaly: pids_limit: 1024 shell: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-shell - version: v19.5.0 + version: v19.5.1 name: gitlab-shell ports: internal: @@ -144,7 +144,7 @@ migrations: # nocheck: single-replica replicas: 1 image: registry.gitlab.com/gitlab-org/build/cng/gitlab-rails-ce - version: v19.5.0 + version: v19.5.1 name: gitlab-migrations cpus: "1.0" mem_reservation: 1g diff --git a/roles/web-app-joomla/meta/volumes.yml b/roles/web-app-joomla/meta/volumes.yml index 74cbd3b68c..f9bbb1d80c 100644 --- a/roles/web-app-joomla/meta/volumes.yml +++ b/roles/web-app-joomla/meta/volumes.yml @@ -12,4 +12,12 @@ php_upload: mode: "0444" mounts: - service: joomla - target: /usr/local/etc/php/conf.d/uploads.ini + target: /usr/local/etc/php/conf.d/zzz-joomla-uploads.ini + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: joomla + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-keycloak/TODO.md b/roles/web-app-keycloak/TODO.md index 52760911f6..ca648c8906 100644 --- a/roles/web-app-keycloak/TODO.md +++ b/roles/web-app-keycloak/TODO.md @@ -2,6 +2,7 @@ - Implement working logout for all applications - Implement general logout button +- Restrict the admin console. `https://auth./` redirects to `/admin/`, which any client on the internet can reach. Add a source-network allowlist for `/admin` in the proxy vhost. ## Req 019 rollout: deploy gate diff --git a/roles/web-app-lam/meta/volumes.yml b/roles/web-app-lam/meta/volumes.yml new file mode 100644 index 0000000000..15633aec53 --- /dev/null +++ b/roles/web-app-lam/meta/volumes.yml @@ -0,0 +1,8 @@ +--- +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: lam + target: /etc/php/8.4/apache2/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-lam/templates/compose.yml.j2 b/roles/web-app-lam/templates/compose.yml.j2 index 5baa929014..7e5ca346a5 100644 --- a/roles/web-app-lam/templates/compose.yml.j2 +++ b/roles/web-app-lam/templates/compose.yml.j2 @@ -5,6 +5,7 @@ {{ lookup('compose_only', 'container_name', LAM_CONTAINER) }} {{ lookup('container_image', application_id, 'lam') }} {{ lookup('container_ports', ['lam', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_networks') | indent(4) }} diff --git a/roles/web-app-littlejs/meta/services.yml b/roles/web-app-littlejs/meta/services.yml index f940fb8081..77f048bf33 100644 --- a/roles/web-app-littlejs/meta/services.yml +++ b/roles/web-app-littlejs/meta/services.yml @@ -38,7 +38,7 @@ littlejs: repository: https://github.com/KilledByAPixel/LittleJS.git ref: main image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine custom: true ports: local: diff --git a/roles/web-app-magento/meta/volumes.yml b/roles/web-app-magento/meta/volumes.yml index 1c21edeafe..8fceecaa8a 100644 --- a/roles/web-app-magento/meta/volumes.yml +++ b/roles/web-app-magento/meta/volumes.yml @@ -23,3 +23,11 @@ php_fpm_conf: mounts: - service: php target: /usr/local/etc/php-fpm.conf + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: php + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-mailu/meta/volumes.yml b/roles/web-app-mailu/meta/volumes.yml index aeeb622397..8616ec60f4 100644 --- a/roles/web-app-mailu/meta/volumes.yml +++ b/roles/web-app-mailu/meta/volumes.yml @@ -83,3 +83,10 @@ rspamd_overrides: mounts: - service: antispam target: *overrides_target +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: webmail + target: /etc/php83/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-matomo/meta/volumes.yml b/roles/web-app-matomo/meta/volumes.yml index 68b179d9ed..d896341e85 100644 --- a/roles/web-app-matomo/meta/volumes.yml +++ b/roles/web-app-matomo/meta/volumes.yml @@ -15,3 +15,11 @@ tmp: mounts: - service: matomo target: /var/www/html/tmp + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: matomo + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-matrix/meta/services.yml b/roles/web-app-matrix/meta/services.yml index 93642e25c6..f1becbf47b 100644 --- a/roles/web-app-matrix/meta/services.yml +++ b/roles/web-app-matrix/meta/services.yml @@ -43,7 +43,7 @@ postgres: synapse: healthcheck: flavor: curl - version: v1.163.0 + version: v1.163.1 image: matrixdotorg/synapse name: matrix-synapse backup: diff --git a/roles/web-app-mattermost/meta/services.yml b/roles/web-app-mattermost/meta/services.yml index eb42143a3e..32d58f5b2c 100644 --- a/roles/web-app-mattermost/meta/services.yml +++ b/roles/web-app-mattermost/meta/services.yml @@ -46,7 +46,7 @@ mattermost: shared: true user_access_token_enabled: "{{ 'web-app-nextcloud' in group_names }}" image: mattermost/mattermost-team-edition - version: 12.0.0 + version: 12.0.1 min_storage: 659MB backup: no_stop_required: true diff --git a/roles/web-app-mediawiki/meta/volumes.yml b/roles/web-app-mediawiki/meta/volumes.yml index 2e19976e28..edfa48f3c5 100644 --- a/roles/web-app-mediawiki/meta/volumes.yml +++ b/roles/web-app-mediawiki/meta/volumes.yml @@ -29,3 +29,11 @@ mw_local: - service: mediawiki target: /opt/mw-local read_only: true + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: mediawiki + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-moodle/files/build/config.php b/roles/web-app-moodle/files/build/config.php index 5e66fb1fcd..de94ce3b3e 100644 --- a/roles/web-app-moodle/files/build/config.php +++ b/roles/web-app-moodle/files/build/config.php @@ -51,8 +51,4 @@ if (explode(':', $_SERVER['HTTP_HOST'] ?? '', 2)[0] === $_moodle_internal_host) $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST']; } -$_moodle_debug = moodle_env_bool('MOODLE_DEBUG'); -$CFG->debug = $_moodle_debug ? 32767 : 0; -$CFG->debugdisplay = $_moodle_debug; - require_once(__DIR__ . '/lib/setup.php'); diff --git a/roles/web-app-moodle/files/php/provision/mcp.php b/roles/web-app-moodle/files/php/provision/mcp.php index 37c7d34773..9df30c916a 100644 --- a/roles/web-app-moodle/files/php/provision/mcp.php +++ b/roles/web-app-moodle/files/php/provision/mcp.php @@ -1,11 +1,10 @@ libdir . '/externallib.php'); require_once($CFG->dirroot . '/webservice/lib.php'); $shortname = (string) getenv('MCP_SERVICE_SHORTNAME'); @@ -43,8 +42,6 @@ foreach ($functions as $function) { } } -require_once($CFG->dirroot . '/user/lib.php'); - $username = (string) getenv('MCP_ACCOUNT_USERNAME'); $capabilities = array_filter(array_map('trim', explode(',', (string) getenv('MCP_ROLE_CAPABILITIES')))); $systemcontext = context_system::instance(); @@ -63,7 +60,7 @@ if (!$account) { $new->auth = 'manual'; $new->confirmed = 1; $new->mnethostid = $CFG->mnet_localhost_id; - $accountid = user_create_user($new, true, false); + $accountid = \core\user::create_user($new, true, false); $account = $DB->get_record('user', ['id' => $accountid], '*', MUST_EXIST); } @@ -85,9 +82,9 @@ $token = $DB->get_field('external_tokens', 'token', [ ], IGNORE_MULTIPLE); if (!$token) { - $token = external_generate_token( + $token = \core_external\util::generate_token( EXTERNAL_TOKEN_PERMANENT, - $service->id, + $service, $account->id, $systemcontext ); diff --git a/roles/web-app-moodle/meta/volumes.yml b/roles/web-app-moodle/meta/volumes.yml index 6019189890..30e93b36cc 100644 --- a/roles/web-app-moodle/meta/volumes.yml +++ b/roles/web-app-moodle/meta/volumes.yml @@ -49,3 +49,17 @@ msmtprc: target: &etc_msmtprc_target /etc/msmtprc - service: cron target: *etc_msmtprc_target +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: moodle + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini +php_fpm_hardening: + type: config + source: "{{ FILE_PHP_FPM_HARDENING_CONF }}" + mode: "0444" + mounts: + - service: moodle + target: /usr/local/etc/php-fpm.d/zz-infinito-hardening.conf diff --git a/roles/web-app-moodle/tasks/01_manager_ops.yml b/roles/web-app-moodle/tasks/01_manager_ops.yml index 93cd1d5e97..e3ddcee9db 100644 --- a/roles/web-app-moodle/tasks/01_manager_ops.yml +++ b/roles/web-app-moodle/tasks/01_manager_ops.yml @@ -68,13 +68,13 @@ changed_when: moodle_admin_password.rc == 0 no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" -- name: "🌐 Open Moodle's cURL egress policy for the deployment's own networks" +- name: "⚙️ Apply Moodle's cURL egress policy and debug level to the site config" ansible.builtin.shell: > container exec --user {{ MOODLE_RUNTIME_USER }} {{ MOODLE_CONTAINER_ADDRESS }} php {{ [MOODLE_CLI_DIR, 'cfg.php'] | path_join }} --name={{ item.name | quote }} --set={{ item.value | quote }} - loop: "{{ MOODLE_EGRESS_SETTINGS }}" + loop: "{{ MOODLE_EGRESS_SETTINGS + MOODLE_DEBUG_SETTINGS }}" loop_control: label: "{{ item.name }}" changed_when: false diff --git a/roles/web-app-moodle/templates/env.j2 b/roles/web-app-moodle/templates/env.j2 index 460894e166..c01bf6a83e 100644 --- a/roles/web-app-moodle/templates/env.j2 +++ b/roles/web-app-moodle/templates/env.j2 @@ -16,7 +16,5 @@ MOODLE_DB_PREFIX=mdl_ MOODLE_REVERSEPROXY=false MOODLE_SSLPROXY={{ lookup('tls', application_id, 'enabled') | string | lower }} -MOODLE_DEBUG={{ MODE_DEBUG | bool }} - MOODLE_SITE_NAME={{ MOODLE_SITE_TITLE | dotenv_quote }} MOODLE_ADMIN_EMAIL={{ lookup('config', application_id, 'users.administrator.email') }} diff --git a/roles/web-app-moodle/templates/nginx-moodle.conf.j2 b/roles/web-app-moodle/templates/nginx-moodle.conf.j2 index ca7b6a2a03..fb0d29f5c2 100644 --- a/roles/web-app-moodle/templates/nginx-moodle.conf.j2 +++ b/roles/web-app-moodle/templates/nginx-moodle.conf.j2 @@ -41,6 +41,6 @@ server { location ~* \.(css|js|gif|jpe?g|png|webp|svg|ico|woff2?|ttf)$ { expires 1d; add_header Cache-Control "public"; - try_files $uri =404; + try_files $uri /r.php$is_args$args; } } diff --git a/roles/web-app-moodle/vars/main.yml b/roles/web-app-moodle/vars/main.yml index fffdb5f0db..e6cab65f67 100644 --- a/roles/web-app-moodle/vars/main.yml +++ b/roles/web-app-moodle/vars/main.yml @@ -84,6 +84,11 @@ MOODLE_EGRESS_SETTINGS: - name: curlsecurityallowedport value: "{{ (MOODLE_EGRESS_ALLOWED_PORTS + ([MOODLE_LITELLM_CHAT_ENDPOINT | urlsplit('port') | string] if MOODLE_LITELLM_ENABLED | bool else [])) | join(MOODLE_EGRESS_NEWLINE) }}" +MOODLE_DEBUG_SETTINGS: + - name: debug + value: "{{ (MODE_DEBUG | bool) | ternary('32767', '0') }}" + - name: debugdisplay + value: "{{ (MODE_DEBUG | bool) | ternary('1', '0') }}" MOODLE_MCP_ENABLED: "{{ lookup('config', application_id, 'mcp.enabled') }}" MOODLE_MCP_PLUGIN_VERSION: "v0.6.0" diff --git a/roles/web-app-n8n/meta/services.yml b/roles/web-app-n8n/meta/services.yml index b19d0978df..5f9f5a454e 100644 --- a/roles/web-app-n8n/meta/services.yml +++ b/roles/web-app-n8n/meta/services.yml @@ -67,7 +67,7 @@ n8n: backup: no_stop_required: false image: docker.n8n.io/n8nio/n8n - version: "2.45.0" + version: "2.45.2" update: type: registry_tags image: docker.n8n.io/n8nio/n8n diff --git a/roles/web-app-nextcloud/meta/services.yml b/roles/web-app-nextcloud/meta/services.yml index 2a75d75408..270fd038fe 100644 --- a/roles/web-app-nextcloud/meta/services.yml +++ b/roles/web-app-nextcloud/meta/services.yml @@ -122,7 +122,7 @@ proxy: # nocheck: healthcheck-timing-override a sidecar of a stack whose main service alone takes minutes; the value predates this default and has not been measured against it start_period: 20m image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine backup: no_stop_required: true cpus: "0.5" diff --git a/roles/web-app-nextcloud/meta/volumes.yml b/roles/web-app-nextcloud/meta/volumes.yml index ad65b6b229..364cc4d6b0 100644 --- a/roles/web-app-nextcloud/meta/volumes.yml +++ b/roles/web-app-nextcloud/meta/volumes.yml @@ -60,3 +60,19 @@ infinito_conf: target: &var_www_infinito_target /var/www/infinito/ - service: cron target: *var_www_infinito_target + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: nextcloud + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini + +php_fpm_hardening: + type: config + source: "{{ FILE_PHP_FPM_HARDENING_CONF }}" + mode: "0444" + mounts: + - service: nextcloud + target: /usr/local/etc/php-fpm.d/zz-infinito-hardening.conf diff --git a/roles/web-app-opentalk/templates/nginx/extra.conf.j2 b/roles/web-app-opentalk/templates/nginx/extra.conf.j2 index 35f513c64a..378849a174 100644 --- a/roles/web-app-opentalk/templates/nginx/extra.conf.j2 +++ b/roles/web-app-opentalk/templates/nginx/extra.conf.j2 @@ -5,6 +5,7 @@ location /v1/ { proxy_pass http://127.0.0.1:{{ OPENTALK_CTRL_HTTP_PORT }}; + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -17,6 +18,7 @@ location /v1/ { location /signaling { proxy_pass http://127.0.0.1:{{ OPENTALK_CTRL_HTTP_PORT }}; + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -30,6 +32,7 @@ location /signaling { location /livekit { proxy_pass http://127.0.0.1:{{ OPENTALK_LIVEKIT_HTTP_PORT }}; + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/roles/web-app-peertube/files/sql/check-application/defaults.sql b/roles/web-app-peertube/files/sql/check-application/defaults.sql new file mode 100644 index 0000000000..023a3dd811 --- /dev/null +++ b/roles/web-app-peertube/files/sql/check-application/defaults.sql @@ -0,0 +1,6 @@ +SELECT column_name +FROM information_schema.columns +WHERE table_schema = 'public' + AND table_name = 'application' + AND column_name IN ('nodeVersion', 'nodeABIVersion') + AND column_default IS NULL; diff --git a/roles/web-app-peertube/files/sql/check-application-table.sql b/roles/web-app-peertube/files/sql/check-application/table.sql similarity index 100% rename from roles/web-app-peertube/files/sql/check-application-table.sql rename to roles/web-app-peertube/files/sql/check-application/table.sql diff --git a/roles/web-app-peertube/tasks/02_fix-application-schema.yml b/roles/web-app-peertube/tasks/02_fix-application-schema.yml index 26d958c07d..785885b584 100644 --- a/roles/web-app-peertube/tasks/02_fix-application-schema.yml +++ b/roles/web-app-peertube/tasks/02_fix-application-schema.yml @@ -31,7 +31,7 @@ database_query: mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" config: "{{ lookup('database', application_id) }}" - query: "{{ lookup('file', role_path ~ '/files/sql/check-application-table.sql') }}" # nocheck: database-query-raw controller-read so the SQL travels to the remote swarm host that lacks the repo files + query: "{{ lookup('file', role_path ~ '/files/sql/check-application/table.sql') }}" # nocheck: database-query-raw controller-read so the SQL travels to the remote swarm host that lacks the repo files expect_rows: true register: _peertube_app_table_check retries: 60 @@ -42,12 +42,21 @@ and (_peertube_app_table_check.rows[0][0] | default('')) == 'application' changed_when: false +- name: "🔍 PEERTUBE | Find the bootstrap columns that still lack a default" + database_query: + mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + config: "{{ lookup('database', application_id) }}" + query: "{{ lookup('file', role_path ~ '/files/sql/check-application/defaults.sql') }}" # nocheck: database-query-raw controller-read so the SQL travels to the remote swarm host that lacks the repo files + expect_rows: true + register: _peertube_app_defaults_missing + changed_when: false + - name: "🔧 PEERTUBE | Back-fill column defaults so bootstrap INSERT keeps NOT NULL" database_query: mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" config: "{{ lookup('database', application_id) }}" query: "{{ lookup('file', role_path ~ '/files/sql/backfill-application-defaults.sql') }}" # nocheck: database-query-raw controller-read so the SQL travels to the remote swarm host that lacks the repo files - register: _peertube_app_defaults + when: _peertube_app_defaults_missing.rows | length > 0 notify: compose-up - name: "🔍 Resolve {{ application_id }} hosting node + container id" diff --git a/roles/web-app-penpot/tasks/01_administrator.yml b/roles/web-app-penpot/tasks/01_administrator.yml index f55317c8b5..d1fc727a80 100644 --- a/roles/web-app-penpot/tasks/01_administrator.yml +++ b/roles/web-app-penpot/tasks/01_administrator.yml @@ -7,12 +7,13 @@ resolve_compose_cid: "{{ PENPOT_BACKEND_CONTAINER_ADDRESS }}" - name: "🥾 Bootstrap the Penpot administrator's local account (idempotent)" - ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec -i {{ PENPOT_BACKEND_LOCAL_CID | quote }} - python3 manage.py create-profile - -n {{ PENPOT_ADMIN_FULLNAME | quote }} - -e {{ PENPOT_ADMIN_EMAIL | quote }} - -p {{ PENPOT_ADMIN_PASSWORD | quote }} + ansible.builtin.shell: + cmd: >- # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node + container exec -i {{ PENPOT_BACKEND_LOCAL_CID | quote }} + python3 manage.py create-profile + -n {{ PENPOT_ADMIN_FULLNAME | quote }} + -e {{ PENPOT_ADMIN_EMAIL | quote }} + stdin: "{{ PENPOT_ADMIN_PASSWORD }}" register: penpot_admin_create retries: 30 delay: 5 @@ -27,11 +28,12 @@ delegate_to: "{{ PENPOT_BACKEND_HOST_NODE }}" - name: "🔧 Set the Penpot administrator's local password when the profile already exists" - ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec -i {{ PENPOT_BACKEND_LOCAL_CID | quote }} - python3 manage.py update-profile - -e {{ PENPOT_ADMIN_EMAIL | quote }} - -p {{ PENPOT_ADMIN_PASSWORD | quote }} + ansible.builtin.shell: + cmd: >- # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node + container exec -i {{ PENPOT_BACKEND_LOCAL_CID | quote }} + python3 manage.py update-profile + -e {{ PENPOT_ADMIN_EMAIL | quote }} + stdin: "{{ PENPOT_ADMIN_PASSWORD }}" when: "'already exists' in (penpot_admin_create.stdout | default('') ~ penpot_admin_create.stderr | default(''))" register: penpot_admin_update changed_when: "'Updated' in penpot_admin_update.stdout" diff --git a/roles/web-app-phpldapadmin/meta/volumes.yml b/roles/web-app-phpldapadmin/meta/volumes.yml new file mode 100644 index 0000000000..df9e69ec7e --- /dev/null +++ b/roles/web-app-phpldapadmin/meta/volumes.yml @@ -0,0 +1,8 @@ +--- +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: phpldapadmin + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-phpldapadmin/templates/compose.yml.j2 b/roles/web-app-phpldapadmin/templates/compose.yml.j2 index a858409c74..99034013b1 100644 --- a/roles/web-app-phpldapadmin/templates/compose.yml.j2 +++ b/roles/web-app-phpldapadmin/templates/compose.yml.j2 @@ -6,6 +6,7 @@ {{ lookup('compose_only', 'container_name', application_id) }} {{ lookup('container_image', application_id, 'phpldapadmin') }} {{ lookup('container_ports', ['phpldapadmin', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_networks') | indent(4) }} diff --git a/roles/web-app-phpmyadmin/meta/volumes.yml b/roles/web-app-phpmyadmin/meta/volumes.yml new file mode 100644 index 0000000000..5c220c9994 --- /dev/null +++ b/roles/web-app-phpmyadmin/meta/volumes.yml @@ -0,0 +1,8 @@ +--- +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: phpmyadmin + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-phpmyadmin/templates/compose.yml.j2 b/roles/web-app-phpmyadmin/templates/compose.yml.j2 index 2bfbc92702..c8c1e34b47 100644 --- a/roles/web-app-phpmyadmin/templates/compose.yml.j2 +++ b/roles/web-app-phpmyadmin/templates/compose.yml.j2 @@ -6,6 +6,7 @@ {{ lookup('compose_only', 'container_name', PHPMYADMIN_CONTAINER) }} {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_ports', ['phpmyadmin', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_depends_on', application_id) | indent(4) }} {{ lookup('container_networks') | indent(4) }} {{ lookup('container_healthcheck', service_name) | indent(4) }} diff --git a/roles/web-app-pixelfed/meta/services.yml b/roles/web-app-pixelfed/meta/services.yml index 84e36880c8..9b8eee11e4 100644 --- a/roles/web-app-pixelfed/meta/services.yml +++ b/roles/web-app-pixelfed/meta/services.yml @@ -49,7 +49,7 @@ pixelfed: shared: true enabled: true # nocheck: dynamic-flag image: zknt/pixelfed - version: "20261020" + version: "20261021" name: pixelfed min_storage: 588MB backup: diff --git a/roles/web-app-pixelfed/meta/volumes.yml b/roles/web-app-pixelfed/meta/volumes.yml index 2513c9bbf6..929a9d72a2 100644 --- a/roles/web-app-pixelfed/meta/volumes.yml +++ b/roles/web-app-pixelfed/meta/volumes.yml @@ -33,3 +33,11 @@ worker_entrypoint: mounts: - service: worker target: /infinito-pixelfed-worker-entrypoint.sh + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: pixelfed + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-prometheus/meta/services.yml b/roles/web-app-prometheus/meta/services.yml index 462bb19bc7..fd8f536f5b 100644 --- a/roles/web-app-prometheus/meta/services.yml +++ b/roles/web-app-prometheus/meta/services.yml @@ -55,7 +55,7 @@ prometheus: provides: - prometheus image: prom/prometheus # nocheck: volumes-path-single-spot: the repository path of an image name, not a mount target - version: v3.15.0 + version: v3.15.1 name: prometheus cpus: "0.5" mem_reservation: 512m @@ -94,7 +94,7 @@ blackbox-exporter: flavor: wget path: -/healthy image: prom/blackbox-exporter - version: v0.29.0 + version: v0.29.1 name: prometheus-blackbox cpus: "0.1" mem_reservation: 16m diff --git a/roles/web-app-prometheus/templates/nginx/healthz.conf.j2 b/roles/web-app-prometheus/templates/nginx/healthz.conf.j2 index 914f08201d..a034241e6a 100644 --- a/roles/web-app-prometheus/templates/nginx/healthz.conf.j2 +++ b/roles/web-app-prometheus/templates/nginx/healthz.conf.j2 @@ -54,6 +54,7 @@ internal; {{ prometheus_backend }} {% include 'roles/sys-svc-proxy/templates/headers/forwarded.conf.j2' %} + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_connect_timeout 2s; proxy_read_timeout 3s; proxy_intercept_errors off; @@ -63,6 +64,7 @@ access_log off; {{ prometheus_ready_backend }} {% include 'roles/sys-svc-proxy/templates/headers/forwarded.conf.j2' %} + {% include 'roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2' %} proxy_connect_timeout 3s; proxy_read_timeout 5s; proxy_intercept_errors off; diff --git a/roles/web-app-shopware/meta/volumes.yml b/roles/web-app-shopware/meta/volumes.yml index 5037fc5db6..021a1a0809 100644 --- a/roles/web-app-shopware/meta/volumes.yml +++ b/roles/web-app-shopware/meta/volumes.yml @@ -122,3 +122,19 @@ adminopenauth_yaml: target: *var_www_html_config_packages_adminopenauth_yaml_target - service: scheduler target: *var_www_html_config_packages_adminopenauth_yaml_target + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: web + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini + +php_fpm_hardening: + type: config + source: "{{ FILE_PHP_FPM_HARDENING_CONF }}" + mode: "0444" + mounts: + - service: web + target: /usr/local/etc/php-fpm.d/zz-infinito-hardening.conf diff --git a/roles/web-app-snipe-it/meta/services.yml b/roles/web-app-snipe-it/meta/services.yml index ae261234af..2ed40e447a 100644 --- a/roles/web-app-snipe-it/meta/services.yml +++ b/roles/web-app-snipe-it/meta/services.yml @@ -58,7 +58,7 @@ snipe-it: enabled: true swarm: enabled: true - version: v8.8.1-alpine + version: v8.8.3-alpine custom: true name: snipe-it image: snipe/snipe-it diff --git a/roles/web-app-snipe-it/meta/volumes.yml b/roles/web-app-snipe-it/meta/volumes.yml index c7a05092a8..6a0c27d8be 100644 --- a/roles/web-app-snipe-it/meta/volumes.yml +++ b/roles/web-app-snipe-it/meta/volumes.yml @@ -13,3 +13,11 @@ env: mounts: - service: snipe-it target: /var/www/html/.env + +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: snipe-it + target: /etc/php84/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-socialhome/meta/services.yml b/roles/web-app-socialhome/meta/services.yml index 536d8dce2e..70dc854023 100644 --- a/roles/web-app-socialhome/meta/services.yml +++ b/roles/web-app-socialhome/meta/services.yml @@ -13,7 +13,7 @@ socialhome: # nocheck: default-placement-manager embedded sqlite in a node-local volume; no clustered storage placement: manager image: ghcr.io/social-home-io/socialhome - version: "2026.10.20" + version: "2026.10.22" ports: local: http: 8089 diff --git a/roles/web-app-stalwart/meta/volumes.yml b/roles/web-app-stalwart/meta/volumes.yml index 4fcb41ef57..aa3023e1fe 100644 --- a/roles/web-app-stalwart/meta/volumes.yml +++ b/roles/web-app-stalwart/meta/volumes.yml @@ -59,3 +59,10 @@ webmail_oauth: mounts: - service: webmail target: /var/roundcube/config/oauth.inc.php +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: webmail + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-suitecrm/meta/volumes.yml b/roles/web-app-suitecrm/meta/volumes.yml index 652e82b8a6..f0454f2dbe 100644 --- a/roles/web-app-suitecrm/meta/volumes.yml +++ b/roles/web-app-suitecrm/meta/volumes.yml @@ -30,3 +30,10 @@ ldap_config: - service: suitecrm target: "{{ ['/var/www/html/extensions', SOFTWARE_DOMAIN | replace('.', '-'), 'config/services/ldap/ldap.yaml'] | path_join }}" when: "{{ lookup('config', 'web-app-suitecrm', 'services.ldap.enabled') | bool }}" +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: suitecrm + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-taiga/meta/services.yml b/roles/web-app-taiga/meta/services.yml index 54a2238584..c170984921 100644 --- a/roles/web-app-taiga/meta/services.yml +++ b/roles/web-app-taiga/meta/services.yml @@ -92,7 +92,7 @@ gateway: internal: http: 80 image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine cpus: "0.3" mem_reservation: 256m mem_limit: 512m diff --git a/roles/web-app-wordpress/meta/volumes.yml b/roles/web-app-wordpress/meta/volumes.yml index cd49d33ca6..761b065f50 100644 --- a/roles/web-app-wordpress/meta/volumes.yml +++ b/roles/web-app-wordpress/meta/volumes.yml @@ -12,3 +12,10 @@ msmtprc: mounts: - service: wordpress target: /etc/msmtprc +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: wordpress + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-xwiki/meta/addons/oidc-authenticator.yml b/roles/web-app-xwiki/meta/addons/oidc-authenticator.yml index c0513c6e50..dcd823c54c 100644 --- a/roles/web-app-xwiki/meta/addons/oidc-authenticator.yml +++ b/roles/web-app-xwiki/meta/addons/oidc-authenticator.yml @@ -5,7 +5,7 @@ mechanism: extension source: upstream bridges: - sso -version: "2.29.0" +version: "2.29.1" update: type: http_regex url: https://maven.xwiki.org/releases/org/xwiki/contrib/oidc/oidc-authenticator/maven-metadata.xml diff --git a/roles/web-app-yourls/meta/volumes.yml b/roles/web-app-yourls/meta/volumes.yml new file mode 100644 index 0000000000..7d58bd0a7f --- /dev/null +++ b/roles/web-app-yourls/meta/volumes.yml @@ -0,0 +1,8 @@ +--- +php_hardening: + type: config + source: "{{ FILE_PHP_HARDENING_INI }}" + mode: "0444" + mounts: + - service: yourls + target: /usr/local/etc/php/conf.d/zz-infinito-hardening.ini diff --git a/roles/web-app-yourls/templates/compose.yml.j2 b/roles/web-app-yourls/templates/compose.yml.j2 index 493804d31f..d2634c4e62 100644 --- a/roles/web-app-yourls/templates/compose.yml.j2 +++ b/roles/web-app-yourls/templates/compose.yml.j2 @@ -9,6 +9,7 @@ {{ lookup('compose_only', 'container_name', YOURLS_CONTAINER) }} {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_ports', ['yourls', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_healthcheck', service_name) | indent(4) }} {{ lookup('container_depends_on', application_id) | indent(4) }} diff --git a/roles/web-svc-coturn/meta/services.yml b/roles/web-svc-coturn/meta/services.yml index 6f10a65426..768dcf9ccb 100644 --- a/roles/web-svc-coturn/meta/services.yml +++ b/roles/web-svc-coturn/meta/services.yml @@ -31,7 +31,7 @@ coturn: lifecycle: beta gateway: image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine cpus: "0.3" mem_reservation: 256m mem_limit: 512m diff --git a/scripts/docker/cache/package.sh b/scripts/docker/cache/package.sh index 3ce483d631..80bfc234af 100755 --- a/scripts/docker/cache/package.sh +++ b/scripts/docker/cache/package.sh @@ -138,6 +138,8 @@ ensure_proxy_repo() { ensure_repo "$1" proxy "$2" "$3"; } # that hit it. ensure_all_proxies() { local storage='"storage":{"blobStoreName":"default","strictContentTypeValidation":true},"proxy":{"contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"negativeCache":{"enabled":true,"timeToLive":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"httpClient":{"blocked":false,"autoBlock":false}' + # Exception: raw content has no type contract; strict validation answers a GPG keybox (.kbx) with 404 "Content type could not be determined". + local raw_storage="${storage/'"strictContentTypeValidation":true'/'"strictContentTypeValidation":false'}" ensure_proxy_repo apt apt-debian "$(printf '{"name":"apt-debian","online":true,%s,"proxy":{"remoteUrl":"http://deb.debian.org/debian","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"apt":{"distribution":"bookworm","flat":false}}' "${storage}")" ensure_proxy_repo apt apt-ubuntu "$(printf '{"name":"apt-ubuntu","online":true,%s,"proxy":{"remoteUrl":"'"${UBUNTU_PRIMARY}"'","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"apt":{"distribution":"jammy","flat":false}}' "${storage}")" @@ -150,14 +152,14 @@ ensure_all_proxies() { ensure_proxy_repo pypi pypi-proxy "$(printf '{"name":"pypi-proxy","online":true,%s,"proxy":{"remoteUrl":"https://pypi.org/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'}}' "${storage}")" ensure_proxy_repo npm npm-proxy "$(printf '{"name":"npm-proxy","online":true,%s,"proxy":{"remoteUrl":"https://registry.npmjs.org/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'}}' "${storage}")" ensure_proxy_repo helm helm-bitnami "$(printf '{"name":"helm-bitnami","online":true,%s,"proxy":{"remoteUrl":"https://charts.bitnami.com/bitnami","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'}}' "${storage}")" - ensure_proxy_repo raw raw-githubusercontent "$(printf '{"name":"raw-githubusercontent","online":true,%s,"proxy":{"remoteUrl":"https://raw.githubusercontent.com/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${storage}")" - ensure_proxy_repo raw raw-codeload-github "$(printf '{"name":"raw-codeload-github","online":true,%s,"proxy":{"remoteUrl":"https://codeload.github.com/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${storage}")" + ensure_proxy_repo raw raw-githubusercontent "$(printf '{"name":"raw-githubusercontent","online":true,%s,"proxy":{"remoteUrl":"https://raw.githubusercontent.com/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${raw_storage}")" + ensure_proxy_repo raw raw-codeload-github "$(printf '{"name":"raw-codeload-github","online":true,%s,"proxy":{"remoteUrl":"https://codeload.github.com/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${raw_storage}")" ensure_proxy_repo rubygems gem-proxy "$(printf '{"name":"gem-proxy","online":true,%s,"proxy":{"remoteUrl":"https://rubygems.org/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'}}' "${storage}")" ensure_proxy_repo go go-proxy "$(printf '{"name":"go-proxy","online":true,%s,"proxy":{"remoteUrl":"https://proxy.golang.org/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'}}' "${storage}")" ensure_proxy_repo yum yum-rocky "$(printf '{"name":"yum-rocky","online":true,%s,"proxy":{"remoteUrl":"https://download.rockylinux.org/pub/rocky/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"yum":{"repodataDepth":5}}' "${storage}")" ensure_proxy_repo yum yum-fedora "$(printf '{"name":"yum-fedora","online":true,%s,"proxy":{"remoteUrl":"https://download.fedoraproject.org/pub/fedora/linux/","contentMaxAge":'"${CACHE_CONTENT_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"yum":{"repodataDepth":5}}' "${storage}")" - ensure_proxy_repo raw raw-packagist "$(printf '{"name":"raw-packagist","online":true,%s,"proxy":{"remoteUrl":"https://repo.packagist.org/","contentMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${storage}")" # nocheck: url - ensure_proxy_repo raw raw-alpine "$(printf '{"name":"raw-alpine","online":true,%s,"proxy":{"remoteUrl":"https://dl-cdn.alpinelinux.org/alpine/","contentMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${storage}")" + ensure_proxy_repo raw raw-packagist "$(printf '{"name":"raw-packagist","online":true,%s,"proxy":{"remoteUrl":"https://repo.packagist.org/","contentMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${raw_storage}")" # nocheck: url + ensure_proxy_repo raw raw-alpine "$(printf '{"name":"raw-alpine","online":true,%s,"proxy":{"remoteUrl":"https://dl-cdn.alpinelinux.org/alpine/","contentMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"',"metadataMaxAge":'"${CACHE_METADATA_MAX_AGE_MIN}"'},"raw":{"contentDisposition":"ATTACHMENT"}}' "${raw_storage}")" } ensure_eula_accepted() { diff --git a/scripts/install/filesystem.sh b/scripts/install/filesystem.sh index 61f8428cdc..31b6b52136 100755 --- a/scripts/install/filesystem.sh +++ b/scripts/install/filesystem.sh @@ -112,13 +112,13 @@ install_pacman() { install_dnf_native() { case "${ID:-}" in fedora) - retry dnf install -y e2fsprogs btrfs-progs + retry dnf --refresh install -y e2fsprogs btrfs-progs return ;; esac log "adding EPEL, the only place the EL family carries btrfs-progs" - retry dnf install -y epel-release - retry dnf install -y e2fsprogs btrfs-progs + retry dnf --refresh install -y epel-release + retry dnf --refresh install -y e2fsprogs btrfs-progs } # Param: $1 path segment of the zfsonlinux repository, `fedora` or `epel` @@ -155,7 +155,7 @@ install_dnf() { log "zfs userland offered by the repository: ${zfs_version}" if ! command -v rpmbuild >/dev/null 2>&1; then - retry dnf install -y rpm-build + retry dnf --refresh install -y rpm-build fi local topdir=/tmp/zfs-kmod-container @@ -180,7 +180,7 @@ SPEC rpmbuild --define "_topdir ${topdir}" -bb "${topdir}/SPECS/zfs-kmod-container.spec" dnf install -y "${topdir}"/RPMS/noarch/zfs-kmod-container-*.rpm - retry dnf install -y zfs + retry dnf --refresh install -y zfs if rpm -qa 'kernel-devel*' 'kernel-debug*' 'zfs-dkms' | grep -q .; then log "ERROR: the transaction pulled kernel or DKMS packages, so the dummy did not take" diff --git a/scripts/tests/deploy/swarm/utils/collect/diagnostics.sh b/scripts/tests/deploy/swarm/utils/collect/diagnostics.sh index 327df86f04..970ce9caf3 100755 --- a/scripts/tests/deploy/swarm/utils/collect/diagnostics.sh +++ b/scripts/tests/deploy/swarm/utils/collect/diagnostics.sh @@ -32,6 +32,12 @@ dexec() { timeout 30 docker exec "$@" } +sep "node-package-manager" "package manager logs (a failed download names the mirror, the URL and the status)" +for node in "${MGR}" "${WRK1}" "${WRK2}" "${NFS_SERVER}" "${BACKUP_NODE}"; do + echo "=== ${node} ===" + dexec "${node}" sh -c "tail -n 3000 /var/log/dnf5.log /var/log/dnf.librepo.log 2>&1" +done + for node in "${MGR}" "${WRK1}" "${WRK2}"; do sep "compose-tree" "${node}: /opt/compose tree" dexec "${node}" find /opt/compose -maxdepth 3 -type f -name '*.yml' 2>/dev/null diff --git a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh index 426d3d1502..c3a5e5d1bf 100755 --- a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh +++ b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh @@ -16,7 +16,7 @@ for container in "$@"; do docker inspect "${container}" >/dev/null 2>&1 || continue echo ">>> swarm-cleanup: detach NFS mounts inside ${container}" - if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH'; then + if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH' set -eu mounts="$( @@ -62,6 +62,7 @@ printf '%s\n' "${mounts}" | while IFS= read -r mount_point; do fi done SH + then echo "WARNING: could not inspect/unmount NFS mounts inside ${container} (gave up after ${NFS_CONTAINER_TIMEOUT})" >&2 fi done diff --git a/scripts/tests/workspace/compose/01_minimal.sh b/scripts/tests/workspace/compose/01_minimal.sh index 783c7ffa06..1c718d388a 100755 --- a/scripts/tests/workspace/compose/01_minimal.sh +++ b/scripts/tests/workspace/compose/01_minimal.sh @@ -11,8 +11,9 @@ source "${SCRIPT_DIR}/../utils/cache.sh" echo "Snapshotting cache counters before the deploy." CACHE_BEFORE="$(cache_snapshot)" -echo "Deploying dashboard with all variable (group-conditional) services disabled to speed up the deploy and verify disable= suppresses them from the inventory." -make compose-deploy mode=reinstall apps="${DASHBOARD_APP}" disable="$(variable_services dashboard javascript)" +echo "Deploying dashboard with all variable (group-conditional) services disabled, except the asset provider, to speed up the deploy and verify disable= suppresses them from the inventory." +# Exception: without the asset provider the dashboard loads its logo from the public file.infinito.nexus, which ties this test to that host's uptime; variant 1 pins the provider off, so only round 0 runs here. +make compose-deploy mode=reinstall apps="${DASHBOARD_APP}" variant=0 disable="$(variable_services dashboard javascript asset)" inspect echo "Actively probing both caches to confirm pull-through works end-to-end." diff --git a/skills/i8-release-article/SKILL.md b/skills/i8-release-article/SKILL.md new file mode 100644 index 0000000000..c31e94f8ba --- /dev/null +++ b/skills/i8-release-article/SKILL.md @@ -0,0 +1,18 @@ +--- +name: i8-release-article +description: > + Write the blog.infinito.nexus article for a release, its banner image for + the Featured image, and the Mastodon and LinkedIn posts that announce it, + from the changelog, in the blog's release style and a non-technical, + feature-oriented voice for readers outside the project. Use when the + operator asks for a release article, blog post, release banner or release + announcement on social media. Infinito.Nexus specific. +--- + +Follow the instructions from AGENTS.md, then write the release article by +following the procedure in `docs/agents/action/release-article.md` (relative +to the Infinito.Nexus repository root) exactly. That document is the source +of truth; this skill only routes you there and ships the article and banner +templates under `templates/`. Begin by clarifying every open requirement with +the `active-listening` skill (release version, headline feature), then work +under the `robot` skill. diff --git a/skills/i8-release-article/templates/article.html b/skills/i8-release-article/templates/article.html new file mode 100644 index 0000000000..c9729da496 --- /dev/null +++ b/skills/i8-release-article/templates/article.html @@ -0,0 +1,501 @@ + + + +
+ +
+ Release {{VERSION}} +
+ +

+ {{INTRO}} +

+ +

+ {{INTRO_MORE}} +

+ + +
+ 🚨 {{VERSION}} is a major release. + {{WARNING}} + + Read Before You Upgrade before you deploy. + +
+ + +
+ +
+ + {{CARD_ICON}} + + +

{{CARD_TITLE}}

+ +

+ {{CARD_TEXT}} +

+
+ +
+ + +

+ {{SECTION_TITLE}} +

+ +

+ {{SECTION_TEXT}} +

+ +

+ + {{LIST_LEAD}} + +

+ +
    +
  • + {{ITEM_LEAD}}: {{ITEM_TEXT}} +
  • +
+ + +
+ +

{{CALLOUT_TITLE}}

+ +

+ {{CALLOUT_TEXT}} +

+ +
    +
  • + {{ITEM_LEAD}}: + {{ITEM_TEXT}} +
  • +
+ +
+ + +

+ Before You Upgrade +

+ +

+ {{UPGRADE_LEAD}} +

+ +
+ + + + + + + + + + + + + + + + +
If you…Then…
{{IF_YOU}} + {{THEN}} +
+
+ + +

+ More Reliable +

+ +
    +
  • + {{FIX_LEAD}}: + {{FIX_TEXT}} +
  • +
+ + +

+ Updated Applications +

+ +
+ {{APP}} {{APP_VERSION}} +
+ + +
+ +

{{CLOSING_TITLE}}

+ +

+ {{CLOSING_TEXT}} +

+ + + +
+ +
diff --git a/skills/i8-release-article/templates/banner.svg b/skills/i8-release-article/templates/banner.svg new file mode 100644 index 0000000000..0f24619515 --- /dev/null +++ b/skills/i8-release-article/templates/banner.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ICON_1}} + {{ICON_2}} + {{ICON_3}} + {{ICON_4}} + + + {{LABEL_1}} + {{LABEL_2}} + {{LABEL_3}} + {{LABEL_4}} + + + + + + + + + + + + + + + + + + + + RELEASE {{VERSION}} + + Infinito.Nexus {{VERSION}} + + {{SUBTITLE_1}} + {{SUBTITLE_2}} + + diff --git a/tests/integration/iam/passwords/test_quote_in_shell.py b/tests/integration/iam/passwords/test_quote_in_shell.py index 280998ecaa..be3801d6d0 100644 --- a/tests/integration/iam/passwords/test_quote_in_shell.py +++ b/tests/integration/iam/passwords/test_quote_in_shell.py @@ -19,7 +19,7 @@ PASSWORD_TOKEN_RE = re.compile(r"(?i)\b[a-z0-9_]*password[a-z0-9_]*\b") QUOTE_FILTER_RE = re.compile(r"\|\s*quote\b", re.IGNORECASE) SHELL_KEY_RE = re.compile(r"^\s*(?:ansible\.builtin\.)?shell\s*:\s*(.*)$") -STDIN_KEY_RE = re.compile(r"^\s*stdin\s*:\s*[|>]") +STDIN_KEY_RE = re.compile(r"^\s*stdin\s*:") QUOTE_CHARS = {"'", '"'} diff --git a/tests/lint/ansible/jinja/test_proxy_location_strips.py b/tests/lint/ansible/jinja/test_proxy_location_strips.py new file mode 100644 index 0000000000..93b750fc31 --- /dev/null +++ b/tests/lint/ansible/jinja/test_proxy_location_strips.py @@ -0,0 +1,90 @@ +"""Lint: every proxying location the front proxy includes strips upstream headers. + +``proxy_hide_header`` is replaced, not merged, by a location that sets its own, +so ``upstream_strips.conf.j2`` only takes effect where a location includes it. +A location fragment without it leaks ``X-Powered-By`` and the upstream's +``Strict-Transport-Security`` on that path alone. + +Scope: role templates without a ``server`` block. Those are the fragments the +front proxy renders into a vhost; a template with its own ``server`` block is +the config of an app-internal nginx that sits behind such a location. +""" + +from __future__ import annotations + +import re +import unittest +from pathlib import Path + +from utils.cache.files import iter_project_files, read_text + +from . import PROJECT_ROOT + +_STRIPS = "roles/sys-svc-proxy/templates/headers/upstream_strips.conf.j2" +_SERVER_BLOCK = re.compile(r"^\s*server\s*\{", re.MULTILINE) +_LOCATION_OPEN = re.compile(r"^\s*location\b[^{]*\{\s*$") +_PROXYING = re.compile(r"\bproxy_pass\b|lookup\('proxy_pass'|_backend\s*\}\}") + + +def _role_templates() -> list[str]: + return sorted( + path + for path in iter_project_files(extensions=(".j2",), exclude_tests=True) + if "/roles/" in path and "/templates/" in path + ) + + +def _location_blocks(lines: list[str]) -> list[tuple[int, str]]: + blocks: list[tuple[int, str]] = [] + index = 0 + while index < len(lines): + if not _LOCATION_OPEN.match(lines[index]): + index += 1 + continue + start = index + depth = lines[index].count("{") - lines[index].count("}") + body: list[str] = [] + index += 1 + while index < len(lines) and depth > 0: + depth += lines[index].count("{") - lines[index].count("}") + body.append(lines[index]) + index += 1 + blocks.append((start + 1, "\n".join(body))) + return blocks + + +class TestProxyLocationStrips(unittest.TestCase): + def test_at_least_one_fragment_is_checked(self) -> None: + """Otherwise the assertion below passes over an empty list.""" + checked = [ + path + for path in _role_templates() + if not _SERVER_BLOCK.search(read_text(path)) + and any( + _PROXYING.search(body) + for _, body in _location_blocks(read_text(path).splitlines()) + ) + ] + self.assertTrue(checked, "no proxying location fragment found to check") + + def test_proxying_locations_include_the_strips(self) -> None: + findings: list[str] = [] + for path in _role_templates(): + text = read_text(path) + if _SERVER_BLOCK.search(text): + continue + rel = Path(path).relative_to(PROJECT_ROOT).as_posix() + for line, body in _location_blocks(text.splitlines()): + if _PROXYING.search(body) and _STRIPS not in body: + findings.append(f"- {rel}:{line}") + if findings: + self.fail( + "These proxying locations do not include the upstream header strips, " + "so X-Powered-By and the upstream HSTS leak on their path:\n" + + "\n".join(findings) + + f"\n\nFix: add `{{% include '{_STRIPS}' %}}` inside each location." + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/unit/python/library/test_database_query.py b/tests/unit/python/library/test_database_query.py index 83ae8969d8..2f9d53e125 100644 --- a/tests/unit/python/library/test_database_query.py +++ b/tests/unit/python/library/test_database_query.py @@ -93,13 +93,13 @@ class BuildCmdPostgresTests(unittest.TestCase): self.assertIn("ON_ERROR_STOP=1", cmd) self.assertNotIn("s3cret", cmd) - def test_postgres_expect_rows_adds_tuples_only_flag(self): + def test_postgres_expect_rows_adds_quiet_tuples_only_flag(self): cmd, _ = _DB_MOD._build_cmd(_BASE_CONFIG, expect_rows=True) - self.assertIn("-tA", cmd) + self.assertIn("-qtA", cmd) def test_postgres_no_rows_omits_tuples_only_flag(self): cmd, _ = _DB_MOD._build_cmd(_BASE_CONFIG, expect_rows=False) - self.assertNotIn("-tA", cmd) + self.assertNotIn("-qtA", cmd) class BuildCmdMariadbTests(unittest.TestCase): diff --git a/tests/unit/python/plugins/lookup/test_compose_file_args.py b/tests/unit/python/plugins/lookup/test_compose_file_args.py index 8ad1a27a86..6d37f73d6b 100644 --- a/tests/unit/python/plugins/lookup/test_compose_file_args.py +++ b/tests/unit/python/plugins/lookup/test_compose_file_args.py @@ -1,5 +1,7 @@ import importlib.util +import tempfile import unittest +from pathlib import Path from unittest.mock import patch from ansible.errors import AnsibleError @@ -168,6 +170,16 @@ class TestComposeFArgs(unittest.TestCase): self.assertEqual(out, "-f /x/compose.yml") + def test_role_provides_override_reads_the_role_of_the_given_application(self): + with ( + tempfile.TemporaryDirectory() as role, + patch.object(self.m, "abs_role_path_by_application_id", return_value=role), + ): + self.assertFalse(self.m._role_provides_override(application_id="x")) + (Path(role) / "templates").mkdir() + (Path(role) / "templates" / "compose.override.yml.j2").write_text("") + self.assertTrue(self.m._role_provides_override(application_id="x")) + def test_requires_one_term(self): with self.assertRaises(AnsibleError): self.lookup.run([], variables=self.vars) diff --git a/tests/unit/python/roles/svc-opt-ssd-hdd/test_storage_optimizer.py b/tests/unit/python/roles/svc-opt-ssd-hdd/test_storage_optimizer.py index d7ea8b8b90..e9c72826dd 100644 --- a/tests/unit/python/roles/svc-opt-ssd-hdd/test_storage_optimizer.py +++ b/tests/unit/python/roles/svc-opt-ssd-hdd/test_storage_optimizer.py @@ -54,5 +54,31 @@ class TestHealthCheckLogic(unittest.TestCase): ) +class TestIsDatabase(unittest.TestCase): + def test_classification(self): + test_cases = [ + ("postgres_custom:18", True), + ("openldap_custom:13.7-slim", True), + ("mariadb_custom:11.8", True), + ("postgis/postgis:17-3.5", True), + ("valkey/valkey:8", True), + ("docker.io/library/postgres:18", True), + ("ghcr.io/infinito-nexus/mirror/docker.io/library/postgres:18", True), + ("registry.infinito.test:5000/openldap_custom:13.7-slim", True), + ("postgres@sha256:" + "0" * 64, True), + ("docker.elastic.co/elasticsearch/elasticsearch:9.1.0", True), + ("bigbluebutton_custom:v3.0.39", False), + ("registry.infinito.test:5000/nextcloud:31", False), + ("ghcr.io/ldapaccountmanager/lam:9", False), + ("phpldapadmin/phpldapadmin:2", False), + ] + for image_name, expected in test_cases: + self.assertEqual( + storage_optimizer.is_database(image_name), + expected, + f"Image {image_name} expected {expected}", + ) + + if __name__ == "__main__": unittest.main() diff --git a/tests/unit/python/roles/web-app-bigbluebutton/filter_plugins/test_compose_mods.py b/tests/unit/python/roles/web-app-bigbluebutton/filter_plugins/test_compose_mods.py index d5822c4e59..28084185c2 100644 --- a/tests/unit/python/roles/web-app-bigbluebutton/filter_plugins/test_compose_mods.py +++ b/tests/unit/python/roles/web-app-bigbluebutton/filter_plugins/test_compose_mods.py @@ -197,6 +197,26 @@ services: self.compose_repository_path + "/mod/html5-dev", ) + def test_build_stripped_for_a_pinned_service_without_upstream_image(self): + original = """services: + bbb-shared-notes-server: + build: + context: mod/bbb-shared-notes-server + html5-dev: + build: + context: mod/html5-dev +""" + services = load_yaml_str( + compose_mods( + original, + self.compose_repository_path, + self.env_file, + pinned=["bbb-shared-notes-server"], + ) + )["services"] + self.assertNotIn("build", services["bbb-shared-notes-server"]) + self.assertIn("build", services["html5-dev"]) + if __name__ == "__main__": unittest.main() diff --git a/tests/unit/python/utils/install/lint/test_main.py b/tests/unit/python/utils/install/lint/test_main.py index 1ac3539ca8..be096bf743 100644 --- a/tests/unit/python/utils/install/lint/test_main.py +++ b/tests/unit/python/utils/install/lint/test_main.py @@ -17,6 +17,8 @@ def _make_repo_root(tmp: str, *, stamp_age_offset: float | None = None) -> Path: (root / "scripts" / "install").mkdir(parents=True) (root / "scripts" / "install" / "lint.sh").write_text("#\n", encoding="utf-8") (root / "pyproject.toml").write_text("[project]\n", encoding="utf-8") + (root / cli._PINS).parent.mkdir(parents=True) + (root / cli._PINS).write_text("---\n", encoding="utf-8") if stamp_age_offset is not None: stamp = root / cli._STAMP stamp.parent.mkdir(parents=True, exist_ok=True) @@ -86,6 +88,24 @@ class TestStampLogic(unittest.TestCase): inst.assert_called_once() self.assertTrue((root / cli._STAMP).exists()) + def test_a_newer_release_pin_triggers_install(self) -> None: + with TemporaryDirectory() as tmp: + root = _make_repo_root(tmp, stamp_age_offset=60.0) + pins = root / cli._PINS + later = time.time() + 120.0 + os.utime(pins, (later, later)) + with ( + mock.patch.object(cli, "PROJECT_ROOT", root), + mock.patch.object(cli.shutil, "which", return_value="/usr/bin/x"), + mock.patch.object( + cli.mermaid_cli, "browser_installed", return_value=True + ), + mock.patch.object(cli, "_install_all") as inst, + ): + rc = cli.main([]) + self.assertEqual(rc, 0) + inst.assert_called_once() + def test_no_stamp_triggers_install_and_touches(self) -> None: with TemporaryDirectory() as tmp: root = _make_repo_root(tmp) diff --git a/tests/unit/python/utils/install/lint/test_shfmt.py b/tests/unit/python/utils/install/lint/test_shfmt.py new file mode 100644 index 0000000000..95b63997a5 --- /dev/null +++ b/tests/unit/python/utils/install/lint/test_shfmt.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +import subprocess +import unittest +import unittest.mock as mock + +from utils.install.lint import shfmt + +_WANT = shfmt.resolve_release("shfmt")[1] + + +def _ensure(*versions: str | None) -> mock.MagicMock: + with ( + mock.patch.object(shfmt, "_installed_version", side_effect=list(versions)), + mock.patch.object(shfmt, "_install_binary") as install, + ): + shfmt.ensure() + return install + + +class TestEnsure(unittest.TestCase): + def test_the_pinned_release_stays(self) -> None: + _ensure(_WANT).assert_not_called() + + def test_a_distribution_release_is_replaced(self) -> None: + _ensure("3.8.0", _WANT).assert_called_once() + + def test_a_missing_shfmt_is_installed(self) -> None: + _ensure(None, _WANT).assert_called_once() + + def test_a_shadowed_install_fails_loudly(self) -> None: + with self.assertRaisesRegex(RuntimeError, "must precede"): + _ensure("3.8.0", "3.8.0") + + +class TestInstalledVersion(unittest.TestCase): + def _version(self, **run: object) -> str | None: + with mock.patch.object(shfmt.subprocess, "run", **run): + return shfmt._installed_version() + + def test_a_release_binary_drops_its_v(self) -> None: + done = subprocess.CompletedProcess([], 0, stdout="v3.14.1\n", stderr="") + self.assertEqual(self._version(return_value=done), "3.14.1") + + def test_a_distribution_build_reads_as_is(self) -> None: + done = subprocess.CompletedProcess([], 0, stdout="3.8.0\n", stderr="") + self.assertEqual(self._version(return_value=done), "3.8.0") + + def test_a_missing_binary_reads_as_none(self) -> None: + self.assertIsNone(self._version(side_effect=FileNotFoundError("shfmt"))) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/unit/python/utils/install/test_node.py b/tests/unit/python/utils/install/test_node.py index 1be42c2db1..e3e2d3d5fc 100644 --- a/tests/unit/python/utils/install/test_node.py +++ b/tests/unit/python/utils/install/test_node.py @@ -2,17 +2,152 @@ from __future__ import annotations +import datetime as dt +import hashlib +import tempfile import unittest import unittest.mock as mock +from pathlib import Path from utils.install import node as node_mod +SCHEDULE = { + "v20": {"end": "2026-04-30"}, + "v22": {"end": "2027-04-30"}, + "v24": {"end": "2028-04-30"}, +} +TODAY = dt.date(2026, 10, 21) + + +class TestLineIsSupported(unittest.TestCase): + def test_line_before_its_end_is_supported(self) -> None: + self.assertTrue(node_mod.line_is_supported("v22", SCHEDULE, TODAY)) + + def test_line_on_its_end_date_is_supported(self) -> None: + self.assertTrue( + node_mod.line_is_supported("v20", SCHEDULE, dt.date(2026, 4, 30)) + ) + + def test_line_past_its_end_is_not_supported(self) -> None: + self.assertFalse(node_mod.line_is_supported("v20", SCHEDULE, TODAY)) + + def test_unknown_line_is_not_supported(self) -> None: + self.assertFalse(node_mod.line_is_supported("v18", SCHEDULE, TODAY)) + + +class TestNewestLts(unittest.TestCase): + def test_skips_current_releases(self) -> None: + index = [ + {"version": "v26.1.0", "lts": False}, + {"version": "v24.22.1", "lts": "Krypton"}, + {"version": "v22.30.0", "lts": "Jod"}, + ] + self.assertEqual(node_mod.newest_lts(index), "v24.22.1") + + def test_raises_without_lts(self) -> None: + with self.assertRaises(RuntimeError): + node_mod.newest_lts([{"version": "v26.1.0", "lts": False}]) + + +class TestTarballName(unittest.TestCase): + def test_maps_x86_64(self) -> None: + self.assertEqual( + node_mod.tarball_name("v24.22.1", "Linux", "x86_64"), + "node-v24.22.1-linux-x64.tar.gz", + ) + + def test_maps_aarch64(self) -> None: + self.assertEqual( + node_mod.tarball_name("v24.22.1", "Linux", "aarch64"), + "node-v24.22.1-linux-arm64.tar.gz", + ) + + def test_raises_for_unknown_machine(self) -> None: + with self.assertRaises(RuntimeError): + node_mod.tarball_name("v24.22.1", "Linux", "riscv64") + + def test_refuses_a_host_that_is_not_linux(self) -> None: + with self.assertRaises(RuntimeError): + node_mod.tarball_name("v24.22.1", "Darwin", "x86_64") + + +class TestExpectedSha256(unittest.TestCase): + def test_finds_the_listed_file(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + shasums = Path(tmp) / "SHASUMS256.txt" + shasums.write_text( + "aaa node-v24.22.1-linux-arm64.tar.gz\n" + "bbb node-v24.22.1-linux-x64.tar.gz\n", + encoding="utf-8", + ) + self.assertEqual( + node_mod.expected_sha256(shasums, "node-v24.22.1-linux-x64.tar.gz"), + "bbb", + ) + + def test_raises_for_an_unlisted_file(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + shasums = Path(tmp) / "SHASUMS256.txt" + shasums.write_text("aaa other.tar.gz\n", encoding="utf-8") + with self.assertRaises(RuntimeError): + node_mod.expected_sha256(shasums, "node-v24.22.1-linux-x64.tar.gz") + + +class TestInstallUpstreamLts(unittest.TestCase): + def test_refuses_a_tarball_whose_checksum_differs(self) -> None: + name = "node-v24.22.1-linux-x64.tar.gz" + + def fake_download(url: str, output: str, **_kwargs: object) -> None: + path = Path(output) + if url.endswith("index.json"): + path.write_text( + '[{"version": "v24.22.1", "lts": "Krypton"}]', encoding="utf-8" + ) + elif url.endswith("SHASUMS256.txt"): + listed = hashlib.sha256(b"published").hexdigest() + path.write_text(f"{listed} {name}\n", encoding="utf-8") + else: + path.write_bytes(b"tampered") + + with ( + mock.patch.object(node_mod, "download_file", side_effect=fake_download), + mock.patch.object(node_mod, "_verify_signature"), + mock.patch.object(node_mod.platform, "system", return_value="Linux"), + mock.patch.object(node_mod.platform, "machine", return_value="x86_64"), + mock.patch.object(node_mod, "run_privileged") as extract, + self.assertRaises(RuntimeError), + ): + node_mod.install_upstream_lts() + extract.assert_not_called() + class TestEnsureNodePresent(unittest.TestCase): - def test_delegates_to_the_shared_provisioner(self) -> None: - with mock.patch.object(node_mod, "ensure_command_present") as ensure: + def setUp(self) -> None: + node_mod.ensure_node_present.cache_clear() + self.addCleanup(node_mod.ensure_node_present.cache_clear) + + def _run(self, line: str) -> mock.MagicMock: + def fake_download(_url: str, output: str, **_kwargs: object) -> None: + Path(output).write_text( + '{"v20": {"end": "2026-04-30"}, "v22": {"end": "2099-04-30"}}', + encoding="utf-8", + ) + + with ( + mock.patch.object(node_mod, "ensure_command_present") as ensure, + mock.patch.object(node_mod, "installed_line", return_value=line), + mock.patch.object(node_mod, "download_file", side_effect=fake_download), + mock.patch.object(node_mod, "install_upstream_lts") as upstream, + ): node_mod.ensure_node_present() ensure.assert_called_once_with("node") + return upstream + + def test_keeps_a_supported_distro_node(self) -> None: + self._run("v22").assert_not_called() + + def test_replaces_an_end_of_life_distro_node(self) -> None: + self._run("v20").assert_called_once_with() def test_propagates_the_hard_failure(self) -> None: with ( diff --git a/tests/unit/python/utils/install/test_npm.py b/tests/unit/python/utils/install/test_npm.py index 9f3cb45246..5399f6f1a3 100644 --- a/tests/unit/python/utils/install/test_npm.py +++ b/tests/unit/python/utils/install/test_npm.py @@ -10,6 +10,19 @@ from utils.install import npm as npm_mod class TestEnsureNpmPresent(unittest.TestCase): + def setUp(self) -> None: + patcher = mock.patch("utils.install.node.ensure_node_present") + self.ensure_node = patcher.start() + self.addCleanup(patcher.stop) + + def test_provides_a_supported_node_first(self) -> None: + with ( + mock.patch.object(npm_mod.shutil, "which", return_value="/usr/bin/npm"), + mock.patch("utils.install.system_pkg.install_command_via_pkg"), + ): + npm_mod.ensure_npm_present() + self.ensure_node.assert_called_once_with() + def test_present_noop(self) -> None: with ( mock.patch.object(npm_mod.shutil, "which", return_value="/usr/bin/npm"), diff --git a/tests/unit/python/utils/update/test_source.py b/tests/unit/python/utils/update/test_source.py index e10f86c77f..df905623d2 100644 --- a/tests/unit/python/utils/update/test_source.py +++ b/tests/unit/python/utils/update/test_source.py @@ -179,7 +179,10 @@ class TestOutdated(unittest.TestCase): class TestTemplate(unittest.TestCase): def _outdated(self, services: str, upstream: str) -> list[str]: root = _repo(services) - with mock.patch.object(module, "documents", return_value=upstream): + with ( + mock.patch.object(module, "documents", return_value=upstream), + mock.patch.object(module, "manifest_exists", return_value=True), + ): updates = module.outdated(module.collect_entries(root), root) return [update.latest for update in updates] @@ -206,6 +209,31 @@ class TestTemplate(unittest.TestCase): ) +class TestPulledImage(unittest.TestCase): + def _outdated(self, exists: bool | None) -> tuple[list[str], mock.MagicMock]: + root = _repo(COMPOUND) + with ( + mock.patch.object( + module, "documents", return_value="core v3.0.39\npart v1.11.3\n" + ), + mock.patch.object(module, "manifest_exists", return_value=exists) as probe, + ): + updates = module.outdated(module.collect_entries(root), root) + return [update.latest for update in updates], probe + + def test_a_tag_the_image_registry_lacks_is_not_pinned(self) -> None: + latest, probe = self._outdated(False) + self.assertEqual(latest, []) + probe.assert_called_once_with("example/part", "v1.11.3-v3.0.39") + + def test_an_indeterminate_registry_answer_keeps_the_bump(self) -> None: + self.assertEqual(self._outdated(None)[0], ["v1.11.3-v3.0.39"]) + + def test_only_the_version_of_a_pulled_image_carries_the_image(self) -> None: + entries = {e.key: e.image for e in module.collect_entries(_repo())} + self.assertEqual(entries, {"app_version": "", "version": "example"}) + + class TestAddons(unittest.TestCase): def test_only_a_declared_or_github_released_addon_pin_is_collected(self) -> None: entries = module.collect_entries(_addon_repo()) diff --git a/utils/install/README.md b/utils/install/README.md index 176f9638b3..cb65f7d83e 100644 --- a/utils/install/README.md +++ b/utils/install/README.md @@ -15,6 +15,7 @@ Modules at this level are channel-agnostic primitives; per-tool policy lives one | `primitives.py` | Logging, sudo wrapping, PATH mutation, and stdlib-based URL download. | | `pip.py` | Venv-aware pip installer with `--break-system-packages` and `--user` fallback. | | `npm.py` | Global / local npm install with per-user `--prefix` fallback. | +| `node.py` | Node.js runtime that is still supported upstream: the distro package, or the newest LTS from nodejs.org (signature- and checksum-verified) when the distro line has reached its end of life. | | `github_release.py` | Latest-tag resolver and asset downloader for GitHub releases. | | `system_pkg.py` | Per-manager dispatch for `pacman` / `apt-get` / `dnf` / `yum` / `brew`. | | `lint/` | One module per tool, each exposing `ensure()`. See [lint README](lint/README.md). | @@ -33,5 +34,6 @@ The matching dispatcher [wrapper.sh](../../scripts/install/wrapper.sh) routes `m - `primitives.py` MUST NOT import from any other module in this package. - `pip.py`, `npm.py`, `github_release.py`, and `system_pkg.py` MAY import from `primitives.py`. -- `npm.py` MAY import from `system_pkg.py` to bootstrap npm itself; no other cross-imports between these four are allowed. +- `npm.py` MAY import from `system_pkg.py` and `node.py` to bootstrap npm itself; no other cross-imports between these four are allowed. +- `node.py` MAY import from `primitives.py` and `system_pkg.py`. - Per-tool modules under `lint/` MUST NOT import each other (see [lint README](lint/README.md)). diff --git a/utils/install/lint/__main__.py b/utils/install/lint/__main__.py index 9fed403e4b..432167f92a 100644 --- a/utils/install/lint/__main__.py +++ b/utils/install/lint/__main__.py @@ -37,12 +37,15 @@ from utils.install.lint.ansible import collections as ansible_collections from utils.install.lint.ansible import commands as ansible_commands from utils.install.lint.ansible import lint as ansible_lint from utils.install.primitives import warn +from utils.roles.mapping import ROLE_FILE_META_SERVICES _STAMP_KEY = hashlib.sha256(sys.executable.encode("utf-8")).hexdigest()[:8] _STAMP = f"build/install-lint-{_STAMP_KEY}.stamp" +_PINS = f"roles/sys-lint/{ROLE_FILE_META_SERVICES}" _STAMP_DEPS = ( "scripts/install/lint.sh", "pyproject.toml", + _PINS, ) _STAMP_TOOLS = ( diff --git a/utils/install/lint/shfmt.py b/utils/install/lint/shfmt.py index 1200af7537..16038fb137 100644 --- a/utils/install/lint/shfmt.py +++ b/utils/install/lint/shfmt.py @@ -1,9 +1,10 @@ -"""Install shfmt: system-pkg first, GitHub release fallback.""" +"""Install shfmt via GitHub-release prebuilt binary.""" from __future__ import annotations import os import platform +import subprocess import tempfile from pathlib import Path @@ -13,9 +14,7 @@ from utils.install.primitives import ( ensure_dir_on_path, install_with_optional_sudo, log, - which, ) -from utils.install.system_pkg import detect_package_manager, install_command_via_pkg _DEFAULT_INSTALL_DIR = os.environ.get("SHFMT_INSTALL_DIR", "/usr/local/bin") @@ -62,27 +61,29 @@ def _install_binary() -> None: ensure_dir_on_path(_DEFAULT_INSTALL_DIR) -def ensure() -> None: - if which("shfmt"): - return - - log("Missing command 'shfmt'. Attempting system package installation.") +def _installed_version() -> str | None: try: - manager = detect_package_manager() - try: - install_command_via_pkg("shfmt") - except RuntimeError as exc: - log(f"System package install failed for 'shfmt' via {manager}: {exc}") - except RuntimeError: - log( - "No supported package manager found; falling back to GitHub release binary." + proc = subprocess.run( + ["shfmt", "--version"], capture_output=True, text=True, check=True ) + except (OSError, subprocess.CalledProcessError): + return None + return proc.stdout.strip().lstrip("v") or None - if which("shfmt"): + +def ensure() -> None: + _slug, want = resolve_release("shfmt") + found = _installed_version() + if found == want: return - log("Falling back to official shfmt binary.") + log(f"Installing shfmt v{want} (found {found or 'no shfmt'}).") _install_binary() - if not which("shfmt"): - raise RuntimeError("Command 'shfmt' is still unavailable after installation.") + found = _installed_version() + if found != want: + raise RuntimeError( + f"Command 'shfmt' reports {found or 'nothing'} after installing " + f"v{want} into {_DEFAULT_INSTALL_DIR}; that directory must precede " + "any other shfmt on PATH." + ) diff --git a/utils/install/node.py b/utils/install/node.py index 631c85451c..262ffa4e53 100644 --- a/utils/install/node.py +++ b/utils/install/node.py @@ -1,17 +1,204 @@ -"""Node.js runtime provisioning for the JavaScript unit suite.""" +"""Node.js runtime provisioning for the lint toolchain and the JavaScript unit suite.""" from __future__ import annotations +import datetime as dt +import functools +import hashlib +import json +import platform +import shutil +import subprocess +import tempfile +from pathlib import Path + +from utils.install.primitives import download_file, log, run_privileged from utils.install.system_pkg import ensure_command_present +DIST_URL = "https://nodejs.org/dist" +SCHEDULE_URL = "https://raw.githubusercontent.com/nodejs/Release/main/schedule.json" +KEYRING_URL = "https://raw.githubusercontent.com/nodejs/release-keys/main/gpg-only-active-keys/pubring.kbx" +PREFIX = Path("/usr/local") +ARCHITECTURES = {"x86_64": "x64", "aarch64": "arm64", "arm64": "arm64"} -def ensure_node_present() -> None: - """Install the Node.js runtime through the system package manager. + +def _load_json(path: Path) -> object: + with path.open(encoding="utf-8") as handle: + return json.load(handle) + + +def installed_line() -> str: + """Return the release line of the ``node`` on PATH, such as ``v20``. + + Returns: + The major version prefixed with ``v``, as the release schedule keys it. + """ + version = subprocess.run( + ["node", "--version"], check=True, capture_output=True, text=True + ).stdout.strip() + return version.split(".", 1)[0] + + +def line_is_supported(line: str, schedule: dict, today: dt.date) -> bool: + """Tell whether a release line still receives upstream fixes. + + Args: + line: release line such as ``v20``. + schedule: the parsed nodejs/Release ``schedule.json``. + today: the date the end of life is compared against. + + Returns: + False for an unknown line and for a line past its ``end`` date. + """ + entry = schedule.get(line) + if entry is None: + return False + return dt.date.fromisoformat(entry["end"]) >= today + + +def newest_lts(index: list) -> str: + """Return the version of the newest LTS release in ``index.json``. + + Args: + index: the parsed ``https://nodejs.org/dist/index.json``, newest first. Raises: - RuntimeError: node is still absent after the install attempt. + RuntimeError: the index lists no LTS release. + """ + for release in index: + if release["lts"]: + return release["version"] + raise RuntimeError(f"{DIST_URL}/index.json lists no LTS release") + + +def tarball_name(version: str, system: str, machine: str) -> str: + """Return the Linux tarball name of a release for this host. + + Args: + version: release version such as ``v24.22.1``. + system: ``platform.system()`` of the host. + machine: ``platform.machine()`` of the host. + + Raises: + RuntimeError: the host is not Linux, or Node.js publishes no Linux + build for the machine. + """ + if system != "Linux": + raise RuntimeError( + f"The upstream Node.js install supports Linux only; install a " + f"supported Node.js through the package manager on {system}." + ) + arch = ARCHITECTURES.get(machine) + if arch is None: + raise RuntimeError(f"No Node.js Linux build for machine {machine!r}") + return f"node-{version}-linux-{arch}.tar.gz" + + +def expected_sha256(shasums: Path, name: str) -> str: + """Return the checksum ``SHASUMS256.txt`` records for a file. + + Args: + shasums: the downloaded ``SHASUMS256.txt``. + name: file name to look up. + + Raises: + RuntimeError: the file is not listed. + """ + with shasums.open(encoding="utf-8") as handle: + for line in handle: + digest, _, listed = line.strip().partition(" ") + if listed == name: + return digest + raise RuntimeError(f"{name} is not listed in {shasums.name}") + + +def _verify_signature(workdir: Path, shasums: Path, signature: Path) -> None: + ensure_command_present("gpgv") + keyring = workdir / "pubring.kbx" + download_file(KEYRING_URL, str(keyring)) + subprocess.run( + ["gpgv", "--keyring", str(keyring), str(signature), str(shasums)], + check=True, + ) + + +def _sha256(path: Path) -> str: + with path.open("rb") as handle: + return hashlib.file_digest(handle, "sha256").hexdigest() + + +def install_upstream_lts() -> str: + """Install the newest Node.js LTS from nodejs.org under ``PREFIX``. + + Returns: + The installed version. + + Raises: + RuntimeError: the checksum does not match, or ``node`` on PATH is not + the installed release afterwards. + subprocess.CalledProcessError: the signature does not verify. + """ + with tempfile.TemporaryDirectory() as tmp: + workdir = Path(tmp) + index = workdir / "index.json" + download_file(f"{DIST_URL}/index.json", str(index)) + version = newest_lts(_load_json(index)) + name = tarball_name(version, platform.system(), platform.machine()) + shasums = workdir / "SHASUMS256.txt" + signature = workdir / "SHASUMS256.txt.sig" + download_file(f"{DIST_URL}/{version}/SHASUMS256.txt", str(shasums)) + download_file(f"{DIST_URL}/{version}/SHASUMS256.txt.sig", str(signature)) + _verify_signature(workdir, shasums, signature) + tarball = workdir / name + log(f"Installing Node.js {version} from {DIST_URL} into {PREFIX}") + download_file(f"{DIST_URL}/{version}/{name}", str(tarball), timeout=300.0) + if _sha256(tarball) != expected_sha256(shasums, name): + raise RuntimeError(f"{name} does not match its SHASUMS256.txt entry") + top = name.removesuffix(".tar.gz") + run_privileged( + [ + "tar", + "-xzf", + str(tarball), + "-C", + str(PREFIX), + "--strip-components=1", + f"{top}/bin", + f"{top}/include", + f"{top}/lib", + f"{top}/share", + ] + ) + resolved = shutil.which("node") + line = installed_line() + if resolved != str(PREFIX / "bin" / "node") or line != version.split(".", 1)[0]: + raise RuntimeError( + f"node on PATH is {resolved!r} ({line}) after installing {version} " + f"into {PREFIX}" + ) + return version + + +@functools.cache +def ensure_node_present() -> None: + """Provide a ``node`` whose release line is still supported upstream. + + Raises: + RuntimeError: node is still absent after the install attempt, or the + upstream install failed its checks. """ ensure_command_present("node") + line = installed_line() + with tempfile.TemporaryDirectory() as tmp: + schedule = Path(tmp) / "schedule.json" + download_file(SCHEDULE_URL, str(schedule)) + supported = line_is_supported( + line, _load_json(schedule), dt.datetime.now(dt.UTC).date() + ) + if supported: + return + log(f"Node.js {line} on PATH has reached its end of life upstream.") + install_upstream_lts() if __name__ == "__main__": diff --git a/utils/install/npm.py b/utils/install/npm.py index 2306222c3e..e439e6f489 100644 --- a/utils/install/npm.py +++ b/utils/install/npm.py @@ -10,6 +10,9 @@ from utils.install.primitives import ensure_dir_on_path, install_with_optional_s def ensure_npm_present() -> None: + from utils.install.node import ensure_node_present + + ensure_node_present() if shutil.which("npm") is not None: return diff --git a/utils/install/system_pkg.py b/utils/install/system_pkg.py index bf625e35a2..9342ed4d18 100644 --- a/utils/install/system_pkg.py +++ b/utils/install/system_pkg.py @@ -143,6 +143,13 @@ _COMMAND_PACKAGES: dict[str, dict[str, list[str]]] = { "shfmt": {m: ["shfmt"] for m in _SUPPORTED}, "shellcheck": {m: ["shellcheck"] for m in _SUPPORTED}, "unzip": {m: ["unzip"] for m in _SUPPORTED}, + "gpgv": { + "pacman": ["gnupg"], + "apt-get": ["gpgv"], + "dnf": ["gnupg2"], + "yum": ["gnupg2"], + "brew": ["gnupg"], + }, "php": { "pacman": ["php"], "apt-get": ["php-cli", "php"], diff --git a/utils/update/source.py b/utils/update/source.py index 0cf9166337..3d6405feaa 100644 --- a/utils/update/source.py +++ b/utils/update/source.py @@ -39,6 +39,7 @@ from urllib.parse import urlencode from utils.annotations.suppress import is_suppressed_at from utils.cache.files import read_text from utils.cache.yaml import load_yaml +from utils.docker.registry import manifest_exists from utils.roles.mapping import ROLE_FILE_META_SERVICES from utils.update.addons import GITHUB_RELEASES_CATALOG, iter_addon_files from utils.update.base import ( @@ -83,6 +84,10 @@ class VersionSourceEntry: config_path: file that carries the pin. line: 1-indexed line of the pin. addon: whether the pin sits in ``meta/addons/.yml``. + image: image the pin tags when it is the entity's ``version``, pulled + directly or as the base of a ``custom`` build; a bump to a tag + its registry answers 404 for is withheld, an indeterminate answer + does not block it. """ role: str @@ -93,6 +98,7 @@ class VersionSourceEntry: config_path: Path line: int addon: bool = False + image: str = "" @dataclass(frozen=True) @@ -442,6 +448,7 @@ def collect_entries(repo_root: Path) -> list[VersionSourceEntry]: source=source, config_path=config_path, line=line, + image=config.get("image", "") if key == DEFAULT_KEY else "", ) ) return entries + _addon_entries(repo_root) @@ -458,8 +465,11 @@ def outdated( candidates(entry, repo_root), assembled=bool(entry.source.get("template")), ) - if newest: - updates.append(VersionSourceUpdate(entry=entry, latest=newest)) + if not newest: + continue + if entry.image and manifest_exists(entry.image, newest) is False: + continue + updates.append(VersionSourceUpdate(entry=entry, latest=newest)) return updates