mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
trust local ca (#1670)
This commit is contained in:
@@ -12,10 +12,12 @@ use openssl::pkey::{PKey, Private};
|
|||||||
use openssl::x509::{X509Builder, X509Extension, X509NameBuilder, X509};
|
use openssl::x509::{X509Builder, X509Extension, X509NameBuilder, X509};
|
||||||
use openssl::*;
|
use openssl::*;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
use tokio::process::Command;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use crate::s9pk::manifest::PackageId;
|
use crate::s9pk::manifest::PackageId;
|
||||||
|
use crate::util::Invoke;
|
||||||
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.
|
||||||
@@ -180,6 +182,17 @@ impl SslManager {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
tokio::fs::write(ROOT_CA_STATIC_PATH, root_cert.to_pem()?).await?;
|
tokio::fs::write(ROOT_CA_STATIC_PATH, root_cert.to_pem()?).await?;
|
||||||
|
|
||||||
|
// write to ca cert store
|
||||||
|
tokio::fs::write(
|
||||||
|
"/usr/local/share/ca-certificates/embassy-root-ca.crt",
|
||||||
|
root_cert.to_pem()?,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Command::new("update-ca-certificates")
|
||||||
|
.invoke(crate::ErrorKind::OpenSsl)
|
||||||
|
.await?;
|
||||||
|
|
||||||
let (int_key, int_cert) = match store.load_intermediate_certificate().await? {
|
let (int_key, int_cert) = match store.load_intermediate_certificate().await? {
|
||||||
None => {
|
None => {
|
||||||
let int_key = generate_key()?;
|
let int_key = generate_key()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user