Repository navigation
feat(tls): keep a trusted CA, accept your own, and warn when a client rejects the certificate - #662
Merged
Merged
Conversation
A client that does not trust floci-az's self-signed CA fails with a bare x509 error that names neither floci-az nor the fix. The startup banner now says whether TLS is on and, for the generated certificate, where the CA is served and where the trust steps are. The Terraform guide gains trust commands for macOS, Linux and Windows (on macOS the provider ignores SSL_CERT_FILE and reads only the Keychain), says when the CA is regenerated, documents the data-plane hostnames and ports Key Vault and Storage resources call, and adds a recipe for running Terraform in a container that trusts the CA. The SSL_CERT_FILE advice now asks for a bundle that keeps the public roots, which terraform init needs. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
[High impact] The latest changes appear safe to merge; no new blocking issue was established.
|
hectorvent
force-pushed
the
feat/tls-handshake-warn
branch
from
November 15, 2026 01:40
0429f6d to
d9ab322
Compare
hectorvent
force-pushed
the
feat/tls-handshake-warn
branch
from
November 15, 2026 02:58
d9ab322 to
8eb5f4f
Compare
Clients trust floci-az's self-signed CA, but the CA was regenerated with every server certificate, so a hostname change or a renewal forced every client to trust a new one. The server certificate was also never renewed: the reuse check compared hostnames only, so a year-old certificate kept being served after it expired. floci-az now always keeps the CA key (owner-only) and issues new server certificates from the existing CA, renewing them 30 days before expiry. The CA carries critical name constraints, so the key can only sign names floci-az serves: localhost, floci-az.io, the public cloud's Key Vault, Managed HSM and ACR suffixes, every cloud's Redis suffix the cloud catalog records, host.docker.internal, loopback and private IP ranges, any custom hostnames and the Docker daemon host. The suffixes come from the cloud catalog. Go, OpenSSL, Apple's Security framework and Node all enforce the constraints. The CA is replaced, with a WARN telling clients to trust it again, when it cannot issue the next certificate (its key is missing or does not match, it has no constraints, a new name falls outside them, or it would expire first), or when its constraints still cover a name floci-az no longer serves, such as a removed hostname or FLOCI_AZ_TLS_PUBLIC_HOSTS turned off, so a trusted CA never vouches for more than floci-az answers for. A CA written by an older floci-az, which kept no key, is served unchanged until the server certificate has to be reissued. Redis certificates now name the cache's Azure host name in its own cloud (<cache>.redis.cache.windows.net, or .redis.cache.usgovcloudapi.net in AzureUSGovernment) instead of the container name, and the cache container answers to that name through a Docker network alias. Cache names are unique per cloud, so two clouds' caches of one name never share an alias, and a resource namespace goes between the name and the suffix, so two emulator instances on one network never do either. On a user-defined network the cache's hostName changes to that name; on the default bridge, and in a cloud whose Redis suffix the catalog does not record, it stays the container name, and the certificate there names only the loopback hosts, since the container name falls outside the CA's constraints. Aliases are only sent on user-defined networks, since the daemon refuses them on built-in ones, and a container created on the default bridge to publish host ports gets them when it joins its network after start. The native image registers the docker-java request types that carry them. The python Redis suite gains a test that trusts only the CA from /_floci/tls-cert and verifies the chain and the returned hostName under strict X.509 checks, and its compat leg now serves Redis TLS so the test runs in CI. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Clients that already trust a local development CA (mkcert's root, a team CA) had to trust floci-az's generated CA as well. With FLOCI_AZ_TLS_CA_CERT_PATH and FLOCI_AZ_TLS_CA_KEY_PATH set, floci-az issues its server certificate from that CA at every start, Redis caches with TLS get theirs from it too, and GET /_floci/tls-cert serves it. The CA's key is only read, never copied, and no name constraints are added to a CA that is the user's. FLOCI_AZ_TLS_CERT_PATH and FLOCI_AZ_TLS_KEY_PATH still take precedence. A CA that cannot issue a certificate clients accept fails startup with what to fix: only one of the two paths set, a missing file, a key that is not the certificate's, a certificate that is not a CA, or an expired CA. Names a user CA's own constraints exclude are logged as a WARN. To accept the CAs people actually have, certificate issuance signs with the CA key's algorithm (RSA, EC or Ed25519) instead of always RSA, the key check is a sign/verify probe instead of an RSA modulus compare, a server certificate never outlives its CA, and a SEC1 EC key that omits its optional public key is read. The startup banner names the CA, and docs/terraform.md gains a mkcert section. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
A client that does not trust floci-az's CA fails with an error that names neither floci-az nor the fix (azurerm: "x509: certificate signed by unknown authority"), and floci-az logged nothing: Quarkus terminates TLS and reports a failed handshake nowhere, not even at DEBUG. The TLS proxy already relays every byte, so it now reads the opening records of each TLS connection and logs a WARN, at most once a minute per client address, naming the client, the reason and where to get the CA. Two shapes cover the clients tested (Python, openssl, curl, Go, Java): - a plaintext certificate alert (bad_certificate, unknown_ca, certificate_expired, ...) before any application data, which carries the reason; - under TLS 1.3, as the server's ServerHello announces, a first encrypted client record too short to be a Finished, which can only be an alert. TLS 1.3 hides which one. Inspection stops at the first application data record, at any alert, or after 32 KB, and the pipes themselves are unchanged. Trusting clients on TLS 1.2 and 1.3 are not reported. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
hectorvent
force-pushed
the
feat/tls-handshake-warn
branch
from
November 15, 2026 03:20
8eb5f4f to
ee7a554
Compare
Member
Author
|
@greptileai review |
Member
Author
|
🎉 This PR is included in version 0.17.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
McFizh
pushed a commit
to McFizh/floci-az
that referenced
this pull request
Nov 16, 2026
# [0.17.0](floci-io/floci-az@0.16.0...0.17.0) (2026-11-15) ### Bug Fixes * **aci:** report a failed container group action on the POST ([floci-io#623](floci-io#623)) ([b9ab61c](floci-io@b9ab61c)) * **apim:** keep child resources in the storage layer, keyed case-insensitively ([floci-io#651](floci-io#651)) ([d70496f](floci-io@d70496f)) * **blob:** answer Append Block with Last-Modified and x-ms-request-server-encrypted ([floci-io#631](floci-io#631)) ([f440fce](floci-io@f440fce)), closes [floci-io#587](floci-io#587) * **blob:** apply SAS response-header overrides on read ([floci-io#629](floci-io#629)) ([04ec99e](floci-io@04ec99e)) * **containerapps:** drop an empty keyVaultUrl from a plain secret ([floci-io#649](floci-io#649)) ([68a9e13](floci-io@68a9e13)), closes [floci-io#576](floci-io#576) * **containerapps:** report a managed environment's customDomainVerificationId ([floci-io#630](floci-io#630)) ([6b2b76f](floci-io@6b2b76f)), closes [floci-io#573](floci-io#573) * **deployments:** list a nested deployment's resources in its parent ([floci-io#636](floci-io#636)) ([87c08bd](floci-io@87c08bd)) * **deployments:** read a parameter with a null reference as a plain value ([floci-io#635](floci-io#635)) ([e29d909](floci-io@e29d909)) * **eventgrid:** refuse a destination type floci-az cannot deliver to ([floci-io#622](floci-io#622)) ([aec34bd](floci-io@aec34bd)) * **eventhub:** skip discarded journal disk tuning ([floci-io#614](floci-io#614)) ([284f3fc](floci-io@284f3fc)), closes [floci-io#606](floci-io#606) * **keyvault:** serve deleted vaults so terraform destroy can purge ([floci-io#634](floci-io#634)) ([f90d590](floci-io@f90d590)), closes [floci-io#624](floci-io#624) * **keyvault:** store a vault's properties and support PATCH ([floci-io#624](floci-io#624)) ([9b8b44f](floci-io@9b8b44f)) * **monitor:** answer the deleted workspaces list ([floci-io#625](floci-io#625)) ([b60d698](floci-io@b60d698)) * **monitor:** keep the tags of workspaces and data collection endpoints and rules ([floci-io#660](floci-io#660)) ([df23147](floci-io@df23147)), closes [floci-io#659](floci-io#659) * **queue:** accept Update Message without a body (visibility-only update) ([floci-io#621](floci-io#621)) ([c3215c8](floci-io@c3215c8)), closes [floci-io#620](floci-io#620) * **queue:** return messages in the order they were sent ([floci-io#647](floci-io#647)) ([37b0f46](floci-io@37b0f46)) * **servicebus,eventhub:** wait for Artemis to answer AMQP before reporting a namespace ready ([floci-io#615](floci-io#615)) ([6fa9511](floci-io@6fa9511)) * **servicebus:** balance source accounting after explicit dead-letter ([floci-io#648](floci-io#648)) ([16f5f74](floci-io@16f5f74)) * **servicebus:** bound TCP connect by the readiness deadline ([floci-io#604](floci-io#604)) ([b06f481](floci-io@b06f481)), closes [floci-io#603](floci-io#603) * **servicebus:** count deliveries after session lock expiry ([floci-io#645](floci-io#645)) ([ff31e3d](floci-io@ff31e3d)) * **servicebus:** restore stored entities when a broker starts ([floci-io#643](floci-io#643)) ([0d8dbab](floci-io@0d8dbab)), closes [floci-io#642](floci-io#642) * **servicebus:** skip discarded journal disk tuning ([floci-io#606](floci-io#606)) ([db31031](floci-io@db31031)), closes [floci-io#605](floci-io#605) * **storage:** answer an ARM container GET with the container's stored ETag and Last-Modified ([floci-io#617](floci-io#617)) ([f58abb4](floci-io@f58abb4)) * **storage:** answer an ARM container PUT with the container's stored ETag and Last-Modified ([floci-io#602](floci-io#602)) ([c5bbac8](floci-io@c5bbac8)) * **storage:** return the sku, kind and properties a PUT set ([floci-io#646](floci-io#646)) ([afc79e6](floci-io@afc79e6)), closes [floci-io#571](floci-io#571) * **vm:** preserve request origin in polling URLs ([floci-io#628](floci-io#628)) ([9560864](floci-io@9560864)), closes [floci-io#626](floci-io#626) * **vm:** report each power action's real outcome on its operation status ([floci-io#655](floci-io#655)) ([183f63d](floci-io@183f63d)), closes [floci-io#626](floci-io#626) [floci-io#626](floci-io#626) ### Features * **arm:** refuse a token from another tenant under strict-tokens ([floci-io#619](floci-io#619)) ([fb76ca4](floci-io@fb76ca4)) * **arm:** refuse invalid Bearer tokens under strict-tokens ([floci-io#616](floci-io#616)) ([d6af59c](floci-io@d6af59c)) * **arm:** report each public region's physicalLocation ([floci-io#653](floci-io#653)) ([874b552](floci-io@874b552)) * **authorization:** serve role definitions and store role assignments ([floci-io#656](floci-io#656)) ([003a53c](floci-io@003a53c)), closes [floci-io#567](floci-io#567) * **blob:** serve Set Blob Properties ([floci-io#654](floci-io#654)) ([d09366d](floci-io@d09366d)) * **deployments:** resolve Key Vault parameter references ([floci-io#641](floci-io#641)) ([3bcb475](floci-io@3bcb475)), closes [floci-io#635](floci-io#635) [floci-io#635](floci-io#635) * **deployments:** serve deployments at management-group scope ([floci-io#640](floci-io#640)) ([0fe757d](floci-io@0fe757d)) * **deployments:** serve symbolic resource names (languageVersion 2.0) ([floci-io#637](floci-io#637)) ([17f00a3](floci-io@17f00a3)) * **deployments:** serve the CIDR functions and deployer ([floci-io#639](floci-io#639)) ([7fd4ade](floci-io@7fd4ade)) * **deployments:** serve the lambda functions and flatten ([floci-io#638](floci-io#638)) ([cddc4e0](floci-io@cddc4e0)) * **entra:** validate directory passwords and issue ROPC refresh tokens ([floci-io#633](floci-io#633)) ([9b2a464](floci-io@9b2a464)), closes [floci-io#632](floci-io#632) * **tls:** answer for Azure's public hosts behind an opt-in setting ([floci-io#650](floci-io#650)) ([457de34](floci-io@457de34)) * **tls:** keep a trusted CA, accept your own, and warn when a client rejects the certificate ([floci-io#662](floci-io#662)) ([bac63e9](floci-io@bac63e9))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four commits that make floci-az's TLS something a client can trust once and keep trusting, and that say what went wrong when it does not. They are kept separate for review; each builds on the one before.
FLOCI_AZ_TLS_PUBLIC_HOSTSturned off). Redis certificates now name the cache's Azure host name in its own cloud (<cache>.redis.cache.windows.net, or.redis.cache.usgovcloudapi.netinAzureUSGovernment), and the cache container answers to that name through a Docker network alias on user-defined networks (with a resource namespace,<cache>.<namespace>.redis.cache.windows.net, so two emulator instances on one network never share a name). The python compat leg now serves Redis TLS, so its certificate tests run in CI.FLOCI_AZ_TLS_CA_CERT_PATHandFLOCI_AZ_TLS_CA_KEY_PATH, floci-az issues its certificates (and the Redis ones) from a CA such as mkcert's root, which clients already trust. The key is only read, never copied. Misconfiguration fails startup with what to fix. Issuance signs with the CA key's own algorithm (RSA, EC or Ed25519).Type of change
fix:)feat:)feat!:orfix!:)Azure Compatibility
No Azure wire protocol changes: this is floci-az's own certificate handling. One observable change: on a user-defined Docker network, a Redis cache's
hostNameis now its Azure host name in its cloud (the name its certificate carries) instead of the container name; on the default bridge, and in a cloud whose Redis suffix the cloud catalog does not record, it stays the container name. The new python Redis test trusts only the CA from/_floci/tls-certand checks the chain and the returnedhostNameunder strict X.509 verification. The name constraints are enforced by Go, OpenSSL, Apple's Security framework and Node.Checklist
./mvnw testpasses locally