mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-22 15:24:03 +01:00
Only three secrets are readable as the login user (nix-access-tokens, ssh-key-romantic and the nushell one); everything else is root-only and the filesystem already keeps agents out.
45 lines
1.0 KiB
Nix
45 lines
1.0 KiB
Nix
{
|
|
config,
|
|
mysecrets,
|
|
...
|
|
}:
|
|
{
|
|
home.file.".ssh/romantic.pub".source = "${mysecrets}/public/romantic.pub";
|
|
|
|
programs.ssh = {
|
|
enable = true;
|
|
|
|
enableDefaultConfig = false;
|
|
settings."*" = {
|
|
ForwardAgent = false;
|
|
AddKeysToAgent = "yes";
|
|
Compression = true;
|
|
ServerAliveInterval = 0;
|
|
ServerAliveCountMax = 3;
|
|
HashKnownHosts = false;
|
|
UserKnownHostsFile = "~/.ssh/known_hosts";
|
|
ControlMaster = "no";
|
|
ControlPath = "~/.ssh/master-%r@%n:%p";
|
|
ControlPersist = "no";
|
|
};
|
|
|
|
settings = {
|
|
"github.com" = {
|
|
# avoid clash fake-IP6 hang, see modules/nixos/desktop/networking/clash-verge.nix
|
|
AddressFamily = "inet";
|
|
HostName = "ssh.github.com";
|
|
Port = 443;
|
|
User = "git";
|
|
IdentitiesOnly = true;
|
|
};
|
|
|
|
"192.168.*" = {
|
|
ForwardAgent = true;
|
|
# decrypted secret: AI agents must not read it
|
|
IdentityFile = "/etc/agenix/ssh-key-romantic";
|
|
IdentitiesOnly = true;
|
|
};
|
|
};
|
|
};
|
|
}
|