Adding a minecraft server

This commit is contained in:
Lyes Saadi 2026-03-16 15:54:29 +01:00
parent fba02c0c19
commit 731edc4c1a
Signed by: lyes
GPG key ID: 55A1D803917CF39A
3 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,60 @@
{ lib, pkgs, ... }:
let
config = lib.toFile "config.yml" ''
config:
lite:
enabled: true
routes:
- host: stepson.minecraft.lyes.eu
backend: 10.0.0.2:25565
'';
in
{
environment.systemPackages = with pkgs; [ gate ];
systemd.services.gate = {
description = "Gate Minecraft Proxy";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${pkgs.gate}/bin/gate --config ${config}";
Restart = "always";
StandardInput = "socket";
StandardOutput = "journal";
StandardError = "journal";
# Hardening
CapabilityBoundingSet = [ "" ];
DeviceAllow = [ "" ];
LockPersonality = true;
PrivateDevices = true;
PrivateTmp = true;
PrivateUsers = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
];
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
UMask = "0077";
};
};
networking.firewall = {
allowedTCPPorts = [ 25565 ];
allowedUDPPorts = [ 25565 ];
};
}