This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 17:36:53 +01:00
1 parent 5b6d4a7903
commit 4d1087e357
160 files changed
+2407 -1933

No files matched your search

-28
View File
@@ -166,19 +166,11 @@ enum TlsCommand {
key: PathBuf,
},
Reload,
/// Check or force renewal of ACME certificates.
///
/// Panel mode: one managed certificate (`--id`) through the administration
/// API. Headless mode: the running service's ACME certificates (all, or
/// those matching `--id` by certificate id or domain name).
Renew {
/// Certificate id; in headless mode also a domain name (repeatable)
#[arg(long = "id", value_delimiter = ',')]
ids: Vec<String>,
/// Request a new certificate even if it is not due yet (counts against CA rate limits)
#[arg(long, conflicts_with = "dry_run")]
force: bool,
/// Panel mode only: validate the renewal without deploying it
#[arg(long)]
dry_run: bool,
},
@@ -217,60 +209,43 @@ struct ServeOptions {
headless_tls: Box<HeadlessTlsArgs>,
}
/// Headless-only TLS sources: certificate files and automatic ACME (DV) certificates.
#[derive(Args, Clone, Default)]
struct HeadlessTlsArgs {
/// Certificate chain (PEM) to serve; pair each with --tls-key-file (headless only, repeatable)
#[arg(long = "tls-cert-file", env = "RUST_PROXY_TLS_CERT_FILE", value_delimiter = ',', value_name = "PEM")]
tls_cert_file: Vec<PathBuf>,
/// Private key (PEM) for the --tls-cert-file at the same position
#[arg(long = "tls-key-file", env = "RUST_PROXY_TLS_KEY_FILE", value_delimiter = ',', value_name = "PEM")]
tls_key_file: Vec<PathBuf>,
/// Directory with certificate/key pairs, e.g. /etc/letsencrypt/live (headless only, repeatable)
#[arg(long = "tls-cert-dir", env = "RUST_PROXY_TLS_CERT_DIR", value_delimiter = ',', value_name = "DIR")]
tls_cert_dir: Vec<PathBuf>,
/// Names of one ACME certificate, comma-separated (repeat for more certificates; ';' in the environment)
#[arg(long = "acme-domains", env = "RUST_PROXY_ACME_DOMAINS", value_delimiter = ';', value_name = "NAMES")]
acme_domains: Vec<String>,
/// Contact e-mail for the ACME account
#[arg(long = "acme-email", env = "RUST_PROXY_ACME_EMAIL")]
acme_email: Option<String>,
/// Accept the ACME CA terms of service (Let's Encrypt Subscriber Agreement)
#[arg(long = "acme-agree-tos", env = "RUST_PROXY_ACME_AGREE_TOS", action = clap::ArgAction::SetTrue,
value_parser = clap::builder::BoolishValueParser::new())]
acme_agree_tos: bool,
/// Use the Let's Encrypt staging CA (untrusted test certificates, high rate limits)
#[arg(long = "acme-staging", env = "RUST_PROXY_ACME_STAGING", action = clap::ArgAction::SetTrue,
value_parser = clap::builder::BoolishValueParser::new())]
acme_staging: bool,
/// Challenge: http01 (default) or DNS-01 via cloudflare, ovh, rfc2136 (required for wildcards)
#[arg(long = "acme-provider", env = "RUST_PROXY_ACME_PROVIDER",
value_parser = ["http01", "cloudflare", "ovh", "rfc2136"])]
acme_provider: Option<String>,
/// Certbot-style INI file with DNS provider credentials (mode 0600)
#[arg(long = "acme-dns-credentials", env = "RUST_PROXY_ACME_DNS_CREDENTIALS", value_name = "INI")]
acme_dns_credentials: Option<PathBuf>,
/// DNS-01 propagation wait in seconds [default: 60]
#[arg(long = "acme-propagation-seconds", env = "RUST_PROXY_ACME_PROPAGATION_SECONDS",
value_parser = clap::value_parser!(u64).range(10..=900))]
acme_propagation_seconds: Option<u64>,
/// Renew when this many days or fewer remain [default: 30]
#[arg(long = "acme-renew-days", env = "RUST_PROXY_ACME_RENEW_DAYS",
value_parser = clap::value_parser!(u64).range(1..=60))]
acme_renew_days: Option<u64>,
/// Also issue certificates for every vhost host that no other certificate covers
#[arg(long = "acme-auto", env = "RUST_PROXY_ACME_AUTO", action = clap::ArgAction::SetTrue,
value_parser = clap::builder::BoolishValueParser::new())]
acme_auto: bool,
/// Vhost without a configuration file: HOSTS=URLS, e.g. app.example.com=http://127.0.0.1:3000
/// (repeatable; ';' between routes in the environment)
#[arg(long = "route", env = "RUST_PROXY_ROUTES", value_delimiter = ';', value_name = "HOSTS=URLS")]
route: Vec<String>,
/// Redirect plain HTTP to HTTPS for --route vhosts (308)
#[arg(long = "force-https", env = "RUST_PROXY_FORCE_HTTPS", action = clap::ArgAction::SetTrue,
value_parser = clap::builder::BoolishValueParser::new())]
force_https: bool,
/// Reload automatically when the configuration or certificate files change
#[arg(long = "watch", env = "RUST_PROXY_WATCH", action = clap::ArgAction::SetTrue,
value_parser = clap::builder::BoolishValueParser::new())]
watch: bool,
@@ -287,9 +262,6 @@ impl HeadlessTlsArgs {
|| self.watch
}
/// Command-line headless options. ACME settings are validated when the
/// configuration is loaded, because they may be completed by the
/// `"headless"` section of the file.
fn resolve(self, headless: bool) -> Result<rust_proxy::runtime::HeadlessOptions> {
if !self.requested() {
return Ok(Default::default());