Files
nix-config/home/base/tui/ssh.nix
T
Ryan Yin 1e6702db2c feat(mihomo): answer AAAA and keep the tailnet off the TUN
fake-ip needs one pool per family, and the family a client picks does not pick the
egress family. Exclude the cluster ULA and the Tailscale ranges from the TUN; the ssh
pin and the WA-028 record cover the fake-AAAA stall.
2026-10-09 18:34:04 +08:00

64 lines
1.9 KiB
Nix

{
config,
lib,
pkgs,
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" = {
# WA-028: pinned to IPv4 until the mihomo v6 fake-ip pool is proven here
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;
};
};
};
# Keep ~/.ssh/config a real, user-owned file rather than a /nix/store symlink.
#
# OpenSSH accepts a config owned by root or the invoking user, but
# bubblewrap-based sandboxes (`--unshare-user`) expose root-owned store files
# as `nobody`, which trips the check (`Bad owner or permissions`). Disabling
# the home.file entry keeps Home Manager's linker out of the way; `install`
# writes a fresh 0600 copy on each activation.
#
# Linux only: macOS' Seatbelt sandbox keeps store ownership intact, so the
# normal symlink is fine there.
home.file.".ssh/config".enable = lib.mkIf pkgs.stdenv.hostPlatform.isLinux false;
home.activation.sshConfigRegularFile = lib.mkIf pkgs.stdenv.hostPlatform.isLinux (
lib.hm.dag.entryAfter [ "linkGeneration" ] ''
run install -D -m 600 ${config.home.file.".ssh/config".source} "$HOME/.ssh/config"
''
);
}