2021-04-14 11:05:55 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
hostname = "procul";
|
2021-11-29 21:18:58 -08:00
|
|
|
|
2021-04-14 11:05:55 -07:00
|
|
|
host-ipv4 = "172.86.179.18";
|
2021-07-28 11:55:37 -07:00
|
|
|
git-ipv4 = "172.86.179.19";
|
2021-10-28 09:32:35 -07:00
|
|
|
domain-name = config.fudo.hosts.${hostname}.domain;
|
|
|
|
domain = config.fudo.domains.${domain-name};
|
|
|
|
site-name = config.fudo.hosts.${hostname}.site;
|
|
|
|
site = config.fudo.sites.${site-name};
|
|
|
|
host-fqdn = "${hostname}.${domain-name}";
|
2021-04-14 11:05:55 -07:00
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
local-networks =
|
|
|
|
domain.local-networks ++ site.local-networks;
|
2021-04-14 11:05:55 -07:00
|
|
|
|
|
|
|
local-packages = with pkgs; [ ldns.examples ];
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
secrets = config.fudo.secrets.host-secrets.procul;
|
|
|
|
|
2021-11-02 09:34:26 -07:00
|
|
|
passwd = pkgs.lib.fudo.passwd;
|
|
|
|
|
2021-04-14 11:05:55 -07:00
|
|
|
in {
|
|
|
|
networking = {
|
|
|
|
dhcpcd.enable = false;
|
|
|
|
useDHCP = false;
|
|
|
|
|
|
|
|
enableIPv6 = true;
|
|
|
|
|
|
|
|
# FIXME: this isn't the right place
|
2021-10-28 09:32:35 -07:00
|
|
|
search = [ domain-name ];
|
2021-04-14 11:05:55 -07:00
|
|
|
nameservers = [ "127.0.0.1" ];
|
2021-10-28 09:32:35 -07:00
|
|
|
defaultGateway = site.gateway-v4;
|
2021-04-14 11:05:55 -07:00
|
|
|
|
|
|
|
interfaces = {
|
|
|
|
extif0 = {
|
2021-07-28 11:55:37 -07:00
|
|
|
ipv4.addresses = [
|
|
|
|
{
|
|
|
|
address = host-ipv4;
|
|
|
|
prefixLength = 29;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
address = git-ipv4;
|
|
|
|
prefixLength = 29;
|
|
|
|
}
|
|
|
|
];
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = local-packages;
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
|
2021-07-29 22:54:59 -07:00
|
|
|
users = {
|
|
|
|
users = {
|
|
|
|
gituser = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "nogroup";
|
|
|
|
};
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
2021-07-29 22:54:59 -07:00
|
|
|
groups = { acme = { members = [ "nginx" ]; }; };
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
|
|
|
|
2021-04-15 22:15:31 -07:00
|
|
|
informis.cl-gemini = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
hostname = "gemini.informis.land";
|
|
|
|
server-ip = host-ipv4;
|
|
|
|
document-root = "/srv/gemini/root";
|
|
|
|
textfiles-archive = "${pkgs.textfiles}";
|
|
|
|
slynk-port = 4005;
|
|
|
|
|
|
|
|
feeds = {
|
|
|
|
viator = {
|
|
|
|
title = "viator's phlog";
|
|
|
|
path = "/home/viator/gemini-public/feed/";
|
|
|
|
url = "gemini://informis.land/user/viator/feed/";
|
|
|
|
};
|
2021-04-21 10:34:46 -07:00
|
|
|
};
|
2021-04-15 22:15:31 -07:00
|
|
|
};
|
|
|
|
|
2021-04-14 11:05:55 -07:00
|
|
|
fudo = {
|
2021-04-15 22:15:31 -07:00
|
|
|
hosts.procul.external-interfaces = [ "extif0" ];
|
2021-04-21 10:34:46 -07:00
|
|
|
|
2021-11-29 21:18:58 -08:00
|
|
|
acme.host-domains.${hostname}.${host-fqdn}.local-copies = {
|
|
|
|
postgresql = {
|
|
|
|
user = postgresql-user;
|
|
|
|
dependent-services = [ "postgresql.service" ];
|
|
|
|
part-of = [ config.fudo.postgresql.systemd-target ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-19 12:47:26 -07:00
|
|
|
secrets.host-secrets.procul = let
|
2021-11-02 09:34:26 -07:00
|
|
|
files = config.fudo.secrets.files;
|
2021-10-19 12:47:26 -07:00
|
|
|
in {
|
2021-04-22 11:38:52 -07:00
|
|
|
postgres-keytab = {
|
2021-11-02 09:34:26 -07:00
|
|
|
source-file = files.service-keytabs.procul.postgres;
|
2021-04-22 11:38:52 -07:00
|
|
|
target-file = "/srv/postgres/secure/postgres.keytab";
|
|
|
|
user = "root";
|
|
|
|
};
|
|
|
|
|
|
|
|
gitea-database-password = {
|
2021-11-02 09:34:26 -07:00
|
|
|
source-file = files.service-passwords.procul.gitea-database;
|
2021-04-22 11:38:52 -07:00
|
|
|
target-file = "/srv/gitea/secure/database.passwd";
|
|
|
|
user = config.fudo.git.user;
|
|
|
|
};
|
2021-11-13 10:30:58 -08:00
|
|
|
|
|
|
|
heimdal-master-key = {
|
|
|
|
source-file = files.realm-master-keys."INFORMIS.LAND";
|
|
|
|
target-file = "/run/heimdal/master-key";
|
|
|
|
user = config.fudo.auth.kdc.user;
|
|
|
|
};
|
2021-04-21 10:34:46 -07:00
|
|
|
};
|
|
|
|
|
2021-04-14 11:05:55 -07:00
|
|
|
client.dns = {
|
|
|
|
ipv4 = true;
|
|
|
|
ipv6 = true;
|
|
|
|
user = "fudo-client";
|
|
|
|
external-interface = "extif0";
|
|
|
|
};
|
|
|
|
|
2021-11-13 10:30:58 -08:00
|
|
|
auth.kdc.master-key-file = secrets.heimdal-master-key.target-file;
|
2021-04-14 11:05:55 -07:00
|
|
|
|
|
|
|
secure-dns-proxy = {
|
|
|
|
enable = true;
|
|
|
|
upstream-dns =
|
|
|
|
[ "https://1.1.1.1/dns-query" "https://1.0.0.1/dns-query" ];
|
|
|
|
bootstrap-dns = "1.1.1.1";
|
|
|
|
listen-ips = [ "127.0.0.1" ];
|
|
|
|
listen-port = 53;
|
|
|
|
allowed-networks = [ "1.1.1.1/32" "1.0.0.1/32" "localhost" "link-local" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
mail-server = {
|
|
|
|
enable = true;
|
|
|
|
debug = true;
|
|
|
|
|
2021-10-28 09:32:35 -07:00
|
|
|
domain = domain-name;
|
2021-11-05 07:06:08 -07:00
|
|
|
mail-hostname = "${host-fqdn}";
|
2021-04-14 11:05:55 -07:00
|
|
|
monitoring = false;
|
|
|
|
mail-user = "mailuser";
|
|
|
|
mail-user-id = 525;
|
|
|
|
mail-group = "mailgroup";
|
|
|
|
clamav.enable = true;
|
|
|
|
dkim.signing = true;
|
|
|
|
|
|
|
|
dovecot = {
|
2021-10-28 09:32:35 -07:00
|
|
|
ssl-certificate = acme-certificate "imap.${domain-name}";
|
|
|
|
ssl-private-key = acme-private-key "imap.${domain-name}";
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
postfix = {
|
2021-10-28 09:32:35 -07:00
|
|
|
ssl-certificate = acme-certificate "smtp.${domain-name}";
|
|
|
|
ssl-private-key = acme-private-key "smtp.${domain-name}";
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
# This should NOT include the primary domain
|
2021-10-28 09:32:35 -07:00
|
|
|
local-domains = [ host-fqdn "smtp.${domain-name}" ];
|
2021-04-14 11:05:55 -07:00
|
|
|
|
|
|
|
mail-directory = "/srv/mailserver/mail";
|
|
|
|
state-directory = "/srv/mailserver/state";
|
|
|
|
|
2021-04-21 10:34:46 -07:00
|
|
|
trusted-networks = [ "172.86.179.16/29" "127.0.0.0/16" ];
|
2021-04-14 11:05:55 -07:00
|
|
|
|
|
|
|
alias-users = {
|
2021-04-21 10:34:46 -07:00
|
|
|
root = [ "niten" ];
|
|
|
|
postmaster = [ "niten" ];
|
|
|
|
hostmaster = [ "niten" ];
|
|
|
|
webmaster = [ "niten" ];
|
|
|
|
system = [ "niten" ];
|
|
|
|
admin = [ "niten" ];
|
|
|
|
dmarc-report = [ "niten" ];
|
2021-04-14 11:05:55 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-11-29 21:18:58 -08:00
|
|
|
postgresql = let
|
|
|
|
cert-copy = config.fudo.acme.host-domains.${hostname}.${host-fqdn}.local-copies.postgresql;
|
|
|
|
in {
|
2021-04-14 11:05:55 -07:00
|
|
|
enable = true;
|
2021-11-29 21:18:58 -08:00
|
|
|
ssl-certificate = cert-copy.full-certificate;
|
|
|
|
ssl-private-key = cert-copy.private-key;
|
2021-10-28 09:32:35 -07:00
|
|
|
keytab = secrets.postgres-keytab.target-file;
|
2021-04-14 11:05:55 -07:00
|
|
|
local-networks = local-networks;
|
|
|
|
|
|
|
|
users = {
|
|
|
|
gituser = {
|
2021-04-22 11:38:52 -07:00
|
|
|
password-file =
|
2021-10-28 09:32:35 -07:00
|
|
|
secrets.gitea-database-password.target-file;
|
2021-04-14 11:05:55 -07:00
|
|
|
databases = {
|
|
|
|
git = {
|
|
|
|
access = "CONNECT";
|
|
|
|
entity-access = {
|
|
|
|
"ALL TABLES IN SCHEMA public" = "SELECT,INSERT,UPDATE,DELETE";
|
|
|
|
"ALL SEQUENCES IN SCHEMA public" = "SELECT, UPDATE";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
databases = { git = { users = [ "niten" ]; }; };
|
|
|
|
};
|
|
|
|
|
|
|
|
git = {
|
|
|
|
enable = true;
|
|
|
|
hostname = "git.informis.land";
|
|
|
|
site-name = "informis git";
|
|
|
|
user = "gituser";
|
2021-11-13 10:30:58 -08:00
|
|
|
repository-dir = "/srv/git/repo";
|
|
|
|
state-dir = "/srv/git/state";
|
2021-04-14 11:05:55 -07:00
|
|
|
database = {
|
|
|
|
user = "gituser";
|
2021-04-22 11:38:52 -07:00
|
|
|
password-file =
|
2021-10-28 09:32:35 -07:00
|
|
|
secrets.gitea-database-password.target-file;
|
2021-04-14 11:05:55 -07:00
|
|
|
hostname = "127.0.0.1";
|
|
|
|
name = "git";
|
|
|
|
};
|
|
|
|
ssh = {
|
|
|
|
listen-ip = host-ipv4;
|
|
|
|
listen-port = 2222;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
acme = {
|
|
|
|
enable = true;
|
2021-10-28 09:32:35 -07:00
|
|
|
admin-address = "admin@${domain-name}";
|
2021-04-14 11:05:55 -07:00
|
|
|
hostnames = [
|
|
|
|
"informis.land"
|
|
|
|
"imap.informis.land"
|
|
|
|
"smtp.informis.land"
|
|
|
|
"gemini.informis.land"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|