agent ssh connections: declare per agent, render into the agent's ssh config
This commit is contained in:
parent
844fb0a219
commit
934da6f31f
1 changed files with 1420 additions and 12 deletions
|
|
@ -598,6 +598,30 @@ let
|
|||
&& !(lib.hasInfix "StrictHostKeyChecking no" conf)
|
||||
&& !(lib.hasInfix "hive-agent-ssh-cert" agentForgeNoBao.environment.etc."ssh/ssh_config".text);
|
||||
}
|
||||
{
|
||||
# The named connections reach `ssh` through an `Include` that comes
|
||||
# before everything else in the system config: an include below `Host *`
|
||||
# would sit inside that block, and ssh takes the first value it finds. The
|
||||
# directory and an empty file exist before the harness writes anything,
|
||||
# owned by the agent. An agent with no store has neither. Mutant: moving
|
||||
# the `Include` below `Host *`, or dropping the `f` rule, turns this red.
|
||||
name = "the ssh config includes the named connections first, and their file exists empty and agent-owned";
|
||||
ok =
|
||||
let
|
||||
conf = agentForgeBao.environment.etc."ssh/ssh_config".text;
|
||||
noBao = agentForgeNoBao.environment.etc."ssh/ssh_config".text;
|
||||
include = "Include /run/hive-agent-ssh-connections/config";
|
||||
rules = agentForgeBao.systemd.tmpfiles.rules;
|
||||
in
|
||||
lib.hasInfix include conf
|
||||
&& !(lib.hasInfix "Host" (lib.head (lib.splitString include conf)))
|
||||
&& !(lib.hasInfix "Match" (lib.head (lib.splitString include conf)))
|
||||
&& lib.hasInfix "Match exec" (lib.last (lib.splitString include conf))
|
||||
&& lib.elem "d /run/hive-agent-ssh-connections 0755 a1 a1 - -" rules
|
||||
&& lib.elem "f /run/hive-agent-ssh-connections/config 0600 a1 a1 - -" rules
|
||||
&& !(lib.hasInfix "hive-agent-ssh-connections" noBao)
|
||||
&& !(lib.any (lib.hasInfix "hive-agent-ssh-connections") agentForgeNoBao.systemd.tmpfiles.rules);
|
||||
}
|
||||
{
|
||||
# `ssh` runs the helper before it loads an identity, so the first `ssh`
|
||||
# after the operator's switch has a certificate. The line comes before the
|
||||
|
|
|
|||
Loading…
Reference in a new issue