summaryrefslogtreecommitdiffstats
path: root/webd/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--webd/src/config.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/webd/src/config.rs b/webd/src/config.rs
index d3ada8f..44ce4ec 100644
--- a/webd/src/config.rs
+++ b/webd/src/config.rs
@@ -34,11 +34,14 @@ impl Config {
34 if !origin.starts_with("http://") && !origin.starts_with("https://") { 34 if !origin.starts_with("http://") && !origin.starts_with("https://") {
35 return Err("ZAGAN_WEB_ORIGIN must start with http:// or https://".to_string()); 35 return Err("ZAGAN_WEB_ORIGIN must start with http:// or https://".to_string());
36 } 36 }
37 let origin = origin.trim_end_matches('/').to_string(); 37 let origin = origin.trim_end_matches('/').to_ascii_lowercase();
38 38
39 let upstream = value("ZAGAN_UPSTREAM", DEFAULT_UPSTREAM); 39 let upstream = value("ZAGAN_UPSTREAM", DEFAULT_UPSTREAM);
40 let fingerprint = required("ZAGAN_UPSTREAM_FINGERPRINT")?; 40 let fingerprint = required("ZAGAN_UPSTREAM_FINGERPRINT")?;
41 let fingerprint = fingerprint.trim().to_ascii_lowercase(); 41 let fingerprint = fingerprint
42 .trim()
43 .replace([':', ' ', '-'], "")
44 .to_ascii_lowercase();
42 if fingerprint.len() != 64 || !fingerprint.bytes().all(|byte| byte.is_ascii_hexdigit()) { 45 if fingerprint.len() != 64 || !fingerprint.bytes().all(|byte| byte.is_ascii_hexdigit()) {
43 return Err( 46 return Err(
44 "ZAGAN_UPSTREAM_FINGERPRINT must be the 64-character SHA-256 of the upstream SPKI" 47 "ZAGAN_UPSTREAM_FINGERPRINT must be the 64-character SHA-256 of the upstream SPKI"