add new machines
colmena managed nix server for reverse proxy
This commit is contained in:
parent
f49789d618
commit
649f32545a
15 changed files with 1152 additions and 139 deletions
19
hosts/waypoint/cloudflared.nix
Normal file
19
hosts/waypoint/cloudflared.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
services = {
|
||||
cloudflared = {
|
||||
enable = true;
|
||||
tunnels = {
|
||||
"4d40bf21-d8ef-4a71-8fb7-e4f24bb8b0cf" = {
|
||||
credentialsFile = "/home/gwg313/.cloudflared/4d40bf21-d8ef-4a71-8fb7-e4f24bb8b0cf.json";
|
||||
default = "http_status:404";
|
||||
ingress = {
|
||||
"*.gwg313.xyz" = {
|
||||
service = "http://localhost";
|
||||
# path = "/*.(jpg|png|css|js)";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
114
hosts/waypoint/configuration.nix
Normal file
114
hosts/waypoint/configuration.nix
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# sops
|
||||
sops = {
|
||||
defaultSopsFile = ../../secrets/secrets.yaml;
|
||||
defaultSopsFormat = "yaml";
|
||||
age.keyFile = "/home/gwg313/.config/sops/age/keys.txt";
|
||||
};
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./traefik.nix
|
||||
./zerotier.nix
|
||||
../../common/nixos/ssh/default.nix
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
];
|
||||
|
||||
ssh.enable = true;
|
||||
ssh_guard.enable = true;
|
||||
ssh_client.enable = false;
|
||||
services.openssh.authorizedKeysFiles = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINvOfDSjlvegGqfUS18XwXB7SvS2n9/hGYUpKxRb9vgb gwg313@pm.me"
|
||||
];
|
||||
services.openssh.settings = {
|
||||
PermitRootLogin = lib.mkForce "yes";
|
||||
|
||||
AllowUsers = lib.mkForce [
|
||||
"gwg313"
|
||||
"root"
|
||||
];
|
||||
};
|
||||
|
||||
users.users.gwg313 = {
|
||||
isNormalUser = true;
|
||||
description = "gwg313";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINvOfDSjlvegGqfUS18XwXB7SvS2n9/hGYUpKxRb9vgb gwg313@pm.me"
|
||||
];
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
];
|
||||
packages = with pkgs; [ ];
|
||||
};
|
||||
|
||||
users.users = {
|
||||
root = {
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINvOfDSjlvegGqfUS18XwXB7SvS2n9/hGYUpKxRb9vgb gwg313@pm.me"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
boot.loader.grub.useOSProber = true;
|
||||
networking.hostName = "nixos"; # Define your hostname.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Toronto";
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_CA.UTF-8";
|
||||
# Configure keymap in X11
|
||||
services.xserver.xkb = {
|
||||
layout = "us";
|
||||
variant = "";
|
||||
};
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
# wget
|
||||
];
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = {
|
||||
# enable = true;
|
||||
# enableSSHSupport = true;
|
||||
# };
|
||||
# List services that you want to enable:
|
||||
# Enable the OpenSSH daemon.
|
||||
# services.openssh.enable = true;
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
}
|
||||
38
hosts/waypoint/hardware-configuration.nix
Normal file
38
hosts/waypoint/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ata_piix"
|
||||
"uhci_hcd"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/0692e3c0-aa34-4a5a-aaa5-c13f55783570";
|
||||
fsType = "ext4";
|
||||
};
|
||||
swapDevices = [ ];
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
54
hosts/waypoint/routes.nix
Normal file
54
hosts/waypoint/routes.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
imports = [
|
||||
./services.nix
|
||||
];
|
||||
services.traefik = {
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
routers = {
|
||||
|
||||
music = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`music.gwg313.xyz`)";
|
||||
service = "music_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
recipes = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`recipes.gwg313.xyz`)";
|
||||
service = "recipes_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
audiobooks = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`audiobooks.gwg313.xyz`)";
|
||||
service = "audiobooks_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ ];
|
||||
};
|
||||
scholarsome = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`scholarsome.gwg313.xyz`)";
|
||||
service = "scholarsome_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
bookmarks = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`bookmarks.gwg313.xyz`)";
|
||||
service = "bookmarks_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
69
hosts/waypoint/routes_local.nix
Normal file
69
hosts/waypoint/routes_local.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
imports = [
|
||||
./services.nix
|
||||
];
|
||||
services.traefik = {
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
routers = {
|
||||
|
||||
arcocd_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`argocd.local.gwg313.xyz`)";
|
||||
service = "argocd_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
music_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`music.local.gwg313.xyz`)";
|
||||
service = "music_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
pinchflat_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`pinchflat.local.gwg313.xyz`)";
|
||||
service = "pinchflat_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
proxmox_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`proxmox.local.gwg313.xyz`)";
|
||||
service = "proxmox_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
recipes_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`recipes.local.gwg313.xyz`)";
|
||||
service = "recipes_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
audiobooks_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`audiobooks.local.gwg313.xyz`)";
|
||||
service = "audiobooks_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
scholarsome_local = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`scholarsome.local.gwg313.xyz`)";
|
||||
service = "scholarsome_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
54
hosts/waypoint/routes_zerotier.nix
Normal file
54
hosts/waypoint/routes_zerotier.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
imports = [
|
||||
./services.nix
|
||||
];
|
||||
services.traefik = {
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
routers = {
|
||||
|
||||
music_zerotier = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`music.zerotier.gwg313.xyz`)";
|
||||
service = "music_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
recipes_zerotier = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`recipes.zerotier.gwg313.xyz`)";
|
||||
service = "recipes_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
audiobooks_zerotier = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`audiobooks.zerotier.gwg313.xyz`)";
|
||||
service = "audiobooks_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
scholarsome_zerotier = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`scholarsome.zerotier.gwg313.xyz`)";
|
||||
service = "scholarsome_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
bookmarks_zerotier = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`bookmarks.zerotier.gwg313.xyz`)";
|
||||
service = "bookmarks_local";
|
||||
tls.certResolver = "le";
|
||||
middlewares = [ "headers" ];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
58
hosts/waypoint/services.nix
Normal file
58
hosts/waypoint/services.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
services.traefik = {
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
services = {
|
||||
|
||||
argocd_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "https://10.1.10.3:30007";
|
||||
}
|
||||
];
|
||||
music_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30033";
|
||||
}
|
||||
];
|
||||
|
||||
pinchflat_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30001";
|
||||
}
|
||||
];
|
||||
|
||||
proxmox_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "https://10.1.10.2:8006";
|
||||
}
|
||||
];
|
||||
|
||||
recipes_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30000";
|
||||
}
|
||||
];
|
||||
|
||||
audiobooks_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30080";
|
||||
}
|
||||
];
|
||||
|
||||
scholarsome_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30123";
|
||||
}
|
||||
];
|
||||
|
||||
bookmarks_local.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://10.1.10.3:30099";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
117
hosts/waypoint/traefik.nix
Normal file
117
hosts/waypoint/traefik.nix
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
# Traefik
|
||||
{
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./routes_local.nix
|
||||
./routes_zerotier.nix
|
||||
./routes.nix
|
||||
];
|
||||
sops.secrets.cf-api-token = {
|
||||
mode = "0440";
|
||||
owner = config.users.users.traefik.name;
|
||||
group = config.users.users.traefik.group;
|
||||
};
|
||||
|
||||
systemd.services.traefik.environment = {
|
||||
CF_DNS_API_TOKEN_FILE = "${config.sops.secrets.cf-api-token.path}";
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services.traefik = {
|
||||
enable = true;
|
||||
staticConfigOptions = {
|
||||
serversTransport = {
|
||||
insecureSkipVerify = true;
|
||||
};
|
||||
entryPoints = {
|
||||
web = {
|
||||
address = ":80";
|
||||
http = {
|
||||
redirections = {
|
||||
entryPoint = {
|
||||
to = "websecure";
|
||||
scheme = "https";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
websecure = {
|
||||
address = ":443";
|
||||
http = {
|
||||
tls = {
|
||||
options = "default";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
api = {
|
||||
dashboard = true;
|
||||
};
|
||||
certificatesResolvers = {
|
||||
le = {
|
||||
acme = {
|
||||
email = "glen.goodwin@protonmail.com";
|
||||
storage = "/var/lib/traefik/acme.json";
|
||||
dnsChallenge = {
|
||||
provider = "cloudflare";
|
||||
resolvers = [ "1.1.1.1:53" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
dynamicConfigOptions = {
|
||||
http = {
|
||||
routers = {
|
||||
dashboard = {
|
||||
rule = "Host(`monitor.local.gwg313.xyz`)";
|
||||
service = "api@internal";
|
||||
middlewares = [
|
||||
# "auth"
|
||||
"headers"
|
||||
];
|
||||
entrypoints = [ "websecure" ];
|
||||
tls = {
|
||||
certResolver = "le";
|
||||
};
|
||||
};
|
||||
};
|
||||
middlewares = {
|
||||
headers = {
|
||||
headers = {
|
||||
browserxssfilter = true;
|
||||
contenttypenosniff = true;
|
||||
customframeoptionsvalue = "SAMEORIGIN";
|
||||
forcestsheader = true;
|
||||
framedeny = true;
|
||||
sslhost = "gwg313.xyz";
|
||||
sslredirect = true;
|
||||
stsincludesubdomains = true;
|
||||
stspreload = true;
|
||||
stsseconds = "315360000";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
tls = {
|
||||
options = {
|
||||
default = {
|
||||
minVersion = "VersionTLS13";
|
||||
sniStrict = true;
|
||||
curvePreferences = [
|
||||
"CurveP521"
|
||||
"CurveP384"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
9
hosts/waypoint/zerotier.nix
Normal file
9
hosts/waypoint/zerotier.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
services.zerotierone = {
|
||||
joinNetworks = [
|
||||
inputs.secrets.zerotier.infra
|
||||
];
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue