server: Add a bit more logging
This commit is contained in:
@@ -19,7 +19,7 @@ use secrecy::ExposeSecret;
|
|||||||
use ssh_key::public::PublicKey;
|
use ssh_key::public::PublicKey;
|
||||||
use ssh_key::Certificate;
|
use ssh_key::Certificate;
|
||||||
use ssh_key::Fingerprint;
|
use ssh_key::Fingerprint;
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use yaml_rust::YamlLoader;
|
use yaml_rust::YamlLoader;
|
||||||
|
|
||||||
use super::Context;
|
use super::Context;
|
||||||
@@ -78,6 +78,7 @@ impl FromRequestParts<Arc<Context>> for Auth {
|
|||||||
warn!("Invalid certificate");
|
warn!("Invalid certificate");
|
||||||
Self::unauthorized()
|
Self::unauthorized()
|
||||||
})?;
|
})?;
|
||||||
|
debug!("Successfully validated certificate from request: {:?}", cert);
|
||||||
Ok(Self(cert))
|
Ok(Self(cert))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,6 +116,7 @@ async fn dispense_keys(
|
|||||||
all_keys.push(b'\n');
|
all_keys.push(b'\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
info!("Encrypted {} keys for {}", keys.len(), princ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let pubkey = PublicKey::new(cert.public_key().clone(), "");
|
let pubkey = PublicKey::new(cert.public_key().clone(), "");
|
||||||
@@ -179,6 +181,7 @@ fn encrypt(
|
|||||||
/// to a list of keys the principal is authorized to have.
|
/// to a list of keys the principal is authorized to have.
|
||||||
fn load_map(path: impl AsRef<Path>) -> HashMap<String, Vec<String>> {
|
fn load_map(path: impl AsRef<Path>) -> HashMap<String, Vec<String>> {
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
debug!("Loading key map from {}", path.display());
|
||||||
let mut map = Default::default();
|
let mut map = Default::default();
|
||||||
let contents = match std::fs::read_to_string(path) {
|
let contents = match std::fs::read_to_string(path) {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
@@ -212,6 +215,7 @@ fn load_map(path: impl AsRef<Path>) -> HashMap<String, Vec<String>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
debug!("Loaded key map for {} principals", map.keys().len());
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user