nixos/middleman: Add script to deploy mailcow SSL certs

This commit is contained in:
Jack O'Sullivan 2023-08-27 00:58:55 +01:00
parent ea03795dca
commit f10ce00f04
5 changed files with 89 additions and 0 deletions

3
.keys/mail-vm-host.pub Normal file
View File

@ -0,0 +1,3 @@
mail.nul.ie ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAsMbpbTmXpN0TWn7/knSJxA5NMZ5mkNuEpGkrU2LzoK/0R+W785ANVgzXbsMGSAn7DzvlVgXiXfWWeK6kTX3YByGs4Qurt9FPN7YWrX++oJQxpPH3HQ0iu76+W9C3aXeAYEuvQoDmCFpxAv9ixWQNGfysFHP48QscyXY5htO1Q75YLV0W8kZ4aIZSJRLePBPsFC2mO/LsfyQ6jV6g5mgmMcYQW43D2kIU+EcvYE9ruHm3Ua0vI74afAV8ND9yv9WhE0uf+7sAlSj1i2JhT28OpxBHdN9HG1Tzt56UWRXkE82eupVvJ3cFe9Mlu9xQyz8w6yvRpi5pWVd1JtnB8UjetnQ/P8Zw2pR+XEMdG78kAZNM1E9ZOsCl80U0U4uawqlFA/M2Qak4y0KjS6d3ruSf/NWhqRAvPCxB878vPOSe+vksUrgfkp0kztH4XyEHydXKWifclgVNDz/+3XvooBQihljfecSDKUSiqqy4DqEcceBgEwL0kqvRd4ylKtYGCYE=
mail.nul.ie ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNrg7CJC2On7gYLpShEYy2AhhJfUYs0nOwLlQ9ua9KcrLxv1LZKI9vh18phtQpA+JCM2Fh+z9xpPwQ9YONYBD8Y=
mail.nul.ie ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJelp0F1tIqJNBZT4nmQjXxkIroDzVdh1c8aNd8F6N3X

1
.keys/mailcow-acme.pub Normal file
View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDe2AjrLdanqS8taaHZns/0KDmF2nYE2l5oGmUds4yhLoBMKV+YiTDdEeITa9w0+1X01urFQ3IHrzbKthelkzVuecHj4bU9KahbGB8oQaVIu5HGrbW1yGE+48eVGPbT/ooIHEvAw8nMp/uluF5KsaXbeXhyhGZHO4wEo40SFVgVpFg0UYKCgAJMdEADOuJY0af5HNNCbDiInDtNoPyP9SZYsjCXb567UoNwmRRd1Eb0hjFyYKT5WyxLqjG646wy/x0q9WitaODif8vNy0tWlf1ajOtBRa+FoXSM7kCwFbnXJAsal1Z6vsKE5R2qdFHF240u63NL0kCrJ3wDfH3odTG2Y47D70yZ8FaVemMUJ5CKrVnHnCi8wmQF6pq5W1NDoLO7qf1WRrrh8wCz9ocDE5YWvszUNgO3ZpA7BxxRO6RvFoRMQ3VFKBB49MyGbcfZ8nNgL+muynJDKF9Jp8jqR4Kk8ZAsKLqwSqLV0rB2nLRfzI4NL7wBxREy4VvhkSwyxNU= dev@castle

View File

@ -271,5 +271,9 @@ rec {
me = ../.keys/me.pub; me = ../.keys/me.pub;
deploy = ../.keys/deploy.pub; deploy = ../.keys/deploy.pub;
rsyncNet = ../.keys/zh2855.rsync.net.pub; rsyncNet = ../.keys/zh2855.rsync.net.pub;
mailcowAcme = ../.keys/mailcow-acme.pub;
};
sshHostKeys = {
mail-vm = ../.keys/mail-vm-host.pub;
}; };
} }

View File

@ -50,6 +50,11 @@ in
owner = "acme"; owner = "acme";
group = "acme"; group = "acme";
}; };
"middleman/mailcow-ssh.key" = {
owner = "acme";
group = "acme";
mode = "400";
};
"middleman/nginx-sso.yaml" = { "middleman/nginx-sso.yaml" = {
owner = "nginx-sso"; owner = "nginx-sso";
group = "nginx-sso"; group = "nginx-sso";
@ -175,11 +180,23 @@ in
]; ];
dnsProvider = "cloudflare"; dnsProvider = "cloudflare";
credentialsFile = config.age.secrets."middleman/cloudflare-credentials.conf".path; credentialsFile = config.age.secrets."middleman/cloudflare-credentials.conf".path;
postRun =
let
sshKey = config.age.secrets."middleman/mailcow-ssh.key".path;
in
''
${pkgs.openssh}/bin/scp -i ${sshKey} key.pem fullchain.pem acme@mail.nul.ie:/tmp/
${pkgs.openssh}/bin/ssh -i ${sshKey} acme@mail.nul.ie mailcow-ssl-reload
'';
}; };
}; };
}; };
}; };
programs = {
ssh.knownHostsFiles = [ lib.my.sshHostKeys.mail-vm ];
};
services = { services = {
netdata = { netdata = {
enable = true; enable = true;

View File

@ -0,0 +1,64 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyBVaHhs
SGhzV25ic1JMaS8xTW15NFh3UW43SWZkMUgwRkxYU3R0UXU2dVJrCjBDaEl0bXFI
N0VsZnZuaEFnNnlZaWRXRzNvZTB1b01uNVdKSHd1U1g5aEEKLT4gWDI1NTE5IDdZ
aGgwekJ5eXV1TUdySWhVSVNpWDlNWXNJUk5KcSs0K1laOFhHS2F4bWcKenptOXAw
dERXN05meWM5SllYb0xjVkVMaFlvYmhvWTlKT1M4WExPR29BTQotPiBqLWdyZWFz
ZQpCWkE4YmJDVVB5Qk1LS0VYTzV1d2VtdwotLS0gai8vaFBtUy82MWV1WDN1b2dC
SS9DTGxJNCtNWEx4YnIzU2FnSmNabllKMAqXJ9W+nbNcSr4YFj5wdgDUgJo0R5YM
DFmnEQqG0HPW/Eol2b7nivWp3LpI+0BJ/Cp7ZR3mp8ILWTsU9N4P5tHhQx0/uHTl
yE89H8uDWtDIQndOn22HK6Qfuq24rCdC/bRo+HPC0NWIuuePoDgKWkbOf7r/8EYO
lKf1Ff0RaEvnni97PPSo93eJwoa9KsLtlFHDwOPxgYzaR5n/TkyOkoGbIhN42LT3
yg8CmrQCYXnGxYE3ai/3nYsLQkXxLxWSwwzAJMaAUG/3WdpxxW9WLkmcjqbC+JIv
+ArN4AOnuG0BfvMLrcXy07W4+aaL7BD+xlOmwqRW8BhzJTzXDgsPQvOezD9Dv7sq
1pDwc8Oa/r8e+L0eqog/eYirkk/FwZfL++rCnIxwfELx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