v1.2.0
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4,7 +4,7 @@ version = 3
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "acme-client"
|
name = "acme-client"
|
||||||
version = "1.1.1"
|
version = "1.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"acme-lib",
|
"acme-lib",
|
||||||
"aliyun-openapi-core-rust-sdk",
|
"aliyun-openapi-core-rust-sdk",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "acme-client"
|
name = "acme-client"
|
||||||
version = "1.1.1"
|
version = "1.2.0"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt"
|
description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt"
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ pub fn request_acme_certificate(acme_request: AcmeRequest, dns_cleaned_domains:
|
|||||||
let mut line = String::new();
|
let mut line = String::new();
|
||||||
information!("You need to config dns manually, press enter to continue...");
|
information!("You need to config dns manually, press enter to continue...");
|
||||||
let _ = std::io::stdin().read_line(&mut line).unwrap();
|
let _ = std::io::stdin().read_line(&mut line).unwrap();
|
||||||
|
information!("Continued")
|
||||||
} else {
|
} else {
|
||||||
return simple_error!("Interact is not allowed, --allow-interact to allow interact");
|
return simple_error!("Interact is not allowed, --allow-interact to allow interact");
|
||||||
}
|
}
|
||||||
|
|||||||
27
src/main.rs
27
src/main.rs
@@ -44,7 +44,6 @@ async fn main() -> tide::Result<()> {
|
|||||||
.author(AUTHORS)
|
.author(AUTHORS)
|
||||||
.arg(Arg::with_name("version").short("V").long("version").help("Print version"))
|
.arg(Arg::with_name("version").short("V").long("version").help("Print version"))
|
||||||
.arg(Arg::with_name("verbose").short("v").long("verbose").help("Verbose"))
|
.arg(Arg::with_name("verbose").short("v").long("verbose").help("Verbose"))
|
||||||
.arg(Arg::with_name("type").short("t").long("type").default_value("http").takes_value(true).help("Type http or dns"))
|
|
||||||
.arg(Arg::with_name("port").short("p").long("port").default_value("80").takes_value(true).help("Http port"))
|
.arg(Arg::with_name("port").short("p").long("port").default_value("80").takes_value(true).help("Http port"))
|
||||||
.arg(Arg::with_name("domain").short("d").long("domain").multiple(true).takes_value(true).help("Domains"))
|
.arg(Arg::with_name("domain").short("d").long("domain").multiple(true).takes_value(true).help("Domains"))
|
||||||
.arg(Arg::with_name("email").long("email").takes_value(true).help("Contract email"))
|
.arg(Arg::with_name("email").long("email").takes_value(true).help("Contract email"))
|
||||||
@@ -59,9 +58,10 @@ async fn main() -> tide::Result<()> {
|
|||||||
.arg(Arg::with_name("hide-logo").long("hide-logo").help("Hide logo"))
|
.arg(Arg::with_name("hide-logo").long("hide-logo").help("Hide logo"))
|
||||||
.arg(Arg::with_name("skip-verify-ip").short("k").long("skip-verify-ip").help("Skip verify public ip"))
|
.arg(Arg::with_name("skip-verify-ip").short("k").long("skip-verify-ip").help("Skip verify public ip"))
|
||||||
.arg(Arg::with_name("skip-verify-certificate").short("K").long("skip-verify-certificate").help("Skip verify certificate"))
|
.arg(Arg::with_name("skip-verify-certificate").short("K").long("skip-verify-certificate").help("Skip verify certificate"))
|
||||||
|
.arg(Arg::with_name("skip-listen").long("skip-listen").help("Skip http challenge listen"))
|
||||||
.arg(Arg::with_name("allow-interact").long("allow-interact").help("Allow interact"))
|
.arg(Arg::with_name("allow-interact").long("allow-interact").help("Allow interact"))
|
||||||
.arg(Arg::with_name("challenge-type").short("T").long("challenge-type").takes_value(true).default_value("http").help("Challenge type, http or dns"))
|
.arg(Arg::with_name("challenge-type").short("t").long("challenge-type").takes_value(true).default_value("http").help("Challenge type, http or dns"))
|
||||||
.arg(Arg::with_name("dns-supplier").short("s").long("dns-supplier").takes_value(true).default_value("account://***:****@**?id=*").help("DNS supplier"))
|
.arg(Arg::with_name("dns-supplier").short("s").long("dns-supplier").takes_value(true).help("DNS supplier, e.g. account://***:****@**?id=*"))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
if matches.is_present("verbose") {
|
if matches.is_present("verbose") {
|
||||||
@@ -127,13 +127,6 @@ async fn main() -> tide::Result<()> {
|
|||||||
email.to_string()
|
email.to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
match matches.value_of("type") {
|
|
||||||
Some("http") => {}
|
|
||||||
_ => {
|
|
||||||
failure!("Type is not assigned or must be http.");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let port: u16 = match matches.value_of("port") {
|
let port: u16 = match matches.value_of("port") {
|
||||||
Some(p) => p.parse().unwrap_or_else(|e| {
|
Some(p) => p.parse().unwrap_or_else(|e| {
|
||||||
failure!("Parse port: {}, failed: {}", p, e);
|
failure!("Parse port: {}, failed: {}", p, e);
|
||||||
@@ -181,11 +174,13 @@ async fn main() -> tide::Result<()> {
|
|||||||
failure!("Load cert config: {}, failed: {}", f, e);
|
failure!("Load cert config: {}, failed: {}", f, e);
|
||||||
exit(1);
|
exit(1);
|
||||||
}));
|
}));
|
||||||
let port = cert_config.as_ref().map(|c| c.port).flatten().unwrap_or(port);
|
|
||||||
|
|
||||||
let check = matches.is_present("check");
|
let skip_listen = matches.is_present("skip-listen");
|
||||||
|
let port = iff!(skip_listen, 0, cert_config.as_ref().map(|c| c.port).flatten().unwrap_or(port));
|
||||||
|
|
||||||
if !check {
|
let check_config = matches.is_present("check");
|
||||||
|
|
||||||
|
if !check_config && port > 0 {
|
||||||
let (s, r) = channel::bounded(1);
|
let (s, r) = channel::bounded(1);
|
||||||
startup_http_server(s, port);
|
startup_http_server(s, port);
|
||||||
r.recv().await.ok();
|
r.recv().await.ok();
|
||||||
@@ -195,7 +190,7 @@ async fn main() -> tide::Result<()> {
|
|||||||
let mut dns_cleaned_domains: Vec<String> = vec![];
|
let mut dns_cleaned_domains: Vec<String> = vec![];
|
||||||
match cert_config {
|
match cert_config {
|
||||||
None => { // cert config is not assigned
|
None => { // cert config is not assigned
|
||||||
if check {
|
if check_config {
|
||||||
failure!("Bad argument `--check`");
|
failure!("Bad argument `--check`");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -221,7 +216,7 @@ async fn main() -> tide::Result<()> {
|
|||||||
let acme_request = AcmeRequest {
|
let acme_request = AcmeRequest {
|
||||||
challenge: AcmeChallenge::from_str(matches.value_of("challenge-type")),
|
challenge: AcmeChallenge::from_str(matches.value_of("challenge-type")),
|
||||||
credential_supplier: matches.value_of("dns-supplier"),
|
credential_supplier: matches.value_of("dns-supplier"),
|
||||||
allow_interact: false,
|
allow_interact: matches.is_present("allow-interact"),
|
||||||
contract_email: &email,
|
contract_email: &email,
|
||||||
primary_name,
|
primary_name,
|
||||||
alt_names: &alt_names,
|
alt_names: &alt_names,
|
||||||
@@ -241,7 +236,7 @@ async fn main() -> tide::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(cert_config) => { // cert config is assigned
|
Some(cert_config) => { // cert config is assigned
|
||||||
if check {
|
if check_config {
|
||||||
check_cert_config(&cert_config);
|
check_cert_config(&cert_config);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user