mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-22 09:23:16 +00:00
show help when: shellchat net tls <no sub-command>
This commit is contained in:
parent
33169f9df9
commit
6ef1e8d67c
1 changed files with 90 additions and 85 deletions
|
|
@ -461,10 +461,9 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
}
|
||||
#[cfg(feature = "tls")]
|
||||
"tls" => {
|
||||
if let Some(tls_cmd) = tokens.next() {
|
||||
match tls_cmd {
|
||||
match tokens.next() {
|
||||
// save/trust all Root CA's in webpki-roots en-masse
|
||||
"mozilla" => {
|
||||
Some("mozilla") => {
|
||||
let mut rotas: Vec<tls::RustlsOwnedTrustAnchor> = webpki_roots::TLS_SERVER_ROOTS
|
||||
.0
|
||||
.iter()
|
||||
|
|
@ -480,14 +479,21 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
i += 1;
|
||||
}
|
||||
}
|
||||
"probe" => {
|
||||
// probe establishes a tls connection to the supplied host, extracts the
|
||||
// certificates offered and immediately closes the connection.
|
||||
// The certificates are presented by modal to the user, and saved to the
|
||||
// pddb if trusted.
|
||||
Some("probe") => {
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::info!("starting TLS probe");
|
||||
// Attempt to open the tls connection with an empty root_store
|
||||
let mut root_store = rustls::RootCertStore::empty();
|
||||
// Stifle the default rustls certificate verification's complaint about an
|
||||
// unknown/untrusted CA root certificate so that we get to see the certificate chain
|
||||
let stifled_verifier = Arc::new(danger::StifledCertificateVerification{ roots: root_store });
|
||||
let stifled_verifier =
|
||||
Arc::new(danger::StifledCertificateVerification {
|
||||
roots: root_store,
|
||||
});
|
||||
let config = rustls::ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_custom_certificate_verifier(stifled_verifier)
|
||||
|
|
@ -504,7 +510,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
let url = format!("{}:443", target);
|
||||
let mut sock = match TcpStream::connect(url) {
|
||||
Ok(mut sock) => {
|
||||
match conn.complete_io(&mut sock){
|
||||
match conn.complete_io(&mut sock) {
|
||||
Ok(_) => log::info!("handshake complete"),
|
||||
Err(e) => {
|
||||
write!(ret, "{e}").ok();
|
||||
|
|
@ -517,7 +523,6 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
Some(certificates) => tls::check_trust(certificates),
|
||||
None => false,
|
||||
};
|
||||
|
||||
}
|
||||
Err(e) => {
|
||||
write!(ret, "{e}").ok();
|
||||
|
|
@ -527,7 +532,8 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
}
|
||||
"test" => {
|
||||
|
||||
Some("test") => {
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::info!("starting TLS run");
|
||||
let mut root_store = rustls::RootCertStore::empty();
|
||||
|
|
@ -585,7 +591,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
log::set_max_level(log::LevelFilter::Info);
|
||||
}
|
||||
// list trusted Certificate Authority certificates
|
||||
"trusted" => {
|
||||
Some("trusted") => {
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
log::info!("starting TLS trusted listing");
|
||||
let trusted =
|
||||
|
|
@ -595,7 +601,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
}
|
||||
log::info!("finished TLS trusted listing");
|
||||
}
|
||||
_ => {
|
||||
_ | None => {
|
||||
write!(ret, "net tls <sub-command>\n").ok();
|
||||
write!(
|
||||
ret,
|
||||
|
|
@ -609,7 +615,6 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// note: to use the `shellperf` option, you need to load a version of the SOC that has the performance counters built in.
|
||||
// this can be generated using the command `python3 .\betrusted_soc.py -e .\dummy.nky --perfcounter` in the betrusted-soc repo.
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue