Skip to content

Commit 5aa187f

Browse files
committed
use dns check
1 parent 03623d3 commit 5aa187f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

server/src/https.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ pub async fn cert_init_server(config: &crate::config::Config) -> AtomicServerRes
157157
}
158158

159159
async fn request_cert(config: &crate::config::Config) -> AtomicServerResult<()> {
160+
let use_wildcard = false;
161+
162+
fs::create_dir_all(PathBuf::from(&config.https_path))?;
163+
160164
// Create a new account. This will generate a fresh ECDSA key for you.
161165
// Alternatively, restore an account from serialized credentials by
162166
// using `Account::from_credentials()`.
@@ -176,7 +180,7 @@ async fn request_cert(config: &crate::config::Config) -> AtomicServerResult<()>
176180

177181
let account = instant_acme::Account::create(
178182
&instant_acme::NewAccount {
179-
contact: &[&email],
183+
contact: &[&format!("mailto:{}", email)],
180184
terms_of_service_agreed: true,
181185
only_return_existing: false,
182186
},
@@ -189,7 +193,11 @@ async fn request_cert(config: &crate::config::Config) -> AtomicServerResult<()>
189193
// Note that this only needs an `&Account`, so the library will let you
190194
// process multiple orders in parallel for a single account.
191195

192-
let identifier = instant_acme::Identifier::Dns(config.opts.domain.clone());
196+
let mut domain = config.opts.domain.clone();
197+
if use_wildcard {
198+
domain = format!("*.{}", domain);
199+
}
200+
let identifier = instant_acme::Identifier::Dns(domain);
193201
let (mut order, state) = account
194202
.new_order(&instant_acme::NewOrder {
195203
identifiers: &[identifier],
@@ -214,8 +222,8 @@ async fn request_cert(config: &crate::config::Config) -> AtomicServerResult<()>
214222
let challenge = authz
215223
.challenges
216224
.iter()
217-
.find(|c| c.r#type == instant_acme::ChallengeType::Http01)
218-
.ok_or("no Http01 challenge found")?;
225+
.find(|c| c.r#type == instant_acme::ChallengeType::Dns01)
226+
.ok_or("no Dns01 challenge found")?;
219227

220228
let instant_acme::Identifier::Dns(identifier) = &authz.identifier;
221229

0 commit comments

Comments
 (0)