whois: show client-cert fingerprint (276) to opers and self

This commit is contained in:
Jean Chevronnet 2026-08-08 19:42:10 +00:00
parent 02528df5e9
commit 8edb7b2ab2
2 changed files with 13 additions and 0 deletions

View file

@ -117,6 +117,7 @@ impl Command for Whois {
account, account,
last_active, last_active,
signon, signon,
certfp,
) = { ) = {
let u = &s.users[&tuid]; let u = &s.users[&tuid];
( (
@ -134,6 +135,7 @@ impl Command for Whois {
u.account.clone(), u.account.clone(),
u.last_active, u.last_active,
u.signon, u.signon,
u.certfp.clone(),
) )
}; };
let chans: Vec<String> = keys let chans: Vec<String> = keys
@ -193,6 +195,16 @@ impl Command for Whois {
&format!("{nick} :is using a secure connection"), &format!("{nick} :is using a secure connection"),
); );
} }
// client-cert fingerprint (CertFP) — shown to the user themselves and opers
if let Some(fp) = &certfp {
if is_self || asker_oper {
s.numeric(
uid,
RPL_WHOISCERTFP,
&format!("{nick} :has client certificate fingerprint {fp}"),
);
}
}
// 317: idle time + signon time // 317: idle time + signon time
let idle = crate::server::now().saturating_sub(last_active); let idle = crate::server::now().saturating_sub(last_active);
s.numeric( s.numeric(

View file

@ -89,6 +89,7 @@ pub const RPL_WHOISACCOUNT: u16 = 330; // "<nick> <account> :is logged in as"
pub const ERR_NEEDREGGEDNICK: u16 = 477; // chan +R/+M — must be logged into an account pub const ERR_NEEDREGGEDNICK: u16 = 477; // chan +R/+M — must be logged into an account
pub const RPL_WHOISHOST: u16 = 378; // oper-only: real host/ip behind a cloak pub const RPL_WHOISHOST: u16 = 378; // oper-only: real host/ip behind a cloak
pub const RPL_WHOISSECURE: u16 = 671; // "is using a secure connection" (sslinfo) pub const RPL_WHOISSECURE: u16 = 671; // "is using a secure connection" (sslinfo)
pub const RPL_WHOISCERTFP: u16 = 276; // "has client certificate fingerprint <fp>"
pub const RPL_HOSTHIDDEN: u16 = 396; // "is now your displayed host" (cloak on/off) pub const RPL_HOSTHIDDEN: u16 = 396; // "is now your displayed host" (cloak on/off)
pub const RPL_CHANNELMODEIS: u16 = 324; pub const RPL_CHANNELMODEIS: u16 = 324;