added: cert/SHA256:...
This commit is contained in:
@@ -9,6 +9,7 @@ use std::time::SystemTime;
|
||||
use anyhow::Context;
|
||||
use axum::body;
|
||||
use axum::extract::{Query, State};
|
||||
use chrono::Duration;
|
||||
use ssh_cert_dist_common::*;
|
||||
|
||||
use axum::{http::StatusCode, response::IntoResponse, Json, Router};
|
||||
@@ -291,12 +292,12 @@ struct CertInfo {
|
||||
|
||||
impl From<&Certificate> for CertInfo {
|
||||
fn from(cert: &Certificate) -> Self {
|
||||
let validity = cert.valid_after_time().duration_since(cert.valid_before_time()).unwrap();
|
||||
let validity = cert.valid_before_time().duration_since(cert.valid_after_time()).unwrap_or(Duration::zero().to_std().unwrap());
|
||||
let validity_days = validity.as_secs() / ((60*60) * 24);
|
||||
let host_key = if cert.cert_type().is_host() {
|
||||
" -h"
|
||||
} else { "" };
|
||||
let opts = cert.critical_options().iter().map(|(opt, val)| if val.is_empty() { opt.clone() } else { format!("{opt}={val}") }).map(|arg| format!("-O {arg}")).join(" ");
|
||||
let opts = cert.critical_options().iter().map(|(opt, val)| if val.is_empty() { opt.clone() } else { format!("{opt}={val}") }).map(|arg| format!("-O {arg}")).collect::<Vec<_>>().join(" ");
|
||||
let renew_command = format!("ssh-keygen -s ./ca_key {host_key} -I {} -n {} -V {validity_days}d {opts}", cert.key_id(), cert.valid_principals().join(","));
|
||||
CertInfo {
|
||||
principals: cert.valid_principals().to_vec(),
|
||||
|
Reference in New Issue
Block a user