2022-10-01 22:18:20 +02:00
|
|
|
# .--.
|
2022-08-25 23:38:52 +02:00
|
|
|
# `. \
|
|
|
|
# \ \
|
|
|
|
# . \
|
|
|
|
# : .
|
|
|
|
# | .
|
|
|
|
# | :
|
|
|
|
# | |
|
|
|
|
# ..._ ___ | |
|
|
|
|
# `."".`''''""--..___ | |
|
|
|
|
# ,-\ \ ""-...__ _____________/ |
|
|
|
|
# / ` " ' `"""""""" .
|
|
|
|
# \ L
|
|
|
|
# (> \
|
|
|
|
#/ \
|
|
|
|
#\_ ___..---. MEOW OS \
|
|
|
|
# `--' '. \
|
|
|
|
# . \_
|
|
|
|
# _/`. `.._
|
|
|
|
# .' -. `.
|
|
|
|
# / __.-Y /''''''-...___,...--------.._ |
|
|
|
|
# / _." | / ' . \ '---..._ |
|
|
|
|
# / / / / _,. ' ,/ | |
|
|
|
|
# \_,' _.' / /'' _,-' _| |
|
|
|
|
# ' / `-----'' / |
|
|
|
|
# `...-' `...-'
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
|
2022-10-01 22:33:23 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2022-06-01 20:46:47 +02:00
|
|
|
|
|
|
|
{
|
2022-11-21 03:22:40 +01:00
|
|
|
deployment = {
|
|
|
|
persistedShares = [ "/etc" "/home" "/var" ];
|
2022-06-01 20:56:55 +02:00
|
|
|
mem = 2048;
|
2022-06-16 21:18:04 +02:00
|
|
|
};
|
2022-10-01 22:33:23 +02:00
|
|
|
nix.settings.auto-optimise-store = lib.mkForce false;
|
2022-06-01 20:46:47 +02:00
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostName = "leon";
|
|
|
|
firewall.enable = true;
|
|
|
|
};
|
2022-08-31 19:50:48 +02:00
|
|
|
# enable IP routing
|
|
|
|
boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = 1;
|
|
|
|
boot.kernel.sysctl."net.ipv4.conf.default.forwarding" = 1;
|
2022-06-01 20:46:47 +02:00
|
|
|
|
|
|
|
security.sudo = {
|
|
|
|
enable = true;
|
|
|
|
wheelNeedsPassword = false;
|
|
|
|
};
|
|
|
|
|
2022-08-31 20:10:40 +02:00
|
|
|
c3d2.hq.statistics.enable = true;
|
2022-08-20 04:24:53 +02:00
|
|
|
|
2022-08-31 20:10:40 +02:00
|
|
|
# List packages installed in system profile. To search, run:
|
2022-08-07 03:47:42 +02:00
|
|
|
# $ nix search wget
|
2022-08-31 20:10:40 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
2022-10-02 23:29:45 +02:00
|
|
|
wget vim python3Full python310Packages.pip nmap htop wireguard-tools docker-compose
|
2022-08-07 03:47:42 +02:00
|
|
|
];
|
|
|
|
|
2022-10-02 23:29:45 +02:00
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
2022-08-07 03:47:42 +02:00
|
|
|
|
2022-06-01 20:46:47 +02:00
|
|
|
users.users.leon = {
|
|
|
|
isNormalUser = true;
|
2022-10-02 23:29:45 +02:00
|
|
|
extraGroups = [ "wheel" "docker" ];
|
2022-06-01 20:46:47 +02:00
|
|
|
createHome = true;
|
2022-11-21 03:44:40 +01:00
|
|
|
openssh.authorizedKeys.keys = with import ../../users.nix;
|
|
|
|
leon.sshKeys;
|
2022-06-01 20:46:47 +02:00
|
|
|
};
|
|
|
|
|
2022-08-20 17:22:11 +02:00
|
|
|
networking.firewall = {
|
2022-11-21 02:34:43 +01:00
|
|
|
allowedTCPPorts = [ 5000 22 53 80 443 8080 12000 ];
|
2022-11-22 13:09:51 +01:00
|
|
|
allowedUDPPorts = [ 53 80 8080 18900 19900 ];
|
2022-06-01 20:46:47 +02:00
|
|
|
};
|
2022-08-25 23:38:52 +02:00
|
|
|
#_______________________________Begin-VPN1-Server____________________________________
|
2022-08-24 05:47:49 +02:00
|
|
|
|
|
|
|
networking.wireguard.interfaces = {
|
2022-08-25 23:38:52 +02:00
|
|
|
#Interface. Trusted VPN
|
2022-08-24 05:47:49 +02:00
|
|
|
vpn1 = {
|
|
|
|
#IP address && Subnet.
|
|
|
|
ips = [ "10.10.11.1/24" ];
|
|
|
|
#VPN Port.
|
2022-08-28 01:43:10 +02:00
|
|
|
listenPort = 18900;
|
2022-09-25 21:10:44 +02:00
|
|
|
privateKeyFile = "/etc/wireguard/privatekey";
|
2022-08-24 05:47:49 +02:00
|
|
|
#----------------------Start-Routing----------------------------
|
|
|
|
postSetup = ''
|
2022-09-18 21:39:16 +02:00
|
|
|
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.10.11.1/24 -o flpk -j MASQUERADE
|
2022-08-24 05:47:49 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
# This undoes the above command
|
|
|
|
postShutdown = ''
|
2022-09-18 21:39:16 +02:00
|
|
|
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.10.11.1/24 -o flpk -j MASQUERADE
|
2022-08-24 05:47:49 +02:00
|
|
|
'';
|
|
|
|
#----------------------End-Routing----------------------------
|
2022-09-25 21:10:44 +02:00
|
|
|
|
|
|
|
peers = [
|
2022-10-02 23:29:45 +02:00
|
|
|
# ------------------leon-------------------------.
|
2022-11-04 03:02:55 +01:00
|
|
|
{
|
|
|
|
#leon-Mac
|
2022-09-02 21:25:18 +02:00
|
|
|
publicKey = "okZuIQ90J49IJ3s+/dZyLthvo4rR2kclmTL54Ykglio=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.2" ];
|
2022-09-02 21:25:18 +02:00
|
|
|
}
|
|
|
|
{
|
2022-11-04 03:02:55 +01:00
|
|
|
#leon-Phone
|
2022-09-02 21:25:18 +02:00
|
|
|
publicKey= "OKv8k1ctlcYN9du/lWA65E0+nMpYOhUR8jf+rfQS+BY=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.3" ];
|
2022-09-02 20:49:25 +02:00
|
|
|
}
|
2022-11-04 03:02:55 +01:00
|
|
|
{
|
|
|
|
#leoncloud-vm
|
|
|
|
publicKey = "YhcC/xMYxh7GIyndbgBZ05oE3aTJXK4T7JgZwUDyd08=";
|
|
|
|
allowedIPs = [ "10.10.11.4" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
#leon-Pi
|
|
|
|
publicKey = "TzAImxyt2by5BfCR79U5giD4rzPrUrtWWy2IvXVF+ik=";
|
|
|
|
allowedIPs = [ "10.10.11.6" ];
|
2022-11-09 22:39:17 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
#leon-windows
|
|
|
|
publicKey = "djNLXtdgDAD2P/14EHXG8bjcHkKvPflNZhEHq5AEcgU=";
|
|
|
|
allowedIPs = [ "10.10.11.12" ];
|
2022-11-04 03:02:55 +01:00
|
|
|
}
|
2022-09-02 21:25:18 +02:00
|
|
|
#-------------------<<B>>--------------------------.
|
|
|
|
{
|
|
|
|
#B-Mobile
|
|
|
|
publicKey= "mYnyJZkJ66vqJ5IyN3jmdhoCjuXIfb21c4exN77dVg0=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.50" ];
|
2022-09-02 21:25:18 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
#B-laptop
|
|
|
|
publicKey= "L2cXR9jXJZIqjwffqm11j3qpm5a+wz3+wlDkkzNNs08=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.51" ];
|
2022-09-02 21:25:18 +02:00
|
|
|
}
|
|
|
|
#-------------------Killow---------------------------.
|
|
|
|
{
|
|
|
|
#Killow-Server1
|
|
|
|
publicKey= "sg2U9isTU7fFj9dv8lFepbg1EE4s7RissF6ZCZf2cGs=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.60" ];
|
2022-09-02 21:25:18 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
#Killow-Server2
|
|
|
|
publicKey= "tNWJ8FFydI08Ls/faHU1mp0Uf1ZLzZke66DpL6ffoHY=";
|
2022-09-02 21:52:02 +02:00
|
|
|
allowedIPs = [ "10.10.11.61" ];
|
2022-09-02 21:28:01 +02:00
|
|
|
}
|
2022-10-05 21:56:47 +02:00
|
|
|
{
|
|
|
|
#Gecol-docker
|
|
|
|
publicKey= "DiA9FKxMDziCt4sEsINIdc8RlM1hq9fA4LVwf062mAE=";
|
|
|
|
allowedIPs = [ "10.10.11.62" ];
|
2022-11-12 19:22:42 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
#Acer-laptop
|
|
|
|
publicKey= "+/neUKXEHkLv+zYGw37+ckwoT3kHQIHyHRTbCtjUUA4=";
|
|
|
|
allowedIPs = [ "10.10.11.63" ];
|
2022-10-05 21:56:47 +02:00
|
|
|
}
|
|
|
|
#---------------------joker----------------------------.
|
2022-10-02 23:27:19 +02:00
|
|
|
{
|
2022-10-01 22:09:08 +02:00
|
|
|
#joker-phone
|
|
|
|
publicKey= "FRuPoJ1XVGWTeGO2vZPd4MC0hxjRailAzhMHg3ZegV0=";
|
|
|
|
allowedIPs = [ "10.10.11.30" ];
|
|
|
|
}
|
2022-10-02 23:27:19 +02:00
|
|
|
#---------------------black----------------------------.
|
2022-11-22 01:34:54 +01:00
|
|
|
|
2022-09-02 21:28:01 +02:00
|
|
|
];
|
2022-08-24 05:47:49 +02:00
|
|
|
};
|
2022-09-02 20:58:49 +02:00
|
|
|
};
|
|
|
|
#-----------------------------END-VPN---------------------------------
|
2022-08-25 23:38:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
#__________________________Begin-VPN2-Server_____________________
|
|
|
|
|
|
|
|
networking.wireguard.interfaces = {
|
|
|
|
#Interface. Untrusted VPN
|
|
|
|
vpn2 = {
|
|
|
|
#IP address && Subnet.
|
|
|
|
ips = [ "10.10.100.1/24" ];
|
|
|
|
|
|
|
|
#VPN Port.
|
2022-08-28 01:43:10 +02:00
|
|
|
listenPort = 19900;
|
2022-08-25 23:38:52 +02:00
|
|
|
|
2022-08-27 23:03:10 +02:00
|
|
|
# Path to the private key file.
|
2022-08-25 23:38:52 +02:00
|
|
|
#
|
|
|
|
privateKeyFile = "/etc/wireguard/privatekey";
|
2022-08-24 05:47:49 +02:00
|
|
|
|
2022-08-25 23:38:52 +02:00
|
|
|
peers = [
|
|
|
|
# -----------------leon-Mac-------------------------.
|
|
|
|
{
|
|
|
|
publicKey = "6GRIp7SjHyu5sgqudtgZdN9CKbV3GYtMnwgo06F4ylo=";
|
|
|
|
allowedIPs = [ "10.10.100.0/24" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-08-24 05:47:49 +02:00
|
|
|
#-----------------------------END-VPN---------------------------------
|
2022-08-25 23:38:52 +02:00
|
|
|
|
2022-11-13 01:31:43 +01:00
|
|
|
|
|
|
|
#-----------------------------ngin-X--------------------------------
|
|
|
|
|
2022-11-22 19:30:32 +01:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."bicospacetech.c3d2.de" = {
|
2022-11-22 21:00:19 +01:00
|
|
|
listen = [{port = 80; addr="localhost";} ];
|
2022-11-22 19:30:32 +01:00
|
|
|
default = true;
|
2022-11-22 20:57:44 +01:00
|
|
|
forceSSL = false;
|
2022-11-22 19:30:32 +01:00
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://45.158.40.162:12000";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-11-13 01:31:43 +01:00
|
|
|
#-----------------------------ngin-X--------------------------------
|
|
|
|
|
2022-11-20 15:02:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-25 23:38:52 +02:00
|
|
|
system.stateVersion = "22.05";
|
2022-06-01 20:46:47 +02:00
|
|
|
}
|