Repository navigation
Mail relay: links to an install's own domain once CoderHelm proves it over HTTPS - #325
Merged
Merged
Conversation
… over HTTPS An install on its own custom domain can now send email through CoderHelm with links to that domain. The relay accepts the domain only after it reaches the install there over HTTPS (DNS and certificate working) and gets the install's signed proof back, the same proof as for its CloudFront address. The proof counts for a week. The install asks again by itself when the relay refuses a link. An unverified, stale or look-alike domain is still refused.
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
Emails sent through CoderHelm's mail relay can now link to a self-hosted install's own custom domain, once that domain is proved. Until now, links could only go to the install's CloudFront address or its CoderHelm name, so installs on their own domain had to use SES. Follow-up to #315.
Changes
POST /hybrid/email/domain(signed, verified, non-revoked install, rate limited): the install names its domain. The relay fetcheshttps://<domain>/webhooks/relay/proofwith the no-redirect, size-capped install client and checks the install's signed proof. That succeeds only when DNS points at the install and its certificate is valid. The relay records the hostname andverified_atunder the install (EMAILDOMAIN) and writes an audit line.relay::link_hosts: links may point at the CloudFront address, the CoderHelm name, and the custom domain only while its proof is under 7 days old.relay::custom_domain_okrefuses CoderHelm's zone, AWS addresses, IPs and malformed names.common::mail): when the relay refuses a link (link_not_own_host) and the install's address is its own domain, the install asks the relay to prove the domain, then retries once. It never falls back to SES.email.md,hybrid.mdthreat model) updated.Verification
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(2225 pass, includingno_hosted_urls).an_unverified_custom_domain_link_is_still_refused: unverified, refused; verified, allowed; another domain, still refused.a_custom_domain_counts_only_while_its_proof_is_recent: stale and future-dated proofs don't count.only_a_real_domain_outside_aws_and_coderhelm_can_be_asked_for.