Commit Graph
14682 Commits
Author SHA1 Message Date
kevinveenbirkenbach 0910029e3d admin: add trust-ca make target and host CA trust script
- add make target `trust-ca` as thin wrapper
- introduce scripts/administration/trust_ca.sh
- extract Infinito root CA from running container
- install CA into host trust store via with-ca-trust.sh
- keep Makefile free of logic, delegate to script

https://chatgpt.com/share/697e31e7-e548-800f-9edd-9b030ee12c5b
2026-01-31 17:46:24 +01:00
kevinveenbirkenbach b85024e1de Optimized https redirect and made it optional 2026-01-31 17:32:16 +01:00
kevinveenbirkenbach eccbce8034 templating: support list literals and path_join in fallback renderer
https://chatgpt.com/share/697e2b3c-7458-800f-bb6b-143f78a57551
2026-01-31 17:17:53 +01:00
kevinveenbirkenbach 76d09dbc3f refactor: centralize docker wrappers, CA injection paths, and update tests
Unify compose/run wrappers under PATH_* variables, wire CA trust injection
consistently, extend with NSS/Chromium support, and adapt unit tests to the
new run-based execution model.

https://chatgpt.com/share/697e1f92-bc5c-800f-968d-ad43c50afaea
2026-01-31 17:06:09 +01:00
kevinveenbirkenbach b1226b43c3 refactor(cert-deploy): restart nginx containers instead of reload after cert update
- Simplify certificate deployment logic by removing nginx reload handling
- Always restart containers that contain nginx to apply updated certificates
- Drop reload success/failure state tracking (restart is deterministic)
- Minor cleanup: remove trailing newlines and unused vars

https://chatgpt.com/share/697df820-8fc0-800f-a675-91ec019f7b3d
2026-01-31 13:39:54 +01:00
kevinveenbirkenbach 19e01ebb72 web-app-matomo: extract bootstrap token from stdout via regex
- Parse Matomo bootstrap token from mixed stdout output
- Ignore CA trust and installer log noise
- Ensure token assertion only evaluates pure hex token
2026-01-31 12:19:33 +01:00
kevinveenbirkenbach 7124a06fe0 web-app-matomo: use compose-base for bootstrap and harden debug output
- Switch Matomo bootstrap to DOCKER_CMD_BASE wrapper
  - ensures consistent env-file, override and CA handling
  - align compose project name with instance directory basename
- Replace shell-based debug dump with safe debug/command tasks
  - avoid shell quoting issues with stdout/stderr
  - respect MASK_CREDENTIALS_IN_LOGS
- Add explicit effective `docker compose config` debug via wrapper
- Improve failure message clarity

https://chatgpt.com/share/697de13f-0fd0-800f-9b46-d89d22a6737b
2026-01-31 12:02:16 +01:00
kevinveenbirkenbach aef99bf64e test(nginx_paths): mock tls_resolve lookup for protocol resolution
https://chatgpt.com/share/697ddc45-893c-800f-9c6d-ee899e4851cc
2026-01-31 11:40:21 +01:00
kevinveenbirkenbach ea8fbbdd71 fix(tls): resolve domains via app canonicals/aliases
- add module_utils/domain_mapper to map domains (canonical/aliases) -> application_id
  supporting str/list/dict and nested structures
- extend tls_common.resolve_term to optionally resolve alias domains via applications
  while keeping legacy lookup via global domains mapping intact
- pass applications into tls_resolve and cert_plan
- add unit tests for domain_mapper

https://chatgpt.com/share/697d500f-b884-800f-ba5b-088a2340f9d6
2026-01-31 01:42:43 +01:00
kevinveenbirkenbach c24b1044ae fix(domains): respect AUTO_BUILD_ALIASES when generating redirect mappings
- Do not auto-generate default alias (<entity>.<primary>) when AUTO_BUILD_ALIASES is false
- Only use explicitly defined aliases unless auto-build is enabled
- Treat empty server.domains as opt-out when auto-build is disabled
- Update unit tests to reflect strict alias semantics
- Clarify behavior with inline documentation and comments

https://chatgpt.com/share/697d4994-7690-800f-8987-296ce7215559
2026-01-31 01:15:11 +01:00
kevinveenbirkenbach 82e2cde747 refactor(nginx): replace NGINX vars with nginx_paths lookup and add http/https support
- Drop legacy NGINX path definitions from group_vars
- Add nginx_paths lookup plugin (paths + ensure dirs + http_includes)
- Update roles/templates to use nginx_paths for config/data/cache/user paths
- Add per-domain HTTP->HTTPS redirect + ACME challenge include
- Add unit tests for nginx_paths lookup
- Clean up obsolete sys-svc-letsencrypt role files

https://chatgpt.com/share/697d4466-af54-800f-a243-b28367638c85
2026-01-31 00:52:42 +01:00
kevinveenbirkenbach a7f5529a37 refactor(coturn): switch TLS cert/key lookup from tls_resolve to cert_plan
tls_resolve only resolves TLS mode/enabled state; cert_plan provides planned cert/key paths.

https://chatgpt.com/share/697d26c9-bcc8-800f-9d3c-4e09041d8f5e
2026-01-30 22:46:46 +01:00
kevinveenbirkenbach 3921306f11 fix(docker-compose): only pass --env-file to CA inject when file exists
The compose_ca_inject_cmd lookup previously appended --env-file
whenever docker_compose.files.env was set, even if the file did not
exist. This caused compose_ca_inject.py to fail hard.

Changes:
- Add existence check for env file using pathlib.Path.is_file()
- Resolve relative env paths against the compose instance directory
- Mirror existing handler behavior for --env-file handling
- Extend unit tests to cover both present and missing env-file cases
- Keep existing test coverage intact while adapting expectations

This aligns CA injection behavior with all other docker-compose handlers.

https://chatgpt.com/share/697d22a2-53c4-800f-9663-19a04f0587f6
2026-01-30 22:28:53 +01:00
kevinveenbirkenbach 3af52be55f sys-ctl-mtn-cert-deploy: remove hardcoded 5min sleep before nginx reload
The fixed sleep caused unnecessary delays during certificate deployment.
Readiness is handled implicitly via nginx config testing and reload logic,
making the global wait redundant and slow.

This change significantly reduces deployment time while keeping behavior safe.

https://chatgpt.com/share/697d20d3-6d04-800f-926a-a7e3be03d7e1
2026-01-30 22:21:15 +01:00
kevinveenbirkenbach 97ca9859d4 msmtp: route mail via localhost in containerized environments
Detect container context and automatically use 127.0.0.1 as SMTP host
when running inside Docker, while preserving the external mail host
for non-containerized setups. Add tls_host_override to keep correct
TLS/SNI behavior when connecting locally.

This aligns mail routing with CI/container networking constraints
without

https://chatgpt.com/share/697d20b2-11c0-800f-aacc-57977c798162
2026-01-30 22:20:05 +01:00
kevinveenbirkenbach 340e3696b6 dev: disarm AppArmor via host script and Makefile wrapper
Move AppArmor handling out of docker-compose files and into a
dedicated dev-only administration script. The new `disarmapp`
Make target acts as a thin wrapper to set relevant AppArmor
profiles (php-fpm, dovecot) to complain mode on the development host,
keeping compose templates clean and prod-like.

https://chatgpt.com/share/697cfbdf-e2a8-800f-bf06-b75e8c9d926e
2026-01-30 21:48:43 +01:00
kevinveenbirkenbach 45217e255d mailu: disable AppArmor for imap (dovecot) container
Ensure the Mailu imap (dovecot) service runs with
`apparmor=unconfined` to prevent AppArmor DENIED errors
when accessing TLS certificates and runtime files.

https://chatgpt.com/share/697cfbdf-e2a8-800f-bf06-b75e8c9d926e
2026-01-30 19:43:33 +01:00
kevinveenbirkenbach 2e7e31ba05 refactor: rename infinito-compose to compose-base and fix wrapper usage in cert deploy
- Rename infinito-compose wrapper to compose-base across roles and tests
- Introduce DOCKER_CMD_BASE as global base command configuration
- Update sys-ctl-mtn-cert-deploy to use compose_cmd consistently
- Fix compose wrapper argument parsing by enforcing "--" passthrough
- Harden project name resolution for trailing-slash instance paths
- Align docker restart helper scripts with compose-base naming
- Update unit tests to reflect renamed wrapper and new paths

https://chatgpt.com/share/697cf057-bd04-800f-9117-c007088f7fb8
2026-01-30 18:54:22 +01:00
kevinveenbirkenbach 6e24c12ca1 Unarmed mailu webmail 2026-01-30 18:49:29 +01:00
kevinveenbirkenbach e7e8cf8c03 sys-ca-selfsigned: add env-based CA trust fallback for unprivileged containers
Provide SSL_CERT_FILE / REQUESTS_CA_BUNDLE / CURL_CA_BUNDLE as a fallback
when OS-level CA installation is not possible (e.g. non-root containers).
OS trust store installation is now best-effort and no longer hard-fails,
making with-ca-trust usable across mixed privilege Docker images.

https://chatgpt.com/share/697ceee0-4e48-800f-b4ed-d240fcb0968a
2026-01-30 18:47:41 +01:00
kevinveenbirkenbach 0dcf16a40b Enabled instant flush for cert mount 2026-01-30 18:02:41 +01:00
kevinveenbirkenbach 39048fff47 Added new line 2026-01-30 18:02:05 +01:00
kevinveenbirkenbach 9db0ec50a7 Enabled external domain when DiD and TLS enabled 2026-01-30 18:00:24 +01:00
kevinveenbirkenbach c9323765f0 Deactivated hsotname install DiD 2026-01-30 17:59:38 +01:00
kevinveenbirkenbach 31bdf92009 ci(tls): disable AppArmor for CI containers to avoid host profile denials
AppArmor is explicitly set to `unconfined` for CI-related containers to
prevent host-level AppArmor profiles (e.g. php-fpm, dovecot, nginx) from
interfering with certificate and TLS path handling during CI runs.

This change is limited to CI use cases and does not alter production
security defaults.

https://chatgpt.com/share/697ce139-ca9c-800f-a240-a920b9ce31a8
2026-01-30 17:49:51 +01:00
kevinveenbirkenbach c4258819e4 sys-hostname: ensure hostname package is installed
Install distro-appropriate hostname tooling (inetutils on Arch,
hostname elsewhere) instead of only defining it as a fact.

https://chatgpt.com/share/697cbe16-b8b0-800f-8b5b-0d9c2fdb6ac8
2026-01-30 15:19:56 +01:00
kevinveenbirkenbach 16023dbc9b refactor(cert-deploy): make cert deploy script TLS-source agnostic
- Remove cert_folder_find module (no longer needed)
- Update deploy script to accept a cert source directory (not LETSENCRYPT_LIVE_PATH)
- Derive cert source dir via cert_plan in systemd unit
- Keep Mailu key.pem/cert.pem mapping with LE/selfsigned fallback
- Minor shell hardening (set -eu) and wording fixes

https://chatgpt.com/share/697cb143-e68c-800f-9823-c78a8d833d4e
2026-01-30 14:25:19 +01:00
kevinveenbirkenbach 1b4bbb24a2 sys-ca-selfsigned: make with-ca-trust best-effort and non-fatal
- Do not fail if no CA trust mechanism is available
- Log INFO instead of exiting with error in minimal environments
- Always exec wrapped command when provided
- Exit successfully in standalone (host install) mode
- Simplify trust detection logs and Arch/p11-kit handling

https://chatgpt.com/share/697ca66a-8310-800f-94fd-c0130e05e704
2026-01-30 13:39:02 +01:00
kevinveenbirkenbach a1c25aa0bf refactor(sys-front-tls-selfsigned): move leaf cert generation into conditional include
Extract self-signed leaf certificate generation into a separate task file and
replace block-level when with a guarded include_tasks call.

This avoids parsing heavy tasks when the condition is false and fixes the
integration test enforcing a maximum number of tasks in blocks with block-level
conditions.

https://chatgpt.com/share/697ca16e-6df8-800f-9cf2-424545679d83
2026-01-30 13:17:44 +01:00
kevinveenbirkenbach 30e8b09e84 fix(tls): switch from self-signed leaf certs to CA-signed chain and make CA trust installation deterministic
https://chatgpt.com/share/697ca08d-bb54-800f-a6fc-56cd8e1d75c8
2026-01-30 13:13:44 +01:00
kevinveenbirkenbach 2678090934 feat(ca-trust): unify trust injection + strict templating
Move `with-ca-trust.sh` to `sys-ca-selfsigned` as the single source of truth, add `CA_TRUST_NAME`/`trust_name`, and pass it through `compose_ca_inject.py` + `compose_ca_inject_cmd`. Introduce `module_utils/templating.py` for strict multi-pass rendering with fallback env lookup, update TLS self-signed regen logic, purge script, and extend unit tests accordingly.

https://chatgpt.com/share/697c876d-7140-800f-9981-762dfeeafdfe
2026-01-30 11:26:46 +01:00
kevinveenbirkenbach aedce7a9cd feat(tls): make global self-signed SANs strictly driven by CURRENT_PLAY_DOMAINS_ALL
cert_plan now requires CURRENT_PLAY_DOMAINS_ALL to be a non-empty list of strings when TLS_SELFSIGNED_SCOPE=global and uses it directly for SAN generation. Update unit tests to cover the strict contract and validation errors.

https://chatgpt.com/share/697bc866-0558-800f-8f2c-08ec84190a68
2026-01-29 21:51:23 +01:00
kevinveenbirkenbach fb53387384 feat(docker-compose-ca): inject CA trust for all compose services incl. profile-only ones
compose_ca_inject now discovers profiles from compose files, merges services from default + each profile config, and ensures missing images are built/pulled before inspecting entrypoint/cmd. Tests were updated to cover entrypoint normalization and the new profile-scan behavior.
2026-01-29 20:37:18 +01:00
kevinveenbirkenbach 06b9ccdc8e test(integration): require image tag for buildable docker-compose templates
Adds an integration test that fails when a service defines `build:` without an `image:` on the same indentation level. This enforces stable image names for tooling like CA-injection and makes compose behavior more predictable.

https://chatgpt.com/share/697bb4af-0d58-800f-8edd-aaef4c224319
2026-01-29 20:27:32 +01:00
kevinveenbirkenbach e9a6a952c5 refactor(compose): move compose_f_args lookup to top-level and update usages
- Relocate compose_f_args lookup plugin to lookup_plugins/
- Update docker compose commands to use canonical -f argument resolver
- Fix unit test import path after lookup relocation

https://chatgpt.com/share/697ba25e-b038-800f-9419-84cd575c8c0a
2026-01-29 19:09:23 +01:00
kevinveenbirkenbach b97cbef03f refactor(compose): derive project from application_id and unify compose -f resolution
Remove project kwarg from compose_ca_inject_cmd, derive entity name internally,
and reuse compose_f_args with include_ca=false for bootstrap consistency.
Add include_ca flag to compose_f_args and update unit tests accordingly.

https://chatgpt.com/share/697b9d97-0cf0-800f-805d-7e8308b6f832
2026-01-29 18:48:53 +01:00
kevinveenbirkenbach 4a5736615f Solved falsy file paths 2026-01-29 17:43:22 +01:00
kevinveenbirkenbach 8bff1b984d refactor(jinja): add strict recursive renderer and use in tls/compose lookups
Introduce module_utils/jinja_strict.py to render nested Jinja-in-vars with hard-fail semantics. Refactor cert_plan, compose_f_args, and compose_ca_inject_cmd to use render_strict so no "{{ ... }}" leaks into generated paths/commands, and add unit tests.

https://chatgpt.com/share/697b8e1b-54fc-800f-b895-7161f00ebd51
2026-01-29 17:42:28 +01:00
kevinveenbirkenbach 39638d5725 Optimized selfsigned dependency loading 2026-01-29 17:40:08 +01:00
kevinveenbirkenbach b2fb72d112 feat(tls): split TLS settings to 02_tls and add self-signed root CA role
Move TLS/ACME/CA vars out of 00_general into group_vars/all/02_tls.yml and renumber subsequent group_vars files. Add sys-ca-selfsigned to generate /etc/<software>/ca/root-ca.crt and make docker-compose-ca depend on it. Update setup script, templates, and tests to use the new applications/users file numbering.

https://chatgpt.com/share/697b8150-22ac-800f-98b1-e063a659b684
2026-01-29 16:48:03 +01:00
kevinveenbirkenbach 98704098c2 fix(listmonk): restart service after initial database install
https://chatgpt.com/share/697b75d4-74e0-800f-9670-32b8a994eb9f
2026-01-29 15:59:25 +01:00
kevinveenbirkenbach a354578844 feat(tls): expand Jinja paths inside cert_plan lookup
cert_plan now strictly renders Jinja-containing path variables (e.g. TLS_SELFSIGNED_BASE_PATH / LETSENCRYPT_LIVE_PATH) using hostvars context and fails fast if markers remain. Add unit tests covering successful expansion, hostvars precedence, and hard-fail behavior when variables are missing or Jinja leaks through. Include SOFTWARE_NAME in constructor debug output for easier runtime inspection.

https://chatgpt.com/share/697b73c6-f5f8-800f-96cc-e360a137e7a7
2026-01-29 15:50:32 +01:00
kevinveenbirkenbach 9f849c75f6 Enabled OIDC to program against final TLS tests 2026-01-29 15:42:44 +01:00
kevinveenbirkenbach b9bb4a95fd Included other helper command 2026-01-29 14:41:17 +01:00
kevinveenbirkenbach 8b9977559a **fix(tls-selfsigned): generate cert via argv to avoid Jinja arg splitting**
Switch OpenSSL invocation to `command.argv` so templated paths are passed atomically.
Prevents unrendered Jinja tokens from being split into extra OpenSSL options during cert generation.

https://chatgpt.com/share/697b5598-b0cc-800f-bdf7-f2e58820608d
2026-01-29 13:41:27 +01:00
kevinveenbirkenbach 84439b9329 feat(sys-service-runner): add best-effort Docker diagnostics on service failure
Run optional Docker diagnostics when final systemd service startup fails.
Diagnostics are script-based, safe if Docker is missing, and configurable via role defaults.

https://chatgpt.com/share/697b3dd6-e00c-800f-b63b-02c2e773c624
2026-01-29 12:00:57 +01:00
kevinveenbirkenbach ecb0d6071c On Local deploy reduce repeat times for failed systemctl runenrs to debug faster 2026-01-29 11:26:59 +01:00
kevinveenbirkenbach 70945ae1b8 Optimized todos 2026-01-29 11:25:35 +01:00
kevinveenbirkenbach 1377150bf6 Added missing docker dependency 2026-01-29 10:01:09 +01:00
kevinveenbirkenbach 5c163900c1 test(matrix): exclude web-opt-rdr-www from universal tests
https://chatgpt.com/share/697a7c6e-a674-800f-9ace-27cc49399d87
2026-01-28 22:15:19 +01:00