Implement account deactivate command

Deactivates the ACME account on the server and removes local
credential files so subsequent commands don't use the stale account.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roman Kivalin
2026-04-14 17:29:27 +02:00
co-authored by Claude Opus 4.6
parent 9a09ec5bab
commit d70c7eec05
3 changed files with 25 additions and 1 deletions
+1
View File
@@ -8,6 +8,7 @@
- Multiple listen addresses for HTTP-01 and TLS-ALPN-01 solvers (`listen = ["[::]:80", "[::]:8080"]`). Certforge tries all addresses and succeeds if at least one binds. Useful for initial provisioning when a proxy isn't running yet.
- `dane-check` now queries published TLSA records from DNS and verifies them against expected values. Exits with code 1 if any records are missing or mismatched.
- Configurable DNS propagation delay per solver (`propagation_delay`, default 5s).
- Implement `account deactivate` command.
### Fixes
+5
View File
@@ -254,4 +254,9 @@ impl AcmeClient {
pub fn account(&self) -> &Account {
&self.account
}
pub async fn deactivate(self) -> Result<()> {
self.account.deactivate().await?;
Ok(())
}
}
+19 -1
View File
@@ -90,7 +90,25 @@ async fn main() -> anyhow::Result<()> {
println!("Account ID: {}", client.account().id());
}
AccountAction::Deactivate => {
tracing::warn!("account deactivation not yet implemented");
let client = acme::AcmeClient::load(&config.acme).await?;
let id = client.account().id().to_string();
client.deactivate().await?;
// Remove local credentials so show/renew don't use the stale account
if let Some(path) = &config.acme.account_key_credential
&& path.exists()
{
std::fs::remove_file(path)?;
tracing::info!(path = %path.display(), "removed account credential");
}
if let Some(path) = &config.acme.account_key_path
&& path.exists()
{
std::fs::remove_file(path)?;
tracing::info!(path = %path.display(), "removed account key file");
}
println!("Account {id} deactivated");
}
}
}