Jafner.net/homelab
Joey Hafner 1f02be1fd5
Some checks failed
Deploy NixOS System Configurations to Silver-Flame Hosts / deploy (push) Failing after 1m58s
#18 Implement much faster nix-instantiate-based parsing.
Trigger workflow.
2024-10-29 16:03:12 -07:00
..
local-hosts #18 Implement much faster nix-instantiate-based parsing. 2024-10-29 16:03:12 -07:00
sellswords #19 Delete legacy docs, extract useful content into other docs, delete homelab/docs/ 2024-10-28 18:01:52 -07:00
stacks Init n8n 2024-10-26 00:34:58 -07:00
terraform/digitalocean Move homelab host documentation and config files into subdirectory 2024-10-21 14:57:00 -07:00
vyos Sync active and saved config 2024-10-28 14:53:47 -07:00
README.md #19 Delete legacy docs, extract useful content into other docs, delete homelab/docs/ 2024-10-28 18:01:52 -07:00

Homelab

This directory contains the files that compose my homelab.

Map of Contents

Project Summary Path
barbarian Documentation and scripts for the barbarian TrueNAS host barbarian
docs Standalone documentation for architecture and procedure docs
druid Docker compose files and documentation for the druid cloud compute host druid
fighter Docker compose configuration, documentation, and scripts related to the fighter local compute host fighter
monk Documentation for the monk TrueNAS host monk
paladin Documentation for the paladin TrueNAS host paladin
sellswords Documentation and Terraform configuration files for cloud vendors such as AWS and Cloudflare sellswords
silver-hand Documentation and Terraform configuration for the silver-hand local Kubernetes cluster silver-hand
stacks Maximally independent Docker compose files for various services stacks
wizard Documentation, configuration, and scripts for the wizard VyOS host wizard

Configure a New Host

NixOS

Security

Below are described the general security principles followed throughout this project:

  • Never lean on security through obscurity.
  • Minimize friction induced by security. Friction induces laziness, which inevitably circumvents the original security system.
  • Understand that security practices cannot eliminate vulnerability of the system, only make it too expensive to attack.
  • Tie less important secrets to more important secrets, but not vice-versa.

Further, we have some tool-specific guidelines.

Securing SSH

When configuring the SSH server for a local host or VPS, or when provisioning a new SSH keypair.

  • Generate one private key for each user-machine pair.
  • Do not automate dissemination of pubkeys. Always install pubkeys manually.
  • Disable password-based authentication.
  • Disable root login.

Docker Compose

To write secrets into docker-compose.yml files securely, we use the following env_file snippet:

env_file:
  - path: ./<service>.secrets
    required: true

And we then write the required secrets in dotenv format in a file located at ./<service>.secrets. For example:

API_KEY=zj1vtmUNGIfHJBfYsDINr8AVN5on1Hy0
# ROOT_PASSWORD=changeme
ROOT_PASSWORD=0gavJVrsv89bmdDeJXAcI1eCvQ4Um8Hy

When these files are staged in git, our .gitattributes runs the sops filter against any file matching one of its described patterns.

Web Services

If a service supports OAuth2, we configure Keycloak SSO for that service. When feasible, we shift responsibility for authentication and authorization to Keycloak. This is dependent on each service implementing OAuth2/OpenIDConnect.

If a service does not support OAuth2, but it does support authentication via the X-Forwarded-User header, we use mesosphere/traefik-forward-auth as a Traefik middleware. This middleare restricts access to the service regardless of whether the service understands the X-Forwarded-User header, which makes it useful for compatible multi-user applications and single-user applications.

If a service should not be internet-accessible, we use Traefik's ipWhiteList middleware to restrict access to LAN IPs only.

Else, some services absolutely require separate authentication (e.g. Plex, N8n). In such cases, we create user credentials as we would for any internet service; using our password manager.