148 lines
No EOL
4.4 KiB
Nix
Executable file
148 lines
No EOL
4.4 KiB
Nix
Executable file
# hosts/buer/configuration.nix (or default.nix)
|
|
{ config, lib, pkgs, modulesPath, inputs, ... }:
|
|
{
|
|
# =============================================================================
|
|
# IMPORTS
|
|
# =============================================================================
|
|
imports = [
|
|
# Host-specific hardware
|
|
./hardware.nix
|
|
./secrets.nix
|
|
|
|
# Common modules shared across hosts
|
|
../../common/system.nix
|
|
../../common/users.nix
|
|
../../common/services.nix
|
|
|
|
# Common secrets
|
|
../../host-secrets.nix
|
|
];
|
|
|
|
# =============================================================================
|
|
# SYSTEM CONFIGURATION
|
|
# =============================================================================
|
|
system.stateVersion = "24.11";
|
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
|
|
# Intel microcode updates
|
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault
|
|
config.hardware.enableRedistributableFirmware;
|
|
|
|
# =============================================================================
|
|
# CUSTOM MODULES
|
|
# =============================================================================
|
|
modules.garage.enable = true;
|
|
modules.seaweedfs.clusters.default = {
|
|
package = pkgs.seaweedfs;
|
|
|
|
masters.main = {
|
|
openFirewall = true;
|
|
ip = "fs.nkp.pet";
|
|
volumePreallocate = true;
|
|
|
|
defaultReplication = {
|
|
dataCenter = 0;
|
|
rack = 0;
|
|
server = 0;
|
|
};
|
|
};
|
|
};
|
|
|
|
# =============================================================================
|
|
# BOOT CONFIGURATION
|
|
# =============================================================================
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
device = "/dev/vda";
|
|
};
|
|
|
|
# =============================================================================
|
|
# NETWORKING
|
|
# =============================================================================
|
|
networking = {
|
|
hostName = "buer";
|
|
hostId = "1418d29e";
|
|
firewall.enable = false;
|
|
useDHCP = false;
|
|
};
|
|
|
|
services.fail2ban = {
|
|
enable = true;
|
|
# Ban IP after 5 failures
|
|
maxretry = 5;
|
|
ignoreIP = [
|
|
"10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" "100.64.0.0/10"
|
|
];
|
|
bantime = "24h"; # Ban IPs for one day on the first ban
|
|
bantime-increment = {
|
|
enable = true; # Enable increment of bantime after each violation
|
|
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
|
|
};
|
|
jails = {
|
|
apache-nohome-iptables.settings = {
|
|
# Block an IP address if it accesses a non-existent
|
|
# home directory more than 5 times in 10 minutes,
|
|
# since that indicates that it's scanning.
|
|
filter = "apache-nohome";
|
|
action = ''iptables-multiport[name=HTTP, port="http,https"]'';
|
|
logpath = "/var/log/httpd/error_log*";
|
|
backend = "auto";
|
|
findtime = 600;
|
|
bantime = 600;
|
|
maxretry = 5;
|
|
};
|
|
};
|
|
};
|
|
|
|
# Static IP configuration via systemd-networkd
|
|
systemd.network = {
|
|
enable = true;
|
|
networks."10-wan" = {
|
|
matchConfig.Name = "ens3";
|
|
address = [
|
|
"103.251.165.107/24"
|
|
"2a04:52c0:0135:48d1::2/48"
|
|
];
|
|
gateway = [
|
|
"103.251.165.1"
|
|
"2a04:52c0:0135::1"
|
|
];
|
|
dns = [
|
|
"2a01:6340:1:20:4::10"
|
|
"2a04:52c0:130:2a5c::10"
|
|
"185.31.172.240"
|
|
"5.255.125.240"
|
|
];
|
|
};
|
|
};
|
|
|
|
# =============================================================================
|
|
# VIRTUALIZATION
|
|
# =============================================================================
|
|
virtualisation.docker = {
|
|
enable = true;
|
|
enableOnBoot = true;
|
|
};
|
|
|
|
# =============================================================================
|
|
# PACKAGES
|
|
# =============================================================================
|
|
environment.systemPackages = with pkgs; [
|
|
inputs.agenix.packages.x86_64-linux.default
|
|
];
|
|
|
|
# =============================================================================
|
|
# COMMENTED OUT / DISABLED
|
|
# =============================================================================
|
|
# ZFS support (not needed for this VPS)
|
|
# boot.supportedFilesystems = [ "zfs" ];
|
|
# boot.kernelModules = [ "nct6775" "coretemp" ];
|
|
# services.zfs.autoScrub.enable = true;
|
|
# services.zfs.trim.enable = true;
|
|
|
|
# Additional packages (not needed)
|
|
# lm_sensors
|
|
# code-server
|
|
} |