removed next cloud
This commit is contained in:
parent
c4c84503f5
commit
769da44f84
|
@ -114,10 +114,6 @@
|
||||||
adguardhome = {
|
adguardhome = {
|
||||||
enable = false;
|
enable = false;
|
||||||
};
|
};
|
||||||
nextcloud = {
|
|
||||||
enable = false;
|
|
||||||
subdomain = "drive";
|
|
||||||
};
|
|
||||||
sync = {
|
sync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
folders = {
|
folders = {
|
||||||
|
|
|
@ -10,6 +10,5 @@
|
||||||
./searx.nix
|
./searx.nix
|
||||||
./home-assistant.nix
|
./home-assistant.nix
|
||||||
./adguardhome.nix
|
./adguardhome.nix
|
||||||
./nextcloud.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
@ -12,6 +13,41 @@ in {
|
||||||
|
|
||||||
config = lib.mkIf config.host.fail2ban.enable (lib.mkMerge [
|
config = lib.mkIf config.host.fail2ban.enable (lib.mkMerge [
|
||||||
{
|
{
|
||||||
|
environment.etc = {
|
||||||
|
"fail2ban/filter.d/nginx.local".text = lib.mkIf config.services.nginx.enable (
|
||||||
|
pkgs.lib.mkDefault (pkgs.lib.mkAfter ''
|
||||||
|
[Definition]
|
||||||
|
failregex = "limiting requests, excess:.* by zone.*client: <HOST>"
|
||||||
|
'')
|
||||||
|
);
|
||||||
|
"fail2ban/filter.d/jellyfin.local".text = lib.mkIf config.services.jellyfin.enable (
|
||||||
|
pkgs.lib.mkDefault (pkgs.lib.mkAfter ''
|
||||||
|
[Definition]
|
||||||
|
failregex = "^.*Authentication request for .* has been denied \\\(IP: \"<ADDR>\"\\\)\\\."
|
||||||
|
'')
|
||||||
|
);
|
||||||
|
"fail2ban/filter.d/forgejo.local".text = lib.mkIf config.services.forgejo.enable (
|
||||||
|
pkgs.lib.mkDefault (pkgs.lib.mkAfter ''
|
||||||
|
[Definition]
|
||||||
|
failregex = ".*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>"
|
||||||
|
'')
|
||||||
|
);
|
||||||
|
"fail2ban/filter.d/hass.local".text = lib.mkIf config.services.home-assistant.enable (
|
||||||
|
pkgs.lib.mkDefault (pkgs.lib.mkAfter ''
|
||||||
|
[INCLUDES]
|
||||||
|
before = common.conf
|
||||||
|
|
||||||
|
[Definition]
|
||||||
|
failregex = ^%(__prefix_line)s.*Login attempt or request with invalid authentication from <HOST>.*$
|
||||||
|
|
||||||
|
ignoreregex =
|
||||||
|
|
||||||
|
[Init]
|
||||||
|
datepattern = ^%%Y-%%m-%%d %%H:%%M:%%S
|
||||||
|
'')
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
services.fail2ban = {
|
services.fail2ban = {
|
||||||
enable = true;
|
enable = true;
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
|
@ -34,54 +70,40 @@ in {
|
||||||
};
|
};
|
||||||
jails = {
|
jails = {
|
||||||
nginx-iptables.settings = lib.mkIf config.services.nginx.enable {
|
nginx-iptables.settings = lib.mkIf config.services.nginx.enable {
|
||||||
|
enabled = true;
|
||||||
filter = "nginx";
|
filter = "nginx";
|
||||||
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
||||||
backend = "auto";
|
backend = "auto";
|
||||||
failregex = "limiting requests, excess:.* by zone.*client: <HOST>";
|
|
||||||
findtime = 600;
|
findtime = 600;
|
||||||
bantime = 600;
|
bantime = 600;
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
};
|
};
|
||||||
jellyfin-iptables.settings = lib.mkIf config.services.jellyfin.enable {
|
jellyfin-iptables.settings = lib.mkIf config.services.jellyfin.enable {
|
||||||
|
enabled = true;
|
||||||
filter = "jellyfin";
|
filter = "jellyfin";
|
||||||
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
||||||
logpath = "${config.services.jellyfin.dataDir}/log/*.log";
|
logpath = "${config.services.jellyfin.dataDir}/log/*.log";
|
||||||
backend = "auto";
|
backend = "auto";
|
||||||
failregex = "^.*Authentication request for .* has been denied \\\(IP: \"<ADDR>\"\\\)\\\.";
|
|
||||||
findtime = 600;
|
|
||||||
bantime = 600;
|
|
||||||
maxretry = 5;
|
|
||||||
};
|
|
||||||
nextcloud-iptables.settings = lib.mkIf config.services.nextcloud.enable {
|
|
||||||
filter = "nextcloud";
|
|
||||||
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
|
||||||
logpath = "${config.services.nextcloud.datadir}/*.log";
|
|
||||||
backend = "auto";
|
|
||||||
failregex = ''
|
|
||||||
^{"reqId":".*","remoteAddr":".*","app":"core","message":"Login failed: '.*' \(Remote IP: '<HOST>'\)","level":2,"time":".*"}$
|
|
||||||
^{"reqId":".*","level":2,"time":".*","remoteAddr":".*","user,:".*","app":"no app in context".*","method":".*","message":"Login failed: '.*' \(Remote IP: '<HOST>'\)".*}$
|
|
||||||
^{"reqId":".*","level":2,"time":".*","remoteAddr":".*","user":".*","app":".*","method":".*","url":".*","message":"Login failed: .* \(Remote IP: <HOST>\).*}$
|
|
||||||
'';
|
|
||||||
findtime = 600;
|
findtime = 600;
|
||||||
bantime = 600;
|
bantime = 600;
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
};
|
};
|
||||||
forgejo-iptables.settings = lib.mkIf config.services.forgejo.enable {
|
forgejo-iptables.settings = lib.mkIf config.services.forgejo.enable {
|
||||||
|
enabled = true;
|
||||||
filter = "forgejo";
|
filter = "forgejo";
|
||||||
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
||||||
logpath = "${config.services.forgejo.stateDir}/log/*.log";
|
logpath = "${config.services.forgejo.stateDir}/log/*.log";
|
||||||
backend = "auto";
|
backend = "auto";
|
||||||
failregex = ".*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>";
|
|
||||||
findtime = 600;
|
findtime = 600;
|
||||||
bantime = 600;
|
bantime = 600;
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
};
|
};
|
||||||
home-assistant-iptables.settings = lib.mkIf config.services.home-assistant.enable {
|
home-assistant-iptables.settings = lib.mkIf config.services.home-assistant.enable {
|
||||||
filter = "home-assistant";
|
enabled = true;
|
||||||
|
filter = "hass";
|
||||||
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
||||||
logpath = "${config.services.home-assistant.configDir}/*.log";
|
logpath = "${config.services.home-assistant.configDir}/*.log";
|
||||||
backend = "auto";
|
backend = "auto";
|
||||||
failregex = "^%(__prefix_line)s.*Login attempt or request with invalid authentication from <HOST>.*$";
|
|
||||||
findtime = 600;
|
findtime = 600;
|
||||||
bantime = 600;
|
bantime = 600;
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
dataDir = "/var/lib/nextcloud";
|
|
||||||
in {
|
|
||||||
options.host.nextcloud = {
|
|
||||||
enable = lib.mkEnableOption "should nextcloud be enabled on this computer";
|
|
||||||
subdomain = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "subdomain of base domain that nextcloud will be hosted at";
|
|
||||||
default = "nextcloud";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.host.nextcloud.enable (lib.mkMerge [
|
|
||||||
{
|
|
||||||
sops.secrets = {
|
|
||||||
"services/nextcloud_adminpass" = {
|
|
||||||
sopsFile = "${inputs.secrets}/defiant-services.yaml";
|
|
||||||
owner = config.users.users.nextcloud.name;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
host = {
|
|
||||||
reverse_proxy.subdomains.${config.host.nextcloud.subdomain} = {
|
|
||||||
target = "http://localhost:${toString 8009}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
nextcloud = {
|
|
||||||
enable = true;
|
|
||||||
package = pkgs.nextcloud31;
|
|
||||||
hostName = "${config.host.nextcloud.subdomain}.${config.host.reverse_proxy.hostname}";
|
|
||||||
settings.log_type = "file";
|
|
||||||
config = {
|
|
||||||
adminpassFile = config.sops.secrets."services/nextcloud_adminpass".path;
|
|
||||||
adminuser = "admin";
|
|
||||||
dbtype = "sqlite";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
(lib.mkIf config.host.impermanence.enable {
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = config.services.nextcloud.datadir == dataDir;
|
|
||||||
message = "nextcloud data directory does not match persistence";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.persistence."/persist/system/root" = {
|
|
||||||
enable = true;
|
|
||||||
hideMounts = true;
|
|
||||||
directories = [
|
|
||||||
{
|
|
||||||
directory = dataDir;
|
|
||||||
user = "nextcloud";
|
|
||||||
group = "nextcloud";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
Loading…
Reference in a new issue