Skip to content

Commit

Permalink
Add serial number to CertificateIssued log struct (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-anderson authored Jun 6, 2024
1 parent e2c2538 commit dbbf7f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions rustica/src/logging/influx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl RusticaLogger for InfluxLogger {
.into_query(&self.dataset)
.add_tag("fingerprint", ci.fingerprint.clone())
.add_tag("mtls_identities", ci.mtls_identities.join(","))
.add_tag("serial", ci.serial)
.add_field("principals", ci.principals.join(","));

let client = self.client.clone();
Expand Down
2 changes: 2 additions & 0 deletions rustica/src/logging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub struct CertificateIssued {
pub fingerprint: String,
/// The fingerprint of the signing certificate
pub signed_by: String,
/// The serial number of the signed certificate
pub serial: u64,
/// The configured authority name for the signer
pub authority: String,
/// Certificate type, either User or Host
Expand Down
3 changes: 2 additions & 1 deletion rustica/src/logging/stdout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl RusticaLogger for StdoutLogger {
match &log.log {
Log::CertificateIssued(ci) => {
info!(
"[{}] Certificate issued for: [{}] Authority: [{}] Identified by: [{}] Principals granted: [{}] Extensions: [{:?}] CriticalOptions: [{:?}] Valid After: [{}] Valid Before: [{}]",
"[{}] Certificate issued for: [{}] Authority: [{}] Identified by: [{}] Principals granted: [{}] Extensions: [{:?}] CriticalOptions: [{:?}] Valid After: [{}] Valid Before: [{}] Serial Number: [{}]",
ci.certificate_type,
ci.fingerprint,
ci.authority,
Expand All @@ -28,6 +28,7 @@ impl RusticaLogger for StdoutLogger {
ci.critical_options,
ci.valid_after,
ci.valid_before,
ci.serial,
)
}
Log::KeyRegistered(kr) => info!("Key registered: [{}] Identified by: [{}]", kr.fingerprint, kr.mtls_identities.join(", ")),
Expand Down
1 change: 1 addition & 0 deletions rustica/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ impl Rustica for RusticaServer {
fingerprint,
signed_by: ca_cert.fingerprint().hash,
authority: authority.to_string(),
serial: authorization.serial,
certificate_type: req_cert_type.to_string(),
mtls_identities,
principals: authorization.principals,
Expand Down

0 comments on commit dbbf7f7

Please sign in to comment.