fix(link): the app believes only public authorities, only their hosts, and only while a certificate lasts
The review of P15 B3 found the relay could steer three things it must not. - A certificate is now checked against the public roots the program ships, for the app's wildcard, when it is issued and every time it is read from disk; a lifetime over 100 days is refused (no public authority issues one), and the renewal is planned no later than two thirds of the life or 60 days. A kept certificate that fails is ignored and ordered again. Only a test builds a CertTrust of its own roots. - The ACME client sends a request only to a directory on a host compiled into the app (Let's Encrypt production and staging, Google Trust Services, ZeroSSL, Buypass, SSL.com): the relay still picks which and in what order, but cannot name a new host. A kept account is used only if its directory is on the list too. http is a direct dependency now (it was a dev-dependency, and already in the tree): the host is read with the parser the ACME library uses. - The resolver refuses a certificate at its end, sleeps stop at it, and the state stops saying "Connected" when it has ended. - The certificate work waits for the line, so it is for the name the relay accepted (a first claim that finds the name taken picks another); web.rs starts the door only once the name is settled. - A line that held under 60 s does not reset the backoff; one that held is redialled after 0 to 30 s, so a relay restart is not met by every app in the same second. - What the relay and the authority say is shown as a short quoted detail with control and invisible characters removed, in the app's own words. - The kept address is read once, not from the key file every frame; the folder is synced after a private file is renamed into place. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
14c1a26bfc
commit
b90df7158a
12 files changed
+1440
-128
No files matched your search
@@ -40,7 +40,7 @@ use common::{BOOK, Home, clean_env};
|
||||
use futures::future::BoxFuture;
|
||||
use ledger_host::app_server::AppServer;
|
||||
use ledger_host::web::{Admin, WebAssistants};
|
||||
use ledger_link::{Dial, Issued, Issuer, LinkConfig, OrderRequest, Step, Timing};
|
||||
use ledger_link::{CertTrust, Dial, Issued, Issuer, LinkConfig, OrderRequest, Step, Timing};
|
||||
use ledger_mcp::admin::{Request, Response};
|
||||
use rcgen::{CertificateParams, CertifiedIssuer, IsCa, KeyPair, KeyUsagePurpose};
|
||||
use relay::proto::Authority;
|
||||
@@ -152,6 +152,7 @@ fn start_server(home: &Home) -> AppServer {
|
||||
|
||||
fn web_for(home: &Home, env: &relay_common::Env, ca: &Arc<Authority_>) -> WebAssistants {
|
||||
let (relay_tls, router, issuer) = (env.line_tls(), env.router(), ca.clone());
|
||||
let roots = ca.roots();
|
||||
WebAssistants::with_maker(
|
||||
Some(home.root()),
|
||||
Box::new(move |dir| {
|
||||
@@ -162,6 +163,7 @@ fn web_for(home: &Home, env: &relay_common::Env, ca: &Arc<Authority_>) -> WebAss
|
||||
dial: Dial::Addr(router),
|
||||
relay_tls: relay_tls.clone(),
|
||||
issuer: issuer.clone(),
|
||||
trust: CertTrust::for_tests(roots.clone()),
|
||||
timing: Timing {
|
||||
ping_every: Duration::from_millis(500),
|
||||
backoff_min: Duration::from_millis(50),
|
||||
|
||||
Reference in new issue
Block a user