Add declarative ssh known hosts
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -2,7 +2,16 @@
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
system,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
selfPkgs = inputs.self.packages.${system};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user} = {
|
||||
sops.secrets = {
|
||||
@@ -26,28 +35,36 @@
|
||||
}
|
||||
);
|
||||
|
||||
ssh.matchBlocks = {
|
||||
"github.com" = {
|
||||
hostname = "github.com";
|
||||
user = "git";
|
||||
identityFile = [
|
||||
"${home}/.ssh/ssh_sas_ed25519_key"
|
||||
"${home}/.ssh/ssh_personal_ed25519_key"
|
||||
];
|
||||
ssh = {
|
||||
matchBlocks = {
|
||||
"github.com" = {
|
||||
hostname = "github.com";
|
||||
user = "git";
|
||||
identityFile = [
|
||||
"${home}/.ssh/ssh_sas_ed25519_key"
|
||||
"${home}/.ssh/ssh_personal_ed25519_key"
|
||||
];
|
||||
};
|
||||
|
||||
"gitlab.sas.com" = {
|
||||
hostname = "gitlab.sas.com";
|
||||
user = "git";
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
};
|
||||
|
||||
"gerrit-svi.unx.sas.com" = {
|
||||
hostname = "gerrit-svi.unx.sas.com";
|
||||
user = "nikara";
|
||||
port = 29418;
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
};
|
||||
};
|
||||
|
||||
"gitlab.sas.com" = {
|
||||
hostname = "gitlab.sas.com";
|
||||
user = "git";
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
};
|
||||
|
||||
"gerrit-svi.unx.sas.com" = {
|
||||
hostname = "gerrit-svi.unx.sas.com";
|
||||
user = "nikara";
|
||||
port = 29418;
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
};
|
||||
userKnownHostsFiles = with selfPkgs; [
|
||||
ssh-known-hosts-github
|
||||
ssh-known-hosts-sas-gitlab
|
||||
ssh-known-hosts-sas-gerrit
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -2,13 +2,20 @@
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{ inputs, system, ... }:
|
||||
let
|
||||
selfPkgs = inputs.self.packages.${system};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user}.programs.ssh.matchBlocks = {
|
||||
"cldlgn.fyi.sas.com" = {
|
||||
inherit user;
|
||||
hostname = "cldlgn.fyi.sas.com";
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
home-manager.users.${user}.programs.ssh = {
|
||||
matchBlocks = {
|
||||
"cldlgn.fyi.sas.com" = {
|
||||
inherit user;
|
||||
hostname = "cldlgn.fyi.sas.com";
|
||||
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
|
||||
};
|
||||
};
|
||||
|
||||
userKnownHostsFiles = with selfPkgs; [ ssh-known-hosts-sas-cldlgn ];
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user