rename shellchat net tls inspect

rename shellchat `net tls probe` to `net tls inspect`
This commit is contained in:
nworbnhoj 2023-12-20 18:44:52 +11:00
parent 0e1c9595e4
commit de1dcffd66
3 changed files with 16 additions and 12 deletions

View file

@ -4,8 +4,8 @@
"en-tts": "Do you trust any of these certificate authorities?"
},
"tls.cmd_help": {
"en": "Establishing an encrypted tls connection requires the host to provide a signed Certificate of identity. Each Certificate is signed for authenticity by a Certificate Authority. The CA's Certificate will in-turn be signed by yet another CA. These signed Certificates link into a chain of trust back to a trusted Root CA.\n\nTypically, this all happens automagically because many OS's & browsers incorporate a long list of trusted Root CA Certiicates. And this is OK because you trust the CA's that your OS trusts, right!\n\nOn Precursor, you must explicitly trust one or more root CA Certificates. You can:\nnet tls probe <host>\n\tto trust a specific CA Certificate, or\nnet tls mozilla\n\tto trust all of the CA Certificates incporporated in the Firefox browser.",
"en-tts": "Establishing an encrypted tls connection requires the host to provide a signed Certificate of identity. Each Certificate is signed for authenticity by a Certificate Authority. The CA's Certificate will in-turn be signed by yet another CA. These signed Certificates link into a chain of trust back to a trusted Root CA.\n\nTypically, this all happens automagically because many OS's & browsers incorporate a long list of trusted Root CA Certiicates. And this is OK because you trust the CA's that your OS trusts, right!\n\nOn Precursor, you must explicitly trust one or more root CA Certificates. You can:\nnet tls probe <host>\n\tto trust a specific CA Certificate, or\nnet tls mozilla\n\tto trust all of the CA Certificates incporporated in the Firefox browser."
"en": "Establishing an encrypted tls connection requires the host to provide a signed Certificate of identity. Each Certificate is signed for authenticity by a Certificate Authority. The CA's Certificate will in-turn be signed by yet another CA. These signed Certificates link into a chain of trust back to a trusted Root CA.\n\nTypically, this all happens automagically because many OS's & browsers incorporate a long list of trusted Root CA Certiicates. And this is OK because you trust the CA's that your OS trusts, right!\n\nOn Precursor, you must explicitly trust one or more root CA Certificates. You can:\nnet tls inspect <host>\n\tto trust a specific CA Certificate, or\nnet tls mozilla\n\tto trust all of the CA Certificates incporporated in the Firefox browser.",
"en-tts": "Establishing an encrypted tls connection requires the host to provide a signed Certificate of identity. Each Certificate is signed for authenticity by a Certificate Authority. The CA's Certificate will in-turn be signed by yet another CA. These signed Certificates link into a chain of trust back to a trusted Root CA.\n\nTypically, this all happens automagically because many OS's & browsers incorporate a long list of trusted Root CA Certiicates. And this is OK because you trust the CA's that your OS trusts, right!\n\nOn Precursor, you must explicitly trust one or more root CA Certificates. You can:\nnet tls inspect <host>\n\tto trust a specific CA Certificate, or\nnet tls mozilla\n\tto trust all of the CA Certificates incporporated in the Firefox browser."
},
"tls.cmd": {
"en": "net tls <sub-command>",
@ -35,11 +35,11 @@
"en": "trusted Root CA's",
"en-tts": "trusted Root CA's"
},
"tls.probe_cmd": {
"tls.inspect_cmd": {
"en": "save host CA'a if trusted",
"en-tts": "save host CA'a if trusted"
},
"tls.probe_fail_servername": {
"tls.inspect_fail_servername": {
"en": "failed to create server name from",
"en-tts": "failed to create server name from"
},
@ -55,7 +55,7 @@
"en": "error maybe caused by an improperly set clock",
"en-tts": "error maybe caused by an improperly set clock"
},
"tls.probe_done": {
"tls.inspect_done": {
"en": "trusted CA's",
"en-tts": "trusted CA's"
},

View file

@ -69,23 +69,23 @@ pub fn shellchat<'a>(
modals.finish_progress().expect("finish progress");
write!(ret, "{} {}", count, t!("tls.mozilla_done", locales::LANG)).ok();
}
// probe establishes a tls connection to the supplied host, extracts the
// inspect 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") => {
Some("inspect") => {
log::set_max_level(log::LevelFilter::Info);
let target = match tokens.next() {
Some(target) => target,
None => "betrusted.io",
};
let tls = Tls::new();
match tls.probe(target) {
Ok(count) => write!(ret, "{} {}", count, t!("tls.probe_done", locales::LANG)).ok(),
match tls.inspect(target) {
Ok(count) => write!(ret, "{} {}", count, t!("tls.inspect_done", locales::LANG)).ok(),
Err(_) => write!(
ret,
"{} {target}",
t!("tls.probe_fail_servername", locales::LANG)
t!("tls.inspect_fail_servername", locales::LANG)
)
.ok(),
};
@ -170,8 +170,8 @@ pub fn shellchat<'a>(
write!(ret, "\tmozilla\t{}\n", t!("tls.mozilla_cmd", locales::LANG)).ok();
write!(
ret,
"\tprobe <host>\t{}\n",
t!("tls.probe_cmd", locales::LANG)
"\tinspect <host>\t{}\n",
t!("tls.inspect_cmd", locales::LANG)
)
.ok();
write!(

View file

@ -336,6 +336,10 @@ impl Tls {
}
}
pub fn inspect(&self, target: &str) -> Result<usize, Error> {
self.probe(target)
}
pub fn client_config(&self) -> ClientConfig {
rustls::ClientConfig::builder()
.with_safe_defaults()