fix(esphome): secure dashboard with password
This commit is contained in:
parent
945596ae95
commit
bf60a6fd82
9
secrets/esphome/password.age
Normal file
9
secrets/esphome/password.age
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 OAZQhA uLCR0Zvyg977i434S/9gNQgJwxxB9h5VEweoLoLokjI
|
||||||
|
YZoG0t/cZtbcRQCw1Xmb1liusNhvI98Et3D8l/PcSGo
|
||||||
|
-> ssh-ed25519 72ij7w S2go+bzLLz0+b7hRvXHsWi9K7vP720Dlqz6BoFa48xw
|
||||||
|
hqOtZhDTByyffHiR83DnJg4UwbavmDjg3xPD8awHsXE
|
||||||
|
-> o2.MQQ-grease ;qEW KxG{ :bMg*Y
|
||||||
|
|
||||||
|
--- PXilrtuv+2zysnIdq3AYNlmoFhm+9GyHenWoMih3jq8
|
||||||
|
AAuÆн–<YDc8μí±ëºßˆ;—åA›<41>â‡fMèM§é9¨ô|Ç::[[e¼NÊô%x&„ͨj{²žò$KÆØõ
|
|
@ -37,4 +37,5 @@ in {
|
||||||
# home-server
|
# home-server
|
||||||
"home-server/hostKey.age".publicKeys = [ felschr home-server ];
|
"home-server/hostKey.age".publicKeys = [ felschr home-server ];
|
||||||
"hass/secrets.age".publicKeys = [ felschr home-server ];
|
"hass/secrets.age".publicKeys = [ felschr home-server ];
|
||||||
|
"esphome/password.age".publicKeys = [ felschr home-server ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,10 @@ with pkgs;
|
||||||
let
|
let
|
||||||
port = 6052;
|
port = 6052;
|
||||||
inherit (config.services.home-assistant) configDir;
|
inherit (config.services.home-assistant) configDir;
|
||||||
|
passwordFile = config.age.secrets.esphome-password.path;
|
||||||
in {
|
in {
|
||||||
|
age.secrets.esphome-password.file = ../secrets/esphome/password.age;
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
virtualHosts."esphome.felschr.com" = {
|
virtualHosts."esphome.felschr.com" = {
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
@ -21,12 +24,10 @@ in {
|
||||||
description = "ESPHome";
|
description = "ESPHome";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig.LoadCredential = [ "password:${passwordFile}" ];
|
||||||
User = "hass";
|
script = ''
|
||||||
Group = "hass";
|
password="$(<"$CREDENTIALS_DIRECTORY/password")"
|
||||||
Restart = "on-failure";
|
${pkgs.esphome}/bin/esphome dashboard ${configDir}/esphome --password "$password"
|
||||||
WorkingDirectory = configDir;
|
'';
|
||||||
ExecStart = "${pkgs.esphome}/bin/esphome dashboard ${configDir}/esphome";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue