stockholm/kartei/makefu/default.nix

400 lines
11 KiB
Nix
Raw Normal View History

2018-09-15 22:32:35 +00:00
## generate keys with:
# tinc generate-keys
# ssh-keygen -f ssh.id_ed25519 -t ed25519 -C host
2023-06-10 10:50:53 +00:00
{ config, lib, ... }: let
inherit (builtins) foldl' mapAttrs pathExists readFile;
inherit (lib) optionalAttrs recursiveUpdate;
slib = import ../../lib/pure.nix { inherit lib; };
hostDefaults = hostName: host: foldl' recursiveUpdate {} [
{
ci = false;
owner = config.krebs.users.makefu;
}
# Retiolum defaults
(let
pubkey-path = ./retiolum + "/${hostName}.pub";
in optionalAttrs (pathExists pubkey-path) {
nets.retiolum = {
tinc.pubkey = readFile pubkey-path;
aliases = [
"${hostName}.r"
];
ip6.addr =
2023-06-10 10:50:53 +00:00
(slib.krebs.genipv6 "retiolum" "makefu" { inherit hostName; }).address;
};
})
# Retiolum ed25519 keys
(let
pubkey-path = ./retiolum + "/${hostName}_ed25519.pub";
in optionalAttrs (pathExists pubkey-path) {
nets.retiolum.tinc.pubkey_ed25519 = readFile pubkey-path;
})
# Wiregrill defaults
(let
pubkey-path = ./wiregrill + "/${hostName}.pub";
in optionalAttrs (pathExists pubkey-path) {
nets.wiregrill = {
aliases = [
"${hostName}.w"
];
ip6.addr =
2023-06-10 10:50:53 +00:00
(slib.krebs.genipv6 "wiregrill" "makefu" { inherit hostName; }).address;
wireguard.pubkey = readFile pubkey-path;
};
})
# SSHD defaults
(let
pubkey-path = ./sshd + "/${hostName}.pub";
in optionalAttrs (pathExists pubkey-path) {
ssh.pubkey = readFile pubkey-path;
# We assume that if the sshd pubkey exits then there must be a privkey in
# the screts store as well
ssh.privkey.path = "${config.krebs.secret.directory}/ssh_host_ed25519_key";
})
host
];
2018-09-24 21:33:42 +00:00
pub-for = name: builtins.readFile (./ssh + "/${name}.pub");
2023-06-10 10:50:53 +00:00
w6 = ip: (slib.krebs.genipv6 "wiregrill" "makefu" ip).address;
2018-09-24 21:33:42 +00:00
in {
hosts = mapAttrs hostDefaults {
2017-10-01 12:01:48 +00:00
cake = rec {
nets = {
retiolum.ip4.addr = "10.243.136.236";
2017-10-01 12:01:48 +00:00
};
};
2018-09-15 22:32:35 +00:00
crapi = rec { # raspi1
nets = {
retiolum.ip4.addr = "10.243.136.237";
2018-09-15 22:32:35 +00:00
};
};
firecracker = {
2017-02-12 19:13:45 +00:00
nets = {
retiolum.ip4.addr = "10.243.12.12";
2017-02-12 19:13:45 +00:00
};
2016-08-20 23:24:50 +00:00
};
2023-01-15 00:22:56 +00:00
snake = {
nets = {
retiolum.ip4.addr = "10.243.12.13";
};
};
2017-05-12 09:30:26 +00:00
studio = rec {
nets = {
retiolum.ip4.addr = "10.243.227.163";
2017-05-12 09:30:26 +00:00
};
};
2016-12-22 13:12:24 +00:00
fileleech = rec {
2017-02-12 19:13:45 +00:00
nets = {
retiolum.ip4.addr = "10.243.113.98";
2016-07-11 18:44:16 +00:00
};
};
tsp = {
nets = {
retiolum.ip4.addr = "10.243.0.212";
};
};
2023-08-17 18:42:53 +00:00
savarcast = rec {
2023-08-17 18:05:55 +00:00
nets = {
retiolum.ip4 = {
addr = "10.243.136.238";
2023-08-17 18:42:53 +00:00
};
retiolum.aliases = [
2023-08-17 18:05:55 +00:00
"sava.r"
];
};
};
2016-07-28 10:58:54 +00:00
x = {
2022-01-28 22:48:57 +00:00
syncthing.id = "OA36OF6-JEFCUJQ-OEYVTMH-DPCACQI-3AJRE5G-BFVMOUG-RPYJQE3-4ZCUWA5";
nets = {
retiolum.ip4.addr = "10.243.0.91";
wiregrill = {
2023-06-03 13:47:58 +00:00
ip4.addr = "10.243.245.6";
aliases = [ "x.w" ];
2016-06-23 14:45:44 +00:00
};
};
2015-12-14 13:33:06 +00:00
};
2015-11-06 09:59:40 +00:00
filepimp = rec {
nets = {
retiolum.ip4.addr = "10.243.153.102";
2015-11-06 09:59:40 +00:00
};
};
2015-12-16 11:06:44 +00:00
omo = rec {
2022-01-28 22:48:57 +00:00
syncthing.id = "Y5OTK3S-JOJLAUU-KTBXKUW-M7S5UEQ-MMQPUK2-7CXO5V6-NOUDLKP-PRGAFAK";
2015-12-16 11:06:44 +00:00
nets = {
2023-06-03 13:47:58 +00:00
wiregrill = {
aliases = ["omo.w" "hass.omo.w" "jelly.omo.w" "jelly.makefu.w" ];
2023-06-21 14:09:08 +00:00
ip6.addr = (slib.krebs.genipv6 "wiregrill" "makefu" { hostName = "omo"; }).address;
2023-06-03 13:47:58 +00:00
ip4.addr = "10.244.245.5";
};
2015-12-16 11:06:44 +00:00
retiolum = {
ip4.addr = "10.243.0.89";
2015-12-16 11:06:44 +00:00
aliases = [
"omo.r"
2018-11-05 15:22:39 +00:00
"dcpp.omo.r"
2024-01-14 20:47:32 +00:00
"hass.omo.r"
2022-06-06 19:17:10 +00:00
"backup.makefu.r"
2018-11-05 15:22:39 +00:00
"torrent.omo.r"
2022-10-30 07:51:18 +00:00
"music.omo.r"
"music.makefu.r"
2015-12-16 11:06:44 +00:00
];
};
};
};
2016-01-19 19:26:38 +00:00
wbob = rec {
nets = {
2016-02-17 09:51:26 +00:00
retiolum = {
ip4.addr = "10.243.214.15";
2016-01-19 19:26:38 +00:00
aliases = [
"wbob.r"
2018-02-26 17:59:43 +00:00
"hydra.wbob.r"
2019-06-14 23:05:01 +00:00
"log.wbob.r"
2016-01-19 19:26:38 +00:00
];
};
};
};
2022-12-12 18:43:38 +00:00
# pixel3a
telex.nets.wiregrill = {
aliases = ["telex.w"];
2023-06-10 10:50:53 +00:00
ip6.addr = (slib.krebs.genipv6 "wiregrill" "makefu" { hostName = "telex"; }).address;
2022-12-28 00:18:52 +00:00
ip4.addr = "10.244.245.4";
2022-12-12 18:43:38 +00:00
};
2022-02-15 21:29:33 +00:00
latte = rec {
extraZones = {
"krebsco.de" = ''
latte.euer IN A ${nets.internet.ip4.addr}
'';
};
nets = rec {
internet = {
ip4.addr = "178.254.30.202";
ip6.addr = "2a00:6800:3:18c::2";
aliases = [
"latte.i"
];
};
#wiregrill = {
# via = internet;
# ip4.addr = "10.244.245.1";
# ip6.addr = w6 "1";
# wireguard.port = 51821;
# wireguard.subnets = [
# (krebs.genipv6 "wiregrill" "makefu" 0).subnetCIDR
# "10.244.245.0/24" # required for routing directly to gum via rockit
# ];
#};
retiolum = {
via = internet;
ip4.addr = "10.243.0.214";
# never connect via gum (he eats your packets!)
#tinc.weight = 9001;
aliases = [
"latte.r"
2022-02-22 20:47:38 +00:00
"torrent.latte.r"
2022-02-15 21:29:33 +00:00
];
};
};
};
2018-11-05 15:22:39 +00:00
gum = rec {
extraZones = {
"krebsco.de" = ''
2022-06-06 19:17:10 +00:00
rss.euer IN A ${nets.internet.ip4.addr}
o.euer IN A ${nets.internet.ip4.addr}
bw.euer IN A ${nets.internet.ip4.addr}
2020-02-12 06:55:39 +00:00
bookmark.euer IN A ${nets.internet.ip4.addr}
boot IN A ${nets.internet.ip4.addr}
boot.euer IN A ${nets.internet.ip4.addr}
2024-05-31 15:26:06 +00:00
build.euer IN A ${nets.internet.ip4.addr}
cache.euer IN A ${nets.internet.ip4.addr}
cache.gum IN A ${nets.internet.ip4.addr}
cgit.euer IN A ${nets.internet.ip4.addr}
dl.euer IN A ${nets.internet.ip4.addr}
dns.euer IN A ${nets.internet.ip4.addr}
2020-02-12 06:55:39 +00:00
dockerhub IN A ${nets.internet.ip4.addr}
euer IN A ${nets.internet.ip4.addr}
euer IN MX 1 aspmx.l.google.com.
ghook IN A ${nets.internet.ip4.addr}
git.euer IN A ${nets.internet.ip4.addr}
gold IN A ${nets.internet.ip4.addr}
graph IN A ${nets.internet.ip4.addr}
gum IN A ${nets.internet.ip4.addr}
2020-02-12 06:55:39 +00:00
io IN NS gum.krebsco.de.
2018-09-15 22:32:35 +00:00
iso.euer IN A ${nets.internet.ip4.addr}
feed.euer IN A ${nets.internet.ip4.addr}
2020-03-13 09:51:34 +00:00
board.euer IN A ${nets.internet.ip4.addr}
etherpad.euer IN A ${nets.internet.ip4.addr}
2020-02-12 06:55:39 +00:00
mediengewitter IN CNAME over.dose.io.
2018-11-05 15:22:39 +00:00
mon.euer IN A ${nets.internet.ip4.addr}
netdata.euer IN A ${nets.internet.ip4.addr}
nixos.unstable IN CNAME krebscode.github.io.
photostore IN A ${nets.internet.ip4.addr}
pigstarter IN CNAME makefu.github.io.
2018-11-05 15:22:39 +00:00
share.euer IN A ${nets.internet.ip4.addr}
wg.euer IN A ${nets.internet.ip4.addr}
wiki.euer IN A ${nets.internet.ip4.addr}
2018-11-05 15:22:39 +00:00
wikisearch IN A ${nets.internet.ip4.addr}
2021-01-08 18:18:37 +00:00
meet.euer IN A ${nets.internet.ip4.addr}
work.euer IN A ${nets.internet.ip4.addr}
admin.work.euer IN A ${nets.internet.ip4.addr}
push.work.euer IN A ${nets.internet.ip4.addr}
api.work.euer IN A ${nets.internet.ip4.addr}
maps.work.euer IN A ${nets.internet.ip4.addr}
play.work.euer IN A ${nets.internet.ip4.addr}
ul.work.euer IN A ${nets.internet.ip4.addr}
2022-09-23 20:25:51 +00:00
music.euer IN A ${nets.internet.ip4.addr}
2023-06-03 13:47:58 +00:00
ntfy.euer IN A ${nets.internet.ip4.addr}
2024-01-14 20:47:32 +00:00
paper.euer IN A ${nets.internet.ip4.addr}
'';
};
2018-06-24 21:41:27 +00:00
nets = rec {
internet = {
2022-03-10 22:38:10 +00:00
ip4.addr = "142.132.189.140";
ip6.addr = "fe80::9400:1ff:fe24:33f4";
2018-06-24 21:41:27 +00:00
aliases = [
2018-11-05 15:22:39 +00:00
"gum.i"
2018-06-24 21:41:27 +00:00
];
};
wiregrill = {
via = internet;
2019-06-14 23:25:27 +00:00
ip4.addr = "10.244.245.1";
ip6.addr = w6 "1";
2019-06-14 23:05:01 +00:00
wireguard.port = 51821;
2019-06-14 23:25:27 +00:00
wireguard.subnets = [
2023-06-10 10:50:53 +00:00
(slib.krebs.genipv6 "wiregrill" "makefu" 0).subnetCIDR
2019-06-14 23:25:27 +00:00
"10.244.245.0/24" # required for routing directly to gum via rockit
];
};
2018-06-24 21:41:27 +00:00
retiolum = {
via = internet;
ip4.addr = "10.243.0.213";
# never connect via gum (he eats your packets!)
2022-02-15 21:29:33 +00:00
#tinc.weight = 9001;
2018-06-24 21:41:27 +00:00
aliases = [
"gum.r"
"blog.gum.r"
"blog.makefu.r"
"cache.gum.r"
"cgit.gum.r"
"dcpp.gum.r"
2018-09-24 21:33:42 +00:00
"dcpp.nextgum.r"
2021-11-30 21:00:34 +00:00
"graph.makefu.r"
"logs.makefu.r"
"netdata.makefu.r"
"nextgum.r"
2017-01-09 14:56:44 +00:00
"o.gum.r"
"search.makefu.r"
"stats.makefu.r"
"torrent.gum.r"
"tracker.makefu.r"
"wiki.gum.r"
"wiki.makefu.r"
2020-03-13 09:51:34 +00:00
"warrior.gum.r"
2021-09-05 19:15:06 +00:00
"rss.makefu.r"
2019-06-17 05:51:41 +00:00
"sick.makefu.r"
"dl.gum.r"
"dl.makefu.r"
];
};
};
};
2018-11-10 20:11:23 +00:00
2016-10-19 10:33:56 +00:00
sdev = rec {
nets = {
retiolum.ip4.addr = "10.243.83.237";
2016-10-19 10:33:56 +00:00
};
};
2017-02-12 19:13:45 +00:00
# non-stockholm
flap = rec {
extraZones = {
"krebsco.de" = ''
flap IN A ${nets.internet.ip4.addr}
'';
};
nets = {
internet = {
ip4.addr = "162.248.11.162";
aliases = [
"flap.i"
];
};
retiolum = {
ip4.addr = "10.243.211.172";
};
};
};
nukular = rec {
nets = {
retiolum = {
ip4.addr = "10.243.231.219";
};
};
};
2019-06-17 05:51:41 +00:00
shackdev = rec { # router@shack
nets.wiregrill.ip4.addr = "10.244.245.2";
};
2019-06-17 05:51:41 +00:00
2019-06-14 23:05:01 +00:00
rockit = rec { # router@home
2019-06-17 05:51:41 +00:00
nets.wiregrill.ip4.addr = "10.244.245.3";
2019-06-14 23:05:01 +00:00
};
2016-04-07 17:54:17 +00:00
senderechner = rec {
nets = {
retiolum = {
ip4.addr = "10.243.0.163";
2016-08-22 16:41:07 +00:00
};
2017-02-12 19:13:45 +00:00
};
2016-08-22 16:41:07 +00:00
};
};
users = rec {
makefu = {
mail = "makefu@x.r";
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.x";
pgp.pubkeys.default = builtins.readFile ./pgp/default.asc;
pgp.pubkeys.brain = builtins.readFile ./pgp/brain.asc;
2015-12-14 16:04:16 +00:00
};
2015-12-14 16:12:51 +00:00
makefu-omo = {
2016-03-16 07:35:06 +00:00
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.omo";
2015-12-14 16:04:16 +00:00
};
2015-12-14 16:12:51 +00:00
makefu-tsp = {
2016-03-16 07:35:06 +00:00
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.tsp";
2015-12-14 16:04:16 +00:00
};
2015-12-14 16:12:51 +00:00
makefu-vbob = {
2016-03-16 07:35:06 +00:00
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.vbob";
2015-12-14 16:12:51 +00:00
};
2017-02-04 13:35:29 +00:00
makefu-tempx = {
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.tempx";
2017-02-04 13:35:29 +00:00
};
2017-10-08 20:20:46 +00:00
makefu-android = {
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.android";
2017-10-08 20:20:46 +00:00
};
2018-02-14 00:33:05 +00:00
makefu-remote-builder = {
2018-02-14 07:12:06 +00:00
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.remote-builder";
2018-02-14 00:33:05 +00:00
};
makefu-bob = {
inherit (makefu) mail pgp;
2018-09-24 21:33:42 +00:00
pubkey = pub-for "makefu.bob";
};
};
}