mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
mute errors due to failed incoming network connections (#2497)
* mute errors due to failed incoming network connections * fix log entry formatting * Update cleanDanglingImages * Update cleanDanglingImages
This commit is contained in:
@@ -69,12 +69,11 @@ impl PackageLogger {
|
|||||||
use tracing_subscriber::prelude::*;
|
use tracing_subscriber::prelude::*;
|
||||||
use tracing_subscriber::{fmt, EnvFilter};
|
use tracing_subscriber::{fmt, EnvFilter};
|
||||||
|
|
||||||
let filter_layer = EnvFilter::default()
|
let filter_layer = EnvFilter::default().add_directive(
|
||||||
.add_directive(
|
format!("{}=warn", std::module_path!().split("::").next().unwrap())
|
||||||
format!("{}=warn", std::module_path!().split("::").next().unwrap())
|
.parse()
|
||||||
.parse()
|
.unwrap(),
|
||||||
.unwrap(),
|
);
|
||||||
);
|
|
||||||
let fmt_layer = fmt::layer().with_writer(std::io::stderr).with_target(true);
|
let fmt_layer = fmt::layer().with_writer(std::io::stderr).with_target(true);
|
||||||
let journald_layer = tracing_journald::layer()
|
let journald_layer = tracing_journald::layer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ use rpc_toolkit::command;
|
|||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use crate::context::RpcContext;
|
use crate::context::RpcContext;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::s9pk::manifest::{PackageId};
|
use crate::s9pk::manifest::PackageId;
|
||||||
use crate::util::display_none;
|
use crate::util::display_none;
|
||||||
use crate::util::serde::{display_serializable, parse_stdin_deserializable, IoFormat};
|
use crate::util::serde::{display_serializable, parse_stdin_deserializable, IoFormat};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::borrow::{Cow};
|
use std::borrow::Cow;
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|||||||
@@ -136,7 +136,13 @@ pub struct LogEntry {
|
|||||||
}
|
}
|
||||||
impl std::fmt::Display for LogEntry {
|
impl std::fmt::Display for LogEntry {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
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
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ pub fn pbkdf2(password: impl AsRef<[u8]>, salt: impl AsRef<[u8]>) -> CipherKey<A
|
|||||||
salt.as_ref(),
|
salt.as_ref(),
|
||||||
1000,
|
1000,
|
||||||
aeskey.as_mut_slice(),
|
aeskey.as_mut_slice(),
|
||||||
).unwrap();
|
)
|
||||||
|
.unwrap();
|
||||||
aeskey
|
aeskey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,14 @@ impl VHostServer {
|
|||||||
.await
|
.await
|
||||||
.with_kind(crate::ErrorKind::OpenSsl)?;
|
.with_kind(crate::ErrorKind::OpenSsl)?;
|
||||||
let mut tls_stream =
|
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();
|
tls_stream.get_mut().0.stop_buffering();
|
||||||
tokio::io::copy_bidirectional(
|
tokio::io::copy_bidirectional(
|
||||||
&mut tls_stream,
|
&mut tls_stream,
|
||||||
@@ -287,7 +294,14 @@ impl VHostServer {
|
|||||||
cfg.alpn_protocols.push(proto.into());
|
cfg.alpn_protocols.push(proto.into());
|
||||||
}
|
}
|
||||||
let mut tls_stream =
|
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();
|
tls_stream.get_mut().0.stop_buffering();
|
||||||
tokio::io::copy_bidirectional(
|
tokio::io::copy_bidirectional(
|
||||||
&mut tls_stream,
|
&mut tls_stream,
|
||||||
@@ -298,7 +312,14 @@ impl VHostServer {
|
|||||||
Err(AlpnInfo::Specified(alpn)) => {
|
Err(AlpnInfo::Specified(alpn)) => {
|
||||||
cfg.alpn_protocols = alpn;
|
cfg.alpn_protocols = alpn;
|
||||||
let mut tls_stream =
|
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();
|
tls_stream.get_mut().0.stop_buffering();
|
||||||
tokio::io::copy_bidirectional(
|
tokio::io::copy_bidirectional(
|
||||||
&mut tls_stream,
|
&mut tls_stream,
|
||||||
@@ -308,10 +329,12 @@ impl VHostServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.map_or_else(
|
.map_or_else(
|
||||||
|e| match e.kind() {
|
|e| {
|
||||||
std::io::ErrorKind::UnexpectedEof => Ok(()),
|
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),
|
_ => Err(e),
|
||||||
},
|
}},
|
||||||
|_| Ok(()),
|
|_| Ok(()),
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
@@ -327,8 +350,10 @@ impl VHostServer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("Error in VHostController on port {port}: {e}");
|
tracing::trace!(
|
||||||
tracing::debug!("{e:?}");
|
"VHostController: failed to accept connection on port {port}: {e}"
|
||||||
|
);
|
||||||
|
tracing::trace!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::Stdio;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
process::Stdio,
|
|
||||||
};
|
|
||||||
|
|
||||||
use color_eyre::eyre::eyre;
|
use color_eyre::eyre::eyre;
|
||||||
use embassy_container_init::ProcessGroupId;
|
use embassy_container_init::ProcessGroupId;
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ use crate::shutdown::Shutdown;
|
|||||||
use crate::{Error, ErrorKind, ResultExt as _};
|
use crate::{Error, ErrorKind, ResultExt as _};
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod cpupower;
|
pub mod cpupower;
|
||||||
|
pub mod crypto;
|
||||||
pub mod docker;
|
pub mod docker;
|
||||||
pub mod http_reader;
|
pub mod http_reader;
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod logger;
|
pub mod logger;
|
||||||
pub mod lshw;
|
pub mod lshw;
|
||||||
pub mod serde;
|
pub mod serde;
|
||||||
pub mod crypto;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, ::serde::Deserialize, ::serde::Serialize)]
|
#[derive(Clone, Copy, Debug, ::serde::Deserialize, ::serde::Serialize)]
|
||||||
pub enum Never {}
|
pub enum Never {}
|
||||||
|
|||||||
@@ -29,5 +29,6 @@ printf "\n"
|
|||||||
printf " * Documentation: https://docs.start9.com\n"
|
printf " * Documentation: https://docs.start9.com\n"
|
||||||
printf " * Management: https://%s.local\n" "$(hostname)"
|
printf " * Management: https://%s.local\n" "$(hostname)"
|
||||||
printf " * Support: https://start9.com/contact\n"
|
printf " * Support: https://start9.com/contact\n"
|
||||||
|
printf " * Source Code: https://github.com/Start9Labs/start-os\n"
|
||||||
printf " * License: MIT\n"
|
printf " * License: MIT\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|||||||
9
build/registry/cleanDanglingImages
Normal file
9
build/registry/cleanDanglingImages
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user