Skip to content

fix(ssl): mark the self-signed root as a CA and repair existing roots - #513

Merged
mrrobot47 merged 2 commits into
EasyEngine:developfrom
mrrobot47:fix/self-signed-root-ca
Oct 12, 2026
Merged

mrrobot47 merged 2 commits into
EasyEngine:developfrom
mrrobot47:fix/self-signed-root-ca

Conversation

@mrrobot47

Copy link
Copy Markdown
Member

The self-signed root CA was generated from a config without extensions. OpenSSL < 3.2 then issues a v1 root (accepted as a trust anchor), but OpenSSL >= 3.2 (Ubuntu 26.04, Debian 13) issues a v3 root without basicConstraints CA:TRUE, so openssl verify, curl and browsers reject every self-signed site certificate with error 79 (invalid CA certificate).

  • New roots get a critical basicConstraints CA:TRUE, keyUsage keyCertSign, cRLSign and a key identifier; site certificates also get extendedKeyUsage serverAuth.
  • Existing v3 roots without CA:TRUE are re-issued with the same key and subject by a container migration, and again on the next --ssl=self site. Site certificates name their root by key id, so they keep working and are not re-signed; the new root only replaces the old one after every site certificate signed by its key verifies against it. An existing copy in the system trust store is refreshed.
  • v1 roots are left as they are: they work, and their site certificates name the root by issuer and serial number.
  • The openssl commands that take the root key password no longer write it to ee.log.

Users who imported the old root into a browser can keep it (same key); importing the new rootCA.pem replaces it.

Testing: unit tests with the real openssl CLI on OpenSSL 1.1.1, 3.0 and 3.5 (new root, repair, v1 root left alone, a leaf that would stop verifying, migration up/down); the Behat SSL scenario now also verifies strictly.

The root CA config had no extensions. OpenSSL < 3.2 then issues a v1 root, which is accepted as a trust anchor, but OpenSSL >= 3.2 (Ubuntu 26.04, Debian 13) issues a v3 root without basicConstraints CA:TRUE, so `openssl verify`, curl and browsers reject every self-signed site certificate (error 79, invalid CA certificate).

- Issue the root with a critical basicConstraints CA:TRUE, keyUsage keyCertSign/cRLSign and a key identifier; site certificates get extendedKeyUsage serverAuth and a key identifier.
- Existing v3 roots without CA:TRUE are re-issued with the same key and subject, by a container migration and again on the next `--ssl=self` site. Site certificates name their root by key id, so they stay valid and are not re-signed; the new root only replaces the old one after every site certificate signed by its key verifies against it. The system trust store copy is refreshed.
- v1 roots are left alone: they work, their site certificates name the root by issuer and serial number, and replacing them would invalidate the copies users imported into browsers.
…assword out of ee.log

The root CA repair re-trusts the root only where a trusted copy already exists (an admin may have removed it on purpose), and completes a refresh that failed after the root was replaced on the next run. The macOS keychain hint is only printed after an actual repair, the repair's temporary files get per-process names, and the openssl commands that take the root key password no longer write it to ee.log.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repair failures can install unusable certificates, and migration rollback state is not persisted.

2 open findings
What changed in this PR

Fixes self-signed certificate compatibility with newer OpenSSL versions and repairs affected root CAs.

Changes:

  • Adds required CA and server certificate extensions.
  • Repairs existing invalid roots and refreshes system trust.
  • Redacts certificate passwords from command logs.
File Description
v3.ext.mustache Adds leaf certificate identifiers and server authentication usage.
openssl.conf.mustache Defines valid root CA extensions.
Site_Self_Signed.php Implements root repair, verification, trust refresh, and password redaction.
20261001120000_site-command_repair_self_signed_root_ca.php Adds the upgrade migration for existing roots.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/helper/Site_Self_Signed.php
@mrrobot47
mrrobot47 merged commit 22a0a15 into EasyEngine:develop Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants