use clap::Subcommand;
#[derive(Debug, Subcommand)]
pub enum AgentAccountCommand {
#[command(after_help = HELP)]
Setup,
#[command(after_help = HELP)]
Status,
#[command(after_help = HELP)]
Remove,
}
pub const HELP: &str = "\
Windows only, a preview (ADR-129). From an administrator terminal, once:
openmoat agent-account setup creates the account and its network filters; takes a
while in a large profile; again, adds the filters to
an earlier setup that has none
Then from any terminal, as before:
openmoat run -- <agent> the agent runs as the account: Windows refuses its
writes outside the project, its reads of ~/.ssh, other
agents' logins and the rest the policy denies, and
every connection and listen but its proxy's
openmoat run --print-boundary -- <agent>
shows `agent_account`, `wfp_network` and
`windows_read_deny` in force, network `wfp_account`
Check: openmoat agent-account status (exit 1 when the system differs from the record)
Undo: openmoat agent-account remove (administrator terminal)
Guide: docs/USAGE.md, \"Run the agent as its own Windows account\"";
#[cfg(test)]
mod tests {
use clap::CommandFactory as _;
use crate::cli::Cli;
#[test]
fn the_help_shows_how_to_try_it() {
let mut command = Cli::command();
let group = command.find_subcommand_mut("agent-account").unwrap();
for name in ["setup", "status", "remove"] {
let help = group
.find_subcommand_mut(name)
.unwrap()
.render_long_help()
.to_string();
assert!(help.contains("openmoat agent-account setup"), "{help}");
assert!(help.contains("administrator terminal"), "{help}");
assert!(help.contains("docs/USAGE.md"), "{help}");
}
}
}