Add hardening module and enable firewall, auditd,
and fail2ban
This commit is contained in:
@@ -20,6 +20,7 @@ in
|
|||||||
|
|
||||||
# Import system configuration
|
# Import system configuration
|
||||||
../../modules/system.nix
|
../../modules/system.nix
|
||||||
|
../../modules/harden.nix
|
||||||
../../modules/kde.nix
|
../../modules/kde.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
23
modules/harden.nix
Normal file
23
modules/harden.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
networking.firewall.enable = true;
|
||||||
|
|
||||||
|
security.sudo.execWheelOnly = true;
|
||||||
|
|
||||||
|
security.sudo.wheelNeedsPassword = true;
|
||||||
|
|
||||||
|
security.auditd.enable = true;
|
||||||
|
security.audit.enable = true;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings.PermitRootLogin = "no"; # distributed-build.nix requires it
|
||||||
|
settings.PasswordAuthentication = false;
|
||||||
|
allowSFTP = false;
|
||||||
|
};
|
||||||
|
fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
nix.settings.allowed-users = [ "root" "@users" ];
|
||||||
|
}
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
networking.firewall.enable = false;
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -24,15 +18,19 @@
|
|||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Add system packages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Enable fish shell
|
||||||
|
programs.fish.enable = true;
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.panotaka = {
|
users.users.panotaka = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "panotaka";
|
description = "panotaka";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
|
shell = pkgs.fish;
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user