summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix6
-rw-r--r--hosts/saklas/default.nix73
-rw-r--r--hosts/saklas/mail.nix60
-rw-r--r--secrets/email_13f0.agebin0 -> 383 bytes
-rw-r--r--secrets/email_vinbiz.age7
-rw-r--r--secrets/email_vineetk.agebin0 -> 383 bytes
-rw-r--r--secrets/secrets.nix14
7 files changed, 88 insertions, 72 deletions
diff --git a/flake.nix b/flake.nix
index 6215a8c..e9a6e57 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,7 +21,7 @@
21 agenix.url = "github:ryantm/agenix"; 21 agenix.url = "github:ryantm/agenix";
22 }; 22 };
23 23
24 outputs = { self, home-manager, nixpkgs, nixpkgs-stable, everblush-gtk, simple-nixos-mailserver, agenix, ... }@inputs: { 24 outputs = { self, home-manager, nixpkgs, nixpkgs-stable, everblush-gtk, agenix, simple-nixos-mailserver, ... }@inputs: {
25 # TODO: deduplicate this 25 # TODO: deduplicate this
26 nixosConfigurations = { 26 nixosConfigurations = {
27 demiurge = nixpkgs.lib.nixosSystem { 27 demiurge = nixpkgs.lib.nixosSystem {
@@ -48,6 +48,7 @@
48 specialArgs = inputs; 48 specialArgs = inputs;
49 modules = [ 49 modules = [
50 ./hosts/lappy 50 ./hosts/lappy
51 agenix.nixosModules.default
51 52
52 home-manager.nixosModules.home-manager { 53 home-manager.nixosModules.home-manager {
53 home-manager.extraSpecialArgs = { 54 home-manager.extraSpecialArgs = {
@@ -66,7 +67,8 @@
66 specialArgs = inputs; 67 specialArgs = inputs;
67 modules = [ 68 modules = [
68 ./hosts/saklas 69 ./hosts/saklas
69 simple-nixos-mailserver.nixosModules.default ./hosts/saklas/mail.nix 70 agenix.nixosModules.default
71 simple-nixos-mailserver.nixosModule
70 ]; 72 ];
71 }; 73 };
72 }; 74 };
diff --git a/hosts/saklas/default.nix b/hosts/saklas/default.nix
index 8948ed4..0a3e91c 100644
--- a/hosts/saklas/default.nix
+++ b/hosts/saklas/default.nix
@@ -7,6 +7,10 @@
7 7
8 # decrypt agenix secrets 8 # decrypt agenix secrets
9 age.secrets = { 9 age.secrets = {
10 email_vinbiz.file = ../../secrets/email_vinbiz.age;
11 email_vineetk.file = ../../secrets/email_vineetk.age;
12 email_13f0.file = ../../secrets/email_13f0.age;
13
10 hetzner_dns = { 14 hetzner_dns = {
11 file = ../../secrets/hetzner_dns.age; 15 file = ../../secrets/hetzner_dns.age;
12 owner = "root"; 16 owner = "root";
@@ -18,14 +22,13 @@
18 owner = "radicale"; 22 owner = "radicale";
19 }; 23 };
20 24
21 tailscale_demiurge = { 25 tailscale_saklas = {
22 file = ../../secrets/tailscale_saklas.age; 26 file = ../../secrets/tailscale_saklas.age;
23 owner = "root"; 27 owner = "root";
24 group = "root"; 28 group = "root";
25 }; 29 };
26 }; 30 };
27 31
28
29 # disable wifi and open some ports 32 # disable wifi and open some ports
30 networking = { 33 networking = {
31 hostName = "saklas"; 34 hostName = "saklas";
@@ -36,7 +39,7 @@
36 39
37 firewall = { 40 firewall = {
38 allowedTCPPorts = [ 22 80 443 ]; 41 allowedTCPPorts = [ 22 80 443 ];
39 allowedUDPPorts = [ 3478 41641 51820 ]; 42 allowedUDPPorts = [ 3478 51820 ];
40 }; 43 };
41 }; 44 };
42 45
@@ -158,7 +161,7 @@
158 161
159 tailscale = { 162 tailscale = {
160 enable = true; 163 enable = true;
161 authKeyFile = config.age.secrets.tailscale_demiurge.path; 164 authKeyFile = config.age.secrets.tailscale_saklas.path;
162 extraDaemonFlags = [ "--no-logs-no-support" ]; 165 extraDaemonFlags = [ "--no-logs-no-support" ];
163 extraUpFlags = [ "--login-server=https://headscale.13f0.net" ]; 166 extraUpFlags = [ "--login-server=https://headscale.13f0.net" ];
164 openFirewall = true; 167 openFirewall = true;
@@ -232,7 +235,7 @@
232 server.hosts = [ "127.0.0.1:5232" ]; 235 server.hosts = [ "127.0.0.1:5232" ];
233 auth = { 236 auth = {
234 type = "htpasswd"; 237 type = "htpasswd";
235 htpasswd_filename = "/etc/radicale/users"; 238 htpasswd_filename = config.age.secrets.radicale_users.path;
236 htpasswd_encryption = "bcrypt"; 239 htpasswd_encryption = "bcrypt";
237 }; 240 };
238 }; 241 };
@@ -269,6 +272,66 @@
269 }; 272 };
270 }; 273 };
271 274
275 # email via simple-nixos-mailserver
276 mailserver = {
277 enable = true;
278 fqdn = "mail.vineetk.net";
279 domains = [ "vineetk.net" "vinbiz.ca" "13f0.net" ];
280
281 # A list of all login accounts. To create the password hashes, use
282 # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
283 loginAccounts = {
284 "vineet@vineetk.net" = {
285 hashedPasswordFile = config.age.secrets.email_vineetk.path;
286 aliases = ["@vineetk.net"];
287 };
288
289 "kar@13f0.net" = {
290 hashedPasswordFile = config.age.secrets.email_13f0.path;
291 aliases = ["@13f0.net"];
292 sieveScript = ''
293require [ "fileinto", "mailbox" ];
294
295if address :matches [ "to", "cc" ] "announce@openbsd.org" {
296 fileinto :create "openbsd_announce";
297 stop;
298}
299if address :matches [ "to", "cc" ] "arm@openbsd.org" {
300 fileinto :create "openbsd_arm";
301 stop;
302}
303if address :matches [ "to", "cc" ] "misc@openbsd.org" {
304 fileinto :create "openbsd_misc";
305 stop;
306}
307if address :matches [ "to", "cc" ] "misc@opensmtpd.org" {
308 fileinto :create "opensmtpd_misc";
309 stop;
310}
311if address :matches [ "to", "cc" ] "oss-security@lists.openwall.com" {
312 fileinto :create "oss_security";
313 stop;
314}
315if address :matches [ "to", "cc" ] "tuhs@tuhs.org" {
316 fileinto :create "tuhs";
317 stop;
318}
319 '';
320 };
321
322 "vineet@vinbiz.ca" = {
323 hashedPasswordFile = config.age.secrets.email_vinbiz.path;
324 aliases = ["postmaster@vinbiz.ca"];
325 };
326 "suresh@vinbiz.ca".hashedPasswordFile = config.age.secrets.email_vinbiz.path;
327 "revathy@vinbiz.ca".hashedPasswordFile = config.age.secrets.email_vinbiz.path;
328 "suren@vinbiz.ca".hashedPasswordFile = config.age.secrets.email_vinbiz.path;
329 };
330
331 acmeCertificateName = "vineetk.net";
332 certificateScheme = "acme";
333 };
334
272 # create caches and use mandoc 335 # create caches and use mandoc
273 documentation.man = { 336 documentation.man = {
274 enable = true; 337 enable = true;
diff --git a/hosts/saklas/mail.nix b/hosts/saklas/mail.nix
deleted file mode 100644
index a43f194..0000000
--- a/hosts/saklas/mail.nix
+++ /dev/null
@@ -1,60 +0,0 @@
1{
2 mailserver = {
3 enable = true;
4 fqdn = "mail.vineetk.net";
5 domains = [ "vineetk.net" "vinbiz.ca" "13f0.net" ];
6
7 # A list of all login accounts. To create the password hashes, use
8 # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
9 loginAccounts = {
10 "vineet@vineetk.net" = {
11 hashedPassword = "$2b$05$7chAoNcCtw8ajVQYjmb7T.JLcOjtlVsS/LipIvc3LY4/qUPrFTP/.";
12 aliases = ["@vineetk.net"];
13 };
14
15 "kar@13f0.net" = {
16 hashedPassword = "$2b$05$w0rQk32VTQ8YMPQa.Mb28eX8zmYpDqI9FMPShQ7o2tYVzpbtvEyPq";
17 aliases = ["@13f0.net"];
18 sieveScript = ''
19require [ "fileinto", "mailbox" ];
20
21if address :matches [ "to", "cc" ] "announce@openbsd.org" {
22 fileinto :create "openbsd_announce";
23 stop;
24}
25if address :matches [ "to", "cc" ] "arm@openbsd.org" {
26 fileinto :create "openbsd_arm";
27 stop;
28}
29if address :matches [ "to", "cc" ] "misc@openbsd.org" {
30 fileinto :create "openbsd_misc";
31 stop;
32}
33if address :matches [ "to", "cc" ] "misc@opensmtpd.org" {
34 fileinto :create "opensmtpd_misc";
35 stop;
36}
37if address :matches [ "to", "cc" ] "oss-security@lists.openwall.com" {
38 fileinto :create "oss_security";
39 stop;
40}
41if address :matches [ "to", "cc" ] "tuhs@tuhs.org" {
42 fileinto :create "tuhs";
43 stop;
44}
45 '';
46 };
47
48 "vineet@vinbiz.ca" = {
49 hashedPassword = "$2b$05$lyCFvoxfoJX8jtI3FsePLenhcIn.hqN53twq/zJ316f4WHQJeUji6";
50 aliases = ["postmaster@vinbiz.ca"];
51 };
52 "suresh@vinbiz.ca".hashedPassword = "$2b$05$Vpqk62qIbRsFQipSd2aA0.EqL011nSmhA6VD.YjjfoYbO3zZVybDS";
53 "revathy@vinbiz.ca".hashedPassword = "$2b$05$RkABB76JTCNa0cotOfS28..mJME7a/A4gaTRpZnSdTJi3wr2X3t.C";
54 "suren@vinbiz.ca".hashedPassword = "$2b$05$.VTHKaBu0JQf2MpLNa7GXeliyZxOdXms59VslMmEjnu.IOzjVgHzy";
55 };
56
57 acmeCertificateName = "vineetk.net";
58 certificateScheme = "acme";
59 };
60}
diff --git a/secrets/email_13f0.age b/secrets/email_13f0.age
new file mode 100644
index 0000000..7fb7410
--- /dev/null
+++ b/secrets/email_13f0.age
Binary files differ
diff --git a/secrets/email_vinbiz.age b/secrets/email_vinbiz.age
new file mode 100644
index 0000000..041f2e9
--- /dev/null
+++ b/secrets/email_vinbiz.age
@@ -0,0 +1,7 @@
1age-encryption.org/v1
2-> ssh-ed25519 AaF/mQ XcNpUXvbz6PsCgeEZMf1+yMrjIipzsesAKO+EssReTw
3EcDIICNjeS3KKev0qK/0v7V/86QdOWYNaTyFDFE435I
4-> ssh-ed25519 hc2ELA rO5kM81Uk4G5bowyCzGUZdBvqxvcNctjdrD1+Tfk8VY
51ef+BiIAJFFKpNAPb2QHHzrxTAyNyj7Hc/nArculdsc
6--- TrgPJhsRCmQuOl9m51XUHnhV+pBlbj0iYgzXUojgjTw
7cm/(,{W}yxAՙT^\#W-ČO4dϑd[Ce0 .v\q& \ No newline at end of file
diff --git a/secrets/email_vineetk.age b/secrets/email_vineetk.age
new file mode 100644
index 0000000..c42b4a6
--- /dev/null
+++ b/secrets/email_vineetk.age
Binary files differ
diff --git a/secrets/secrets.nix b/secrets/secrets.nix
index ff90585..69036d5 100644
--- a/secrets/secrets.nix
+++ b/secrets/secrets.nix
@@ -7,9 +7,13 @@ let
7 systems = [ demiurge saklas ]; 7 systems = [ demiurge saklas ];
8in 8in
9{ 9{
10 "hetzner_dns.age".publicKeys = users ++ systems; 10 "email_vinbiz.age".publicKeys = users ++ [ saklas ];
11 "radicale_users.age".publicKeys = users ++ systems; 11 "email_vineetk.age".publicKeys = users ++ [ saklas ];
12 "smallstep.age".publicKeys = users ++ systems; 12 "email_13f0.age".publicKeys = users ++ [ saklas ];
13 "tailscale_demiurge.age".publicKeys = users ++ systems; 13
14 "tailscale_saklas.age".publicKeys = users ++ systems; 14 "hetzner_dns.age".publicKeys = users ++ [ saklas ];
15 "radicale_users.age".publicKeys = users ++ [ saklas ];
16 "smallstep.age".publicKeys = users ++ [ demiurge ];
17 "tailscale_demiurge.age".publicKeys = users ++ [ demiurge ];
18 "tailscale_saklas.age".publicKeys = users ++ [ saklas ];
15} 19}