Skip to content

Commit

Permalink
Add the local machine's hostname to the certificate alternative names.
Browse files Browse the repository at this point in the history
This will (probably) be useful for those people using pizauth on a
remote machine accessed via ssh.
  • Loading branch information
ltratt committed Sep 29, 2024
1 parent e19948f commit 42a4b44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ chacha20poly1305 = "0.10"
chrono = "0.4"
getopts = "0.2"
getrandom = "0.2"
hostname = "0.4"
log = "0.4"
lrlex = "0.13"
lrpar = "0.13"
Expand Down
9 changes: 7 additions & 2 deletions src/server/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,13 @@ pub fn https_server_setup(
let _ = rustls::crypto::ring::default_provider().install_default();

// Generate self-signed certificate
let cert =
generate_simple_self_signed(vec![String::from("localhost"), String::from("127.0.0.1")])?;
let mut names = vec![String::from("localhost"), String::from("127.0.0.1")];
if let Ok(x) = hostname::get() {
if let Some(x) = x.to_str() {
names.push(String::from(x));
}
}
let cert = generate_simple_self_signed(names)?;

// Bind TCP port for HTTPS
let listener = TcpListener::bind(&conf.https_listen)?;
Expand Down

0 comments on commit 42a4b44

Please sign in to comment.