Remilia: updates

services: add znc and some random changes
networking: random changes
mailserver: add masti@weirdnatto.in
and some other misc changes
This commit is contained in:
2022-03-09 10:53:07 +05:30
parent c27c8c3c56
commit 53b18802dd
5 changed files with 141 additions and 26 deletions

View File

@@ -1,21 +1,41 @@
{config, pkgs, ...}:
{ lib, config, pkgs, ... }:
{
networking = {
useDHCP = false;
hostName = "Remilia";
firewall = {
interfaces = {
ens3 = {
allowedTCPPorts = [
22
80 81
443 444
993 465 143 25
];
allowedUDPPorts = [ 17840 ];
firewall =
{
interfaces = {
ens3 = {
allowedTCPPorts = [
22
80
81
443
444
993
465
143
25
22001
22002
6600
9898
8999
];
allowedUDPPorts = [ 17840 ];
};
};
extraCommands = lib.concatMapStringsSep "\n"
(x:
let
t = lib.splitString ":" x.destination;
in
with builtins;
"iptables -t nat -A POSTROUTING -d ${head t} -p tcp -m tcp --dport ${head (tail t)} -j MASQUERADE"
)
config.networking.nat.forwardPorts;
};
};
interfaces = {
ens3 = {
useDHCP = true;
@@ -25,6 +45,16 @@
enable = true;
externalInterface = "ens3";
internalInterfaces = [ "wg0" ];
forwardPorts = [
{
destination = "10.55.0.2:222";
sourcePort = 22;
}
{
destination = "10.55.0.3:6600";
sourcePort = 6600;
}
];
};
wireguard.interfaces = {
wg0 = {
@@ -38,7 +68,7 @@
${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -j ACCEPT
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.55.0.0/24 -o ${config.networking.nat.externalInterface} -j MASQUERADE
'';
privateKeyFile = "/var/secrets/wg.key";
privateKeyFile = "/var/wg";
peers = [
{
publicKey = "m9SSpkj+r2QY4YEUMEoTkbOI/L7C39Kh6m45QZ5mkw4=";