Let's imagine a service that uses the combination of localpart and domain as identifiers (e.g., user@example.com
), similar to XMPP, email, and Matrix. An organization wants to use its own domain (example.com
) for user identities, but delegate the actual hosting to a third-party provider.
Traditionally, this delegation is done using SRV records, such as:
_xmpp-client._tcp.example.com. ...
_xmpp-server._tcp.example.com. ...
_matrix._tcp.example.org. ...
However, this approach lacks a secure mechanism to link the identity domain (example.com
) with the hosting provider’s infrastructure. Since DNS is not secure by default, an attacker could manipulate SRV record responses and perform a man-in-the-middle (MITM) attack, redirecting users to a malicious server.
Obtaining certificates for each customer domain is often not practical for hosting providers. It would typically require either access to the customer's web server (to place validation files) or control over their DNS (to insert validation records) -- neither of which is feasible or scalable.
This problem has been considered before. One proposed solution is described in RFC 7711, which involves placing a file in the .well-known
directory of the domain to indicate delegation. Matrix, for example, supports delegation through either SRV records or files placed under .well-known
. While this method can be secure against MITM attacks, it has notable drawbacks: any vulnerability in the domain’s web server (e.g., via a compromised CMS) could allow an attacker to modify the .well-known
file and silently redirect clients to a malicious server—intercepting credentials and communication.
At present, there appears to be no widely adopted, secure, and practical solution to this delegation problem that doesn't introduce new risks or infrastructure complexity.
Proposed Idea: Service-Specific Certificates
One possible solution could be the introduction of a new type of certificate—restricted to a specific service (e.g., XMPP, Matrix, etc.). This certificate would include a dedicated field indicating the service it is intended for.
Validation would work the following way:
- The client first resolves the SRV record for the service, retrieving the target domain of the hosting provider.
- The client then connects to the hosting provider's server and verifies that the presented certificate is valid and includes a trusted delegation assertion for the original domain and service.
This would leverage the existing certificate infrastructure, while allowing secure, service-specific delegation without needing control over the customer's web server or DNS.