diff --git a/backend/src/bins/start_deno.rs b/backend/src/bins/start_deno.rs index e453e941b..0be507082 100644 --- a/backend/src/bins/start_deno.rs +++ b/backend/src/bins/start_deno.rs @@ -69,12 +69,11 @@ impl PackageLogger { use tracing_subscriber::prelude::*; use tracing_subscriber::{fmt, EnvFilter}; - let filter_layer = EnvFilter::default() - .add_directive( - format!("{}=warn", std::module_path!().split("::").next().unwrap()) - .parse() - .unwrap(), - ); + let filter_layer = EnvFilter::default().add_directive( + format!("{}=warn", std::module_path!().split("::").next().unwrap()) + .parse() + .unwrap(), + ); let fmt_layer = fmt::layer().with_writer(std::io::stderr).with_target(true); let journald_layer = tracing_journald::layer() .unwrap() diff --git a/backend/src/config/mod.rs b/backend/src/config/mod.rs index 8224860a5..06e7770b0 100644 --- a/backend/src/config/mod.rs +++ b/backend/src/config/mod.rs @@ -14,9 +14,8 @@ use rpc_toolkit::command; use tracing::instrument; use crate::context::RpcContext; - use crate::prelude::*; -use crate::s9pk::manifest::{PackageId}; +use crate::s9pk::manifest::PackageId; use crate::util::display_none; use crate::util::serde::{display_serializable, parse_stdin_deserializable, IoFormat}; use crate::Error; diff --git a/backend/src/config/spec.rs b/backend/src/config/spec.rs index 09f7ec91e..a98ad888d 100644 --- a/backend/src/config/spec.rs +++ b/backend/src/config/spec.rs @@ -1,4 +1,4 @@ -use std::borrow::{Cow}; +use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet}; use std::fmt; use std::fmt::Debug; diff --git a/backend/src/logs.rs b/backend/src/logs.rs index 26463be35..691ae09b9 100644 --- a/backend/src/logs.rs +++ b/backend/src/logs.rs @@ -136,7 +136,13 @@ pub struct LogEntry { } impl std::fmt::Display for LogEntry { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "{} {}", self.timestamp, self.message) + write!( + f, + "{} {}", + self.timestamp + .to_rfc3339_opts(chrono::SecondsFormat::Millis, true), + self.message + ) } } diff --git a/backend/src/middleware/encrypt.rs b/backend/src/middleware/encrypt.rs index 010197c49..94167b7e2 100644 --- a/backend/src/middleware/encrypt.rs +++ b/backend/src/middleware/encrypt.rs @@ -13,7 +13,8 @@ pub fn pbkdf2(password: impl AsRef<[u8]>, salt: impl AsRef<[u8]>) -> CipherKey a, + Err(e) => { + tracing::trace!( "VHostController: failed to accept TLS connection on port {port}: {e}"); + tracing::trace!("{e:?}"); + return Ok(()) + } + }; tls_stream.get_mut().0.stop_buffering(); tokio::io::copy_bidirectional( &mut tls_stream, @@ -287,7 +294,14 @@ impl VHostServer { cfg.alpn_protocols.push(proto.into()); } let mut tls_stream = - mid.into_stream(Arc::new(cfg)).await?; + match mid.into_stream(Arc::new(cfg)).await { + Ok(a) => a, + Err(e) => { + tracing::trace!( "VHostController: failed to accept TLS connection on port {port}: {e}"); + tracing::trace!("{e:?}"); + return Ok(()) + } + }; tls_stream.get_mut().0.stop_buffering(); tokio::io::copy_bidirectional( &mut tls_stream, @@ -298,7 +312,14 @@ impl VHostServer { Err(AlpnInfo::Specified(alpn)) => { cfg.alpn_protocols = alpn; let mut tls_stream = - mid.into_stream(Arc::new(cfg)).await?; + match mid.into_stream(Arc::new(cfg)).await { + Ok(a) => a, + Err(e) => { + tracing::trace!( "VHostController: failed to accept TLS connection on port {port}: {e}"); + tracing::trace!("{e:?}"); + return Ok(()) + } + }; tls_stream.get_mut().0.stop_buffering(); tokio::io::copy_bidirectional( &mut tls_stream, @@ -308,10 +329,12 @@ impl VHostServer { } } .map_or_else( - |e| match e.kind() { - std::io::ErrorKind::UnexpectedEof => Ok(()), + |e| { + use std::io::ErrorKind as E; + match e.kind() { + E::UnexpectedEof | E::BrokenPipe | E::ConnectionAborted | E::ConnectionReset | E::ConnectionRefused | E::TimedOut | E::Interrupted | E::NotConnected => Ok(()), _ => Err(e), - }, + }}, |_| Ok(()), )?; } else { @@ -327,8 +350,10 @@ impl VHostServer { }); } Err(e) => { - tracing::error!("Error in VHostController on port {port}: {e}"); - tracing::debug!("{e:?}"); + tracing::trace!( + "VHostController: failed to accept connection on port {port}: {e}" + ); + tracing::trace!("{e:?}"); } } } diff --git a/backend/src/procedure/js_scripts.rs b/backend/src/procedure/js_scripts.rs index 35d85c32e..3e5d6dfa2 100644 --- a/backend/src/procedure/js_scripts.rs +++ b/backend/src/procedure/js_scripts.rs @@ -1,9 +1,7 @@ +use std::path::{Path, PathBuf}; +use std::process::Stdio; use std::sync::Arc; use std::time::Duration; -use std::{ - path::{Path, PathBuf}, - process::Stdio, -}; use color_eyre::eyre::eyre; use embassy_container_init::ProcessGroupId; diff --git a/backend/src/util/mod.rs b/backend/src/util/mod.rs index c6978802d..5ee9cbe5f 100644 --- a/backend/src/util/mod.rs +++ b/backend/src/util/mod.rs @@ -26,13 +26,13 @@ use crate::shutdown::Shutdown; use crate::{Error, ErrorKind, ResultExt as _}; pub mod config; pub mod cpupower; +pub mod crypto; pub mod docker; pub mod http_reader; pub mod io; pub mod logger; pub mod lshw; pub mod serde; -pub mod crypto; #[derive(Clone, Copy, Debug, ::serde::Deserialize, ::serde::Serialize)] pub enum Never {} diff --git a/build/lib/motd b/build/lib/motd index bbc010881..5e98aa887 100755 --- a/build/lib/motd +++ b/build/lib/motd @@ -29,5 +29,6 @@ printf "\n" printf " * Documentation: https://docs.start9.com\n" printf " * Management: https://%s.local\n" "$(hostname)" printf " * Support: https://start9.com/contact\n" +printf " * Source Code: https://github.com/Start9Labs/start-os\n" printf " * License: MIT\n" printf "\n" diff --git a/build/registry/cleanDanglingImages b/build/registry/cleanDanglingImages new file mode 100644 index 000000000..481522903 --- /dev/null +++ b/build/registry/cleanDanglingImages @@ -0,0 +1,9 @@ +#!/bin/bash + +for image in $(find /root/resources/eos/ -type f -name '*.squashfs' -mmin +240 -exec realpath {} \;); do + if ! mount | grep "^$image" > /dev/null; then + >&2 echo "Removing dangling image: $image" + rm $image + fi +done +find /root/resources/eos -type d -empty -delete