summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/shackDNS.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-01-14 21:35:10 +0100
committertv <tv@krebsco.de>2020-01-14 21:35:10 +0100
commit67cda2940f1228063efd09e08d39fad12fe9a0ef (patch)
treeac639d44c2e6378265621988b19c345d891c4909 /krebs/2configs/shack/shackDNS.nix
parent525c955b5f955dd23ec4d060ebd1ef1e149760ce (diff)
parenta01e3174e04fc946e7dfaf3569919aacf5a6763d (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/2configs/shack/shackDNS.nix')
-rw-r--r--krebs/2configs/shack/shackDNS.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/krebs/2configs/shack/shackDNS.nix b/krebs/2configs/shack/shackDNS.nix
new file mode 100644
index 000000000..807bb7e65
--- /dev/null
+++ b/krebs/2configs/shack/shackDNS.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+let
+ pkg =
+ pkgs.fetchgit {
+ url = "https://git.shackspace.de/rz/shackdns";
+ rev = "e55cc906c734b398683f9607b93f1ad6435d8575";
+ sha256 = "1hkwhf3hqb4fz06b1ckh7sl0zcyi4da5fgdlksian8lxyd19n8sq";
+ };
+ home = "/var/lib/shackDNS";
+ port = "8083";
+ config_file = pkgs.writeText "config" ''
+ # Points to a bind configuration file
+ dns-db = ${home}/db.shack
+
+ # Points to a shackles configuration file
+ # See `shackles.json` in repo
+ shackles-db = ${home}/shackles.json
+
+ # Points to a REST service with the DHCP leases
+ leases-api = http://dhcp.shack/dhcpd.leases
+
+ # Wrap this binding with https proxy or similar
+ binding = http://localhost:${port}/
+ '';
+in {
+ # receive response from light.shack / standby.shack
+ networking.firewall.allowedTCPPorts = [ ];
+
+ users.users.shackDNS = {
+ inherit home;
+ createHome = true;
+ };
+ services.nginx.virtualHosts."leases.shack" = {
+ locations."/" = {
+ proxyPass = "http://localhost:${port}/";
+ };
+ };
+ services.nginx.virtualHosts."shackdns.shack" = {
+ locations."/" = {
+ proxyPass = "http://localhost:${port}/";
+ };
+ };
+ services.nginx.virtualHosts."shackles.shack" = {
+ locations."/" = {
+ proxyPass = "http://localhost:${port}/";
+ };
+ };
+
+ systemd.services.shackDNS = {
+ description = "shackDNS provides an overview over DHCP and DNS as well as a replacement for shackles";
+ wantedBy = [ "multi-user.target" ];
+ environment.PORT = port;
+ serviceConfig = {
+ User = "shackDNS";
+ WorkingDirectory = home;
+ ExecStart = "${pkgs.mono6}/bin/mono ${pkg}/shackDNS.exe ${config_file}";
+ PrivateTmp = true;
+ Restart = "always";
+ RestartSec = "15";
+ };
+ };
+}