Skip to main content

build_credential_warmup

Function build_credential_warmup 

Source
pub fn build_credential_warmup(
    tool: PrivilegeTool,
    password: &str,
) -> Option<String>
Expand description

What: Build a credential warm-up command that caches the password.

Inputs:

  • tool: Resolved privilege tool.
  • password: Cleartext password.

Output:

  • Some(cmd) for tools that support credential refresh (sudo).
  • None for tools that do not (doas).

Details:

  • For sudo: printf '%s\n' '<pass>' | sudo -S -v 2>/dev/null
  • Warms up the credential cache so subsequent sudo calls don’t re-prompt.