internal gencert working

This commit is contained in:
2025-02-11 22:45:07 -07:00
parent a98bc825f6
commit 0b928c171f
2 changed files with 21 additions and 20 deletions
+13 -16
View File
@@ -2,23 +2,20 @@
## Running Desktop ## Running Desktop
1. `cargo install dioxus-cli --version 0.6.3` 1. `cargo install dioxus-cli --version 0.6.3`
2. `dx build -p mumble-web2-gui --platform desktop` 2. `dx run -p mumble-web2-gui --platform desktop --release`
## Running Web ## Running Web
1. `cargo install dioxus-cli --version 0.6.3` 1. `cargo install dioxus-cli --version 0.6.3`
2. `cargo install cargo install wtransport --example gencert` 2. `dx build -p mumble-web2-gui --platform web --release`
3. in the proxy directory: 3. `cp config.toml.example config.toml`
1. `cp config.toml.example config.toml` 4. `cargo run -p mumble-web2-proxy` in the background
2. run `gencert` and copy the certificate hash into config.toml 5. connect to `localhost:8080`
3. `cargo run -p mumble-web2-proxy` in the background
## with `dx serve` ## Running Web (with `dx serve`)
4. in the gui directory 1. `cargo install dioxus-cli --version 0.6.3`
1. `export 'MUMBLE_WEB2_GUI_CONFIG={"cert_hash": <CERTIFICATE HASH HERE>, "proxy_url": "https://localhost:4433"}'` 2. `cp config.toml.example config.toml`
2. `dx serve -p mumble-web2-gui --platform web` 3. `cargo run -p mumble-web2-proxy` in the background
5. connect to `localhost:8080` (most common) 4. `cargo install cargo install wtransport --example gencert`
5. `export 'MUMBLE_WEB2_GUI_CONFIG={"cert_hash": <CERTIFICATE HASH HERE>, "proxy_url": "https://localhost:4433"}'`
## with `mumble-web2-proxy` only 6. `dx serve -p mumble-web2-gui --platform web`
4. in the gui directory: 7. connect to `localhost:8080`
1. `dx build -p mumble-web2-gui --platform web`
5. connect to `localhost:4434` (most common)
+8 -4
View File
@@ -121,10 +121,14 @@ async fn main() -> Result<()> {
(None, None) => { (None, None) => {
info!("generating self-signed cert"); info!("generating self-signed cert");
use rcgen::{CertificateParams, KeyPair, PKCS_ECDSA_P256_SHA256}; // FIXME: redo every <14 days
let key_pair = KeyPair::generate_for(&PKCS_ECDSA_P256_SHA256)?; let mut dname = rcgen::DistinguishedName::new();
let mut cert_params = CertificateParams::new(config.cert_alt_names.clone())?; dname.push(rcgen::DnType::CommonName, "mumble-web self-signed");
cert_params.not_after = time::OffsetDateTime::now_utc() + time::Duration::days(12); let key_pair = rcgen::KeyPair::generate_for(&rcgen::PKCS_ECDSA_P256_SHA256)?;
let mut cert_params = rcgen::CertificateParams::new(config.cert_alt_names.clone())?;
cert_params.distinguished_name = dname;
cert_params.not_before = time::OffsetDateTime::now_utc();
cert_params.not_after = cert_params.not_before + time::Duration::days(12);
let cert = cert_params.self_signed(&key_pair)?; let cert = cert_params.self_signed(&key_pair)?;
let hash = hmac_sha256::Hash::hash(cert.der().as_ref()); let hash = hmac_sha256::Hash::hash(cert.der().as_ref());