forked from hacc/haccfiles
wildcard dns with ACME
this is just me procrastinating … (not tested, not deployed – we don't actually own i4f.de)
This commit is contained in:
parent
9eed435ea3
commit
5e7c46a4e9
1 changed files with 19 additions and 11 deletions
|
@ -2,17 +2,6 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
shortdomain = "i4f.de";
|
shortdomain = "i4f.de";
|
||||||
short = name: target: {
|
|
||||||
inherit name target;
|
|
||||||
};
|
|
||||||
toVirtualHosts = {name, target, ...}: {
|
|
||||||
name = "${name}.${shortdomain}";
|
|
||||||
value = {
|
|
||||||
forceSSL = true;
|
|
||||||
enableACME = true;
|
|
||||||
locations."/".return = "302 https://${target}$request_uri";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
redirects = [
|
redirects = [
|
||||||
(short "d" "discuss.infra4future.de")
|
(short "d" "discuss.infra4future.de")
|
||||||
(short "m" "mattermost.infra4future.de")
|
(short "m" "mattermost.infra4future.de")
|
||||||
|
@ -20,8 +9,27 @@ let
|
||||||
(short "s" "survey.infra4future.de")
|
(short "s" "survey.infra4future.de")
|
||||||
(short "g" "gitlab.infra4future.de")
|
(short "g" "gitlab.infra4future.de")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
short = name: target: {
|
||||||
|
inherit name target;
|
||||||
|
};
|
||||||
|
toVirtualHosts = {name, target, ...}: {
|
||||||
|
name = "${name}.${shortdomain}";
|
||||||
|
value = {
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "*.i4f.de";
|
||||||
|
locations."/".return = "302 https://${target}$request_uri";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
security.acme.certs."wildcard.i4f.de" = {
|
||||||
|
domain = "*.i4f.de";
|
||||||
|
dnsProvider = "cloudflare";
|
||||||
|
credentialsFile = "/persist/var/shortdomains/dns-secrents.env";
|
||||||
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts =
|
services.nginx.virtualHosts =
|
||||||
lib.listToAttrs (map toVirtualHosts redirects)
|
lib.listToAttrs (map toVirtualHosts redirects)
|
||||||
// {
|
// {
|
||||||
|
|
Loading…
Reference in a new issue