Added logging config
This commit is contained in:
parent
7ebbd4044e
commit
b895fd28d5
@ -9,5 +9,12 @@
|
|||||||
# Qemu guest
|
# Qemu guest
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
|
# Install Prometheus for Grafana
|
||||||
|
services.prometheus.exporters.node = {
|
||||||
|
enable = true;
|
||||||
|
port = 9002;
|
||||||
|
enabledCollectors = [ "systemd" ];
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,46 @@
|
|||||||
(import ./networking.nix {
|
(import ./networking.nix {
|
||||||
hostname = "r330-logging";
|
hostname = "r330-logging";
|
||||||
ip_address = "192.168.100.41";
|
ip_address = "192.168.100.41";
|
||||||
open_ports = [];
|
open_ports = [ 3000 9001 ];
|
||||||
inherit lib;
|
inherit lib;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.logging = import ./user.nix;
|
users.users.logging = import ./user.nix;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
suricata
|
suricata
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.grafana = {
|
||||||
|
enable = true;
|
||||||
|
settings.server = {
|
||||||
|
http_addr = "0.0.0.0";
|
||||||
|
http_port = 3000;
|
||||||
|
domain = "logging.randomctf.local";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
port = 9001;
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "r330-logging";
|
||||||
|
static_configs = [{
|
||||||
|
targets = let
|
||||||
|
port = toString config.services.prometheus.exporters.node.port;
|
||||||
|
in [
|
||||||
|
"127.0.0.1:${port}"
|
||||||
|
"192.168.100.40:${port}"
|
||||||
|
"192.168.100.42:${port}"
|
||||||
|
"192.168.100.43:${port}"
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.suricata = {
|
systemd.services.suricata = {
|
||||||
description = "Suricata IDS/IPS";
|
description = "Suricata IDS/IPS";
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
@ -154,6 +184,5 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
environment.etc."suricata/rules/suricata.rules".text = ''
|
environment.etc."suricata/rules/suricata.rules".text = ''
|
||||||
alert tcp any any -> any any (msg:"TCP traffic detected"; sid:1000001; rev:1;)
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.nameservers = [ gateway_ip ];
|
networking.nameservers = [ gateway_ip ];
|
||||||
networking.firewall.allowedTCPPorts = open_ports;
|
networking.firewall.allowedTCPPorts = open_ports ++ [9002];
|
||||||
networking.interfaces.enp6s18.ipv4.addresses = [
|
networking.interfaces.enp6s18.ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = ip_address;
|
address = ip_address;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user