mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
feat: Add in the ssl_size (#2432)
* feat: Add in the ssl_size * chore: Changes for the naming and other things.
This commit is contained in:
@@ -22,7 +22,7 @@ pub mod wifi;
|
|||||||
|
|
||||||
pub const PACKAGE_CERT_PATH: &str = "/var/lib/embassy/ssl";
|
pub const PACKAGE_CERT_PATH: &str = "/var/lib/embassy/ssl";
|
||||||
|
|
||||||
#[command(subcommands(tor::tor, dhcp::dhcp))]
|
#[command(subcommands(tor::tor, dhcp::dhcp, ssl::ssl))]
|
||||||
pub fn net() -> Result<(), Error> {
|
pub fn net() -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use std::net::IpAddr;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
|
use chrono::format;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use openssl::asn1::{Asn1Integer, Asn1Time};
|
use openssl::asn1::{Asn1Integer, Asn1Time};
|
||||||
use openssl::bn::{BigNum, MsbOption};
|
use openssl::bn::{BigNum, MsbOption};
|
||||||
@@ -13,13 +14,18 @@ use openssl::nid::Nid;
|
|||||||
use openssl::pkey::{PKey, Private};
|
use openssl::pkey::{PKey, Private};
|
||||||
use openssl::x509::{X509Builder, X509Extension, X509NameBuilder, X509};
|
use openssl::x509::{X509Builder, X509Extension, X509NameBuilder, X509};
|
||||||
use openssl::*;
|
use openssl::*;
|
||||||
|
use rpc_toolkit::command;
|
||||||
use tokio::sync::{Mutex, RwLock};
|
use tokio::sync::{Mutex, RwLock};
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use crate::account::AccountInfo;
|
|
||||||
use crate::hostname::Hostname;
|
use crate::hostname::Hostname;
|
||||||
use crate::net::dhcp::ips;
|
use crate::net::dhcp::ips;
|
||||||
use crate::net::keys::{Key, KeyInfo};
|
use crate::net::keys::{Key, KeyInfo};
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::{
|
||||||
|
account::AccountInfo,
|
||||||
|
context::{self, RpcContext},
|
||||||
|
};
|
||||||
use crate::{Error, ErrorKind, ResultExt};
|
use crate::{Error, ErrorKind, ResultExt};
|
||||||
|
|
||||||
static CERTIFICATE_VERSION: i32 = 2; // X509 version 3 is actually encoded as '2' in the cert because fuck you.
|
static CERTIFICATE_VERSION: i32 = 2; // X509 version 3 is actually encoded as '2' in the cert because fuck you.
|
||||||
@@ -414,3 +420,16 @@ pub fn make_leaf_cert(
|
|||||||
let cert = builder.build();
|
let cert = builder.build();
|
||||||
Ok(cert)
|
Ok(cert)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[command(subcommands(size))]
|
||||||
|
pub async fn ssl() -> Result<(), Error> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[command]
|
||||||
|
pub async fn size(#[context] ctx: RpcContext) -> Result<String, Error> {
|
||||||
|
Ok(format!(
|
||||||
|
"Cert Catch size: {}",
|
||||||
|
ctx.net_controller.ssl.cert_cache.read().await.len()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user