mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-06-16 09:39:14 +02:00
ildkule/loki: firewall all endpoints except push API
Co-authored-by: Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no>
This commit is contained in:
@@ -3,14 +3,15 @@
|
|||||||
let
|
let
|
||||||
cfg = config.services.loki;
|
cfg = config.services.loki;
|
||||||
stateDir = "/data/monitoring/loki";
|
stateDir = "/data/monitoring/loki";
|
||||||
|
# internalPort = 83100;
|
||||||
in {
|
in {
|
||||||
services.loki = {
|
services.loki = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configuration = {
|
configuration = {
|
||||||
auth_enabled = false;
|
auth_enabled = false;
|
||||||
server = {
|
server = {
|
||||||
http_listen_port = 3100;
|
http_listen_port = 31832;
|
||||||
http_listen_address = "0.0.0.0";
|
http_listen_address = "127.0.0.1";
|
||||||
grpc_listen_port = 9096;
|
grpc_listen_port = 9096;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,5 +82,21 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ cfg.configuration.server.http_listen_port ];
|
services.nginx.virtualHosts."loki-internal" = {
|
||||||
|
listen = [{
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
port = 3100;
|
||||||
|
ssl = false;
|
||||||
|
}];
|
||||||
|
locations = {
|
||||||
|
"/loki/api/v1/push" = {
|
||||||
|
proxyPass = "http://${cfg.configuration.server.http_listen_address}:${toString cfg.configuration.server.http_listen_port}";
|
||||||
|
};
|
||||||
|
"/" = {
|
||||||
|
return = "403";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 3100 ];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user