From 9ae6d1611ef8cd8479235ac91272e694080b9d89 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Oct 2015 12:06:00 +0200 Subject: add github.com and its addrs4 to known_hosts --- krebs/3modules/default.nix | 7 +++++++ krebs/5pkgs/default.nix | 1 - krebs/5pkgs/github-known_hosts/default.nix | 13 ------------- krebs/5pkgs/github-known_hosts/github.ssh.pub | 1 - 4 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 krebs/5pkgs/github-known_hosts/default.nix delete mode 100644 krebs/5pkgs/github-known_hosts/github.ssh.pub (limited to 'krebs') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 430194405..eeb3acdcb 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -137,6 +137,13 @@ let mkIf (privkey != null) (mkForce [privkey]); services.openssh.knownHosts = + { + github = { + hostNames = ["github.com"] ++ + map (i: "192.30.252.${toString i}") (range 0 255); + publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; + }; + } // mapAttrs (name: host: { hostNames = diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index 7e136d96f..47e9341cc 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -13,7 +13,6 @@ rec { genid = callPackage ./genid {}; get = callPackage ./get {}; github-hosts-sync = callPackage ./github-hosts-sync {}; - github-known_hosts = callPackage ./github-known_hosts {}; hashPassword = callPackage ./hashPassword {}; jq = callPackage ./jq {}; krebszones = callPackage ./krebszones {}; diff --git a/krebs/5pkgs/github-known_hosts/default.nix b/krebs/5pkgs/github-known_hosts/default.nix deleted file mode 100644 index fe5efe413..000000000 --- a/krebs/5pkgs/github-known_hosts/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, ... }: - -with builtins; -with lib; - -let - github-pubkey = removeSuffix "\n" (readFile ./github.ssh.pub); -in - -toFile "github-known_hosts" - (concatMapStrings - (i: "github.com,192.30.252.${toString i} ${github-pubkey}\n") - (range 0 255)) diff --git a/krebs/5pkgs/github-known_hosts/github.ssh.pub b/krebs/5pkgs/github-known_hosts/github.ssh.pub deleted file mode 100644 index 90f6e2b71..000000000 --- a/krebs/5pkgs/github-known_hosts/github.ssh.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== -- cgit v1.2.3 From f1cc52aeaf6c18afb1c79c08914471ff73943a77 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Oct 2015 13:18:21 +0200 Subject: known_hosts: GitHub is 192.30.252.0/22 --- krebs/3modules/default.nix | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'krebs') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index eeb3acdcb..69613d4c3 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -137,13 +137,22 @@ let mkIf (privkey != null) (mkForce [privkey]); services.openssh.knownHosts = - { - github = { - hostNames = ["github.com"] ++ - map (i: "192.30.252.${toString i}") (range 0 255); - publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; - }; - } // + # GitHub's IPv4 address range is 192.30.252.0/22 + # Refs https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist/ + # 192.30.252.0/22 = 192.30.252.0-192.30.255.255 (1024 addresses) + # Because line length is limited by OPENSSH_LINE_MAX (= 8192), + # we split each /24 into its own entry. + listToAttrs (map + (c: { + name = "github${toString c}"; + value = { + hostNames = ["github.com"] ++ + map (d: "192.30.${toString c}.${toString d}") (range 0 255); + publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; + }; + }) + (range 252 255)) + // mapAttrs (name: host: { hostNames = -- cgit v1.2.3