blob: 95e03e4d6ac8a2f3080ce3f2f35e11e4f48a850b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
{
pkgs,
lib,
config,
...
}:
{
imports = [
./firewall.nix
./disko.nix
./vm.nix
./hardware-configuration.nix
../../services/mysql.nix
../../services/email.nix
../../services/vaultwarden.nix
../../services/uptimekuma.nix
../../services/freshrss.nix
../../services/wakapi.nix
];
addons = {
desktop.hyprland.enable = lib.mkForce false;
# desktop.cosmic.enable = lib.mkForce false;
desktop.xfce.enable = lib.mkForce false;
gpg.enable = true;
virtualisation.guest = true;
};
boot.loader.grub = {
enable = true;
efiSupport = false;
};
environment.systemPackages = with pkgs; [
lynx
chawan
];
wilkuu.services =
let
isVM = config.addons.virtualisation.isTestVM;
in
{
stalwart = {
enable = true;
domain = if isVM then "mail.omega-relay.local" else "mail.wilkuu.xyz";
doACME = !isVM;
};
vaultwarden = {
enable = true;
signupWhitelist = [
"wilkuu.xyz"
"omega-relay.local"
];
backupDir = "/srv/data/vaultwarden";
domain = if isVM then "bitwarden.omega-relay.local" else "bitwarden.wilkuu.xyz";
doACME = !isVM;
};
uptimekuma = {
enable = true;
domain = if isVM then "uptime.omega-relay.local" else "uptime.wilkuu.xyz";
dataDir = "/srv/data/uptimekuma";
doACME = !isVM;
};
freshrss = {
enable = true;
domain = if isVM then "rss.omega-relay.local" else "rss.wilkuu.xyz";
doACME = !isVM;
};
wakapi = {
enable = false;
domain = if isVM then "wakapi.omega-relay.local" else "wakapi.wilkuu.xyz";
doACME = !isVM;
};
};
services.fail2ban = {
enable = true;
maxretry = 5;
ignoreIP = [
"192.168.80.0/24"
"192.168.80.0/24"
];
bantime = "24h";
bantime-increment = {
enable = true; # Enable increment of bantime after each violation
formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)";
# multipliers = "1 2 4 8 16 32 64";
maxtime = "168h"; # Do not ban for more than 1 week
overalljails = true; # Calculate the bantime based on all the violations
};
};
# TODO: Make a nginx module
security.acme = lib.mkIf (!config.addons.virtualisation.isTestVM) {
acceptTerms = true;
defaults.email = "jstachurski9991@gmail.com";
};
services.nginx =
let
isVM = config.addons.virtualisation.isTestVM;
domain = if isVM then "omega-relay.local" else "wilkuu.xyz";
in
{
enable = true;
virtualHosts."${domain}" = {
enableACME = !isVM;
addSSL = !isVM;
root = "/srv/www/wilkuu.xyz/";
locations."/" = {
index = "index.html";
tryFiles = "$uri $uri/ =404";
};
};
};
networking.hostName = "omega-relay";
services.resolved = {
enable = true;
dnsovertls = "opportunistic";
};
services.openssh = {
enable = true;
ports = [ 22 ];
openFirewall = true;
allowSFTP = true;
settings = {
PasswordAuthentication = false;
AllowUsers = [ "wilkuu" ];
X11Forwarding = false;
PermitRootLogin = "no";
PrintMotd = true;
};
};
}
|