summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorvin <vin@vineetk.net>2025-03-03 01:09:58 -0500
committervin <vin@vineetk.net>2025-03-03 01:54:53 -0500
commitffe481d03b085c5ff2fcd8a10b1e3eb08ac85d84 (patch)
treecd28230ea8e1803c4a6ae191d96e553d594f79fc /hosts
parentb68745626dc70679de417bf1ab61334bf00b530e (diff)
saklas: switch mail.nix to use agenix
Diffstat (limited to 'hosts')
-rw-r--r--hosts/saklas/default.nix73
-rw-r--r--hosts/saklas/mail.nix60
2 files changed, 68 insertions, 65 deletions
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}