mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat(zackbiene): deploy self signed TLS certs
This commit is contained in:
parent
81fb519e88
commit
cbb6f906ec
9 changed files with 109 additions and 38 deletions
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
nodeSecrets,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
haPort = 8123;
|
||||
in {
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
extraComponents = [
|
||||
|
@ -15,8 +18,13 @@
|
|||
"zha"
|
||||
"mqtt"
|
||||
];
|
||||
openFirewall = true;
|
||||
config = {
|
||||
http = {
|
||||
server_host = ["127.0.0.1" "::1"];
|
||||
server_port = haPort;
|
||||
use_x_forwarded_for = true;
|
||||
trusted_proxies = ["127.0.0.1" "::1"];
|
||||
};
|
||||
homeassistant = {
|
||||
name = "!secret ha_name";
|
||||
latitude = "!secret ha_latitude";
|
||||
|
@ -60,4 +68,29 @@
|
|||
# - auth for zigbee2mqtt frontend
|
||||
# - auth for esphome dashboard
|
||||
# - only allow connections from privileged LAN to HA or from vpn range
|
||||
|
||||
services.nginx = {
|
||||
upstreams."homeassistant" = {
|
||||
servers = {"localhost:${toString haPort}" = {};};
|
||||
extraConfig = ''
|
||||
zone homeassistant 64k;
|
||||
keepalive 2;
|
||||
'';
|
||||
};
|
||||
virtualHosts."${nodeSecrets.homeassistant.domain}" = {
|
||||
forceSSL = true;
|
||||
#enableACME = true;
|
||||
sslCertificate = config.rekey.secrets."selfcert.crt".path;
|
||||
sslCertificateKey = config.rekey.secrets."selfcert.key".path;
|
||||
locations."/" = {
|
||||
proxyPass = "http://homeassistant";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
# TODO dynamic definitions for the "local" network, IPv6
|
||||
extraConfig = ''
|
||||
allow 192.168.0.0/22;
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue