summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/backup.nix6
-rw-r--r--krebs/3modules/default.nix1
-rw-r--r--krebs/3modules/makefu/brain.pgp51
-rw-r--r--krebs/3modules/makefu/default.nix8
-rw-r--r--krebs/3modules/makefu/default.pgp64
-rw-r--r--krebs/3modules/nginx.nix29
-rw-r--r--krebs/3modules/on-failure.nix91
-rw-r--r--krebs/3modules/tv/default.nix29
8 files changed, 270 insertions, 9 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index 97082f56a..d22dd3810 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -60,6 +60,12 @@ let
};
imp = {
+ krebs.on-failure.plans =
+ listToAttrs (map (plan: nameValuePair "backup.${plan.name}" {
+ }) (filter (plan: build-host-is "pull" "dst" plan ||
+ build-host-is "push" "src" plan)
+ enabled-plans));
+
systemd.services =
listToAttrs (map (plan: nameValuePair "backup.${plan.name}" {
# TODO if there is plan.user, then use its privkey
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index af5076e0f..be530d46f 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -24,6 +24,7 @@ let
./newsbot-js.nix
./nginx.nix
./nixpkgs.nix
+ ./on-failure.nix
./os-release.nix
./per-user.nix
./Reaktor.nix
diff --git a/krebs/3modules/makefu/brain.pgp b/krebs/3modules/makefu/brain.pgp
new file mode 100644
index 000000000..739385a38
--- /dev/null
+++ b/krebs/3modules/makefu/brain.pgp
@@ -0,0 +1,51 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2
+
+mQINBFXn/k4BEACmXMbhoAKsMC/gFqBrQq2mgvo8+FnUe4F6JznVh7NiPH0PUdDw
+jRnK2EEpD+NoDt3A0jtq6C+wnr1V+p/jYAPxRcvv8a7ym+xuA4sBIPrlW1fQIuWF
+EjYnUVn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tOh4EJ
+4fmcTy8P/03eVL9GoarIjwRxYY8U23fU4xNIypkNrjspjJHVRcKJFCyA2/R9toKf
+0XGJIM2fwBo6beH0rinq8Xm8hrT/gFIWupuDLSTR/km0UD6CtfFOIt+5jw3c5mMR
+u9DbSWAiRYGzQKYYZUy5mdMG/kokDRSm5D0lO+YnLZtpECZn/Zi5rPKzbGyMus+a
+fm8a/eNko+Eg6j8FSYBm+d8SKYdoLJN3R7hYji7JuERMs+UZMsuriSAn2Af2Jn1I
+hc7fiwotrMdNifyWCtYqiFvcrsm8K8EC2J0KsieydBHwCuamlqTrjqVejbITD8Jl
+ghTGNHe/crP7/XKTjKva+1+VJAHDLylZgcArQSKa+SsWB/GoKB0x9UEWThJ1DLi4
+j2GhNlCIYZtPBQMu3+2btDj0A3IUQp4aW0nd5+0zz0H7JVrl+pI37uUxTiXCZG9X
+fjXrcP3niJhraHTG8mWD1v8+cG3NXpv/IZN82Z+sQlpabwjpybag2CeTfhEoFtEl
+V6ez9wpgBKeDsLDLOB8VRgpsikw9f6H8GAUZe2PjKUwiDtptqa37nU+3A6wPiO2s
+AWT/7D6vhMpDncp7E9DcsmsU9LNt7D+ISqi4uLKYJcfmqbJOui2YFo3zsYP8TqQD
+JTZ1lSpFpipJpi6mAzQUS4P3H+aUjeW/LWiSS/YNmGIOAUeB6Y3c
+=rEQB
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix
index d6ae9f12f..07382fee0 100644
--- a/krebs/3modules/makefu/default.nix
+++ b/krebs/3modules/makefu/default.nix
@@ -582,17 +582,19 @@ TNs2RYfwDy/r6H/hDeB/BSngPouedEVcPwIDAQAB
makefu = {
mail = "makefu@pornocauster.retiolum";
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl3RTOHd5DLiVeUbUr/GSiKoRWknXQnbkIf+uNiFO+XxiqZVojPlumQUVhasY8UzDzj9tSDruUKXpjut50FhIO5UFAgsBeMJyoZbgY/+R+QKU00Q19+IiUtxeFol/9dCO+F4o937MC0OpAC10LbOXN/9SYIXueYk3pJxIycXwUqhYmyEqtDdVh9Rx32LBVqlBoXRHpNGPLiswV2qNe0b5p919IGcslzf1XoUzfE3a3yjk/XbWh/59xnl4V7Oe7+iQheFxOT6rFA30WYwEygs5As//ZYtxvnn0gA02gOnXJsNjOW9irlxOUeP7IOU6Ye3WRKFRR0+7PS+w8IJLag2xb makefu@pornocauster";
+ pgp.pubkeys.default = builtins.readFile ./default.pgp;
+ pgp.pubkeys.brain = builtins.readFile ./brain.pgp;
};
makefu-omo = {
- inherit (makefu) mail;
+ inherit (makefu) mail pgp;
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtDhAxjiCH0SmTGNDqmlKPug9qTf+IFOVjdXfk01lAV2KMVW00CgNo2d5kl5+6pM99K7zZO7Uo7pmSFLSCAg8J6cMRI3v5OxFsnQfcJ9TeGLZt/ua7F8YsyIIr5wtqKtFbujqve31q9xJMypEpiX4np3nLiHfYwcWu7AFAUY8UHcCNl4JXm6hsmPe+9f6Mg2jICOdkfMMn0LtW+iq1KZpw1Nka2YUSiE2YuUtV+V+YaVMzdcjknkVkZNqcVk6tbJ1ZyZKM+bFEnE4VkHJYDABZfELpcgBAszfWrVG0QpEFjVCUq5atpIVHJcWWDx072r0zgdTPcBuzsHHC5PRfVBLEw== makefu@servarch";
};
makefu-tsp = {
- inherit (makefu) mail;
+ inherit (makefu) mail pgp;
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1srWa67fcsw3r64eqgIuHbMbrj6Ywd9AwzCM+2dfXqYQZblchzH4Q4oydjdFOnV9LaA1LfNcWEjV/gVQKA2/xLSyXSDwzTxQDyOAZaqseKVg1F0a7wAF20+LiegQj6KXE29wcTW1RjcPncmagTBv5/vYbo1eDLKZjwGpEnG0+s+TRftrAhrgtbsuwR1GWWYACxk1CbxbcV+nIZ1RF9E1Fngbl4C4WjXDvsASi8s24utCd/XxgKwKcSFv7EWNfXlNzlETdTqyNVdhA7anc3N7d/TGrQuzCdtrvBFq4WbD3IRhSk79PXaB3L6xJ7LS8DyOSzfPyiJPK65Zw5s4BC07Z makefu@tsp";
};
makefu-vbob = {
- inherit (makefu) mail;
+ inherit (makefu) mail pgp;
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiKvLKaRQPL/Y/4EWx3rNhrY5YGKK4AeqDOFTLgJ7djwJnMo7FP+OIH/4pFxS6Ri2TZwS9QsR3hsycA4n8Z15jXAOXuK52kP65Ei3lLyz9mF+/s1mJsV0Ui/UKF3jE7PEAVky7zXuyYirJpMK8LhXydpFvH95aGrL1Dk30R9/vNkE9rc1XylBfNpT0X0GXmldI+r5OPOtiKLA5BHJdlV8qDYhQsU2fH8S0tmAHF/ir2bh7+PtLE2hmRT+b8I7y1ZagkJsC0sn9GT1AS8ys5s65V2xTTIfQO1zQ4sUH0LczuRuY8MLaO33GAzhyoSQdbdRAmwZQpY/JRJ3C/UROgHYt makefu@vbob";
};
exco = {
diff --git a/krebs/3modules/makefu/default.pgp b/krebs/3modules/makefu/default.pgp
new file mode 100644
index 000000000..bc5c50b76
--- /dev/null
+++ b/krebs/3modules/makefu/default.pgp
@@ -0,0 +1,64 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2
+
+mQINBE6quoQBEACemTuY0Ujeygxdyds3ugPbKuIsJMCQSdXAKsCkH4vV5qam8rQP
+AabpYyQfew9nCUCJa4NkKFrLnGz4d7rl1u5ihVqMctYeJqZdtX88DqqNKQXoqKQv
+crF5hcZmUtbGe5eyoMV55hiODPVPTVra6pbxWwhqa0pYeXEyDy1BPoqgcP0DUFho
+yBeoyw71ujgdJZvl5rq6ZVjTGuToNKHn5UBDMu6n0rl9Ha7ukL4Gx8hOhmK8yv87
+zuUzBRQkTgoC48JA3Bt0kb15ghbOV7D411ZhmhEqWwE/OBk3//6MOGu24Mm0OG8J
++t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zx6xvM1AW2U5jS3iMglIi6fXEYRuQB9ygPTc
+wJ/ByBApEKC7O0kA0PhwEF4FTgZntThlaJ+2rsUseONAXqZTJaX+CXtQdw6IVa8n
+SmXN01YsZzW1qFhbBSYHowqbOxbW9WH0ObtL+bxfJbG8HrVoXZJ5pcytzIDsGbtE
+1M2AQPZ4CaaWDGEvnM3REo1OOAf3f4Vf9C59suPoKVWqalBb94AhQqka8nZ81jL9
+tXDt0Yuaj2xroCNstmRFOgXJBWWx59kVdU9yoC2K0AWNrMdHAuyevgscAHsKkXq5
+4C1xL0RuUlNZ1qcX7Ev7kcLJ1RxRyXZQCbpIUi+UAWuNgEwMEHo1eQ==
+=rHPd
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/krebs/3modules/nginx.nix b/krebs/3modules/nginx.nix
index 196a6eae7..816c2ff69 100644
--- a/krebs/3modules/nginx.nix
+++ b/krebs/3modules/nginx.nix
@@ -12,6 +12,20 @@ let
api = {
enable = mkEnableOption "krebs.nginx";
+ default404 = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ By default all requests not directed to an explicit hostname are
+ replied with a 404 error to avoid accidental exposition of nginx
+ services.
+
+ Set this value to `false` to disable this behavior - you will then be
+ able to configure a new `default_server` in the listen address entries
+ again.
+ '';
+ };
+
servers = mkOption {
type = types.attrsOf (types.submodule {
options = {
@@ -20,6 +34,7 @@ let
# TODO use identity
default = [
"${config.networking.hostName}"
+ "${config.networking.hostName}.r"
"${config.networking.hostName}.retiolum"
];
};
@@ -81,17 +96,19 @@ let
sendfile on;
keepalive_timeout 65;
gzip on;
- server {
- listen 80 default_server;
- server_name _;
- return 404;
- }
+
+ ${optionalString cfg.default404 ''
+ server {
+ listen 80 default_server;
+ server_name _;
+ return 404;
+ }''}
+
${concatStrings (mapAttrsToList (_: to-server) cfg.servers)}
'';
};
};
-
indent = replaceChars ["\n"] ["\n "];
to-location = { name, value }: ''
diff --git a/krebs/3modules/on-failure.nix b/krebs/3modules/on-failure.nix
new file mode 100644
index 000000000..13d561b8d
--- /dev/null
+++ b/krebs/3modules/on-failure.nix
@@ -0,0 +1,91 @@
+{ config, lib, pkgs, ... }: with config.krebs.lib; let
+ out = {
+ options.krebs.on-failure = api;
+ config = lib.mkIf cfg.enable imp;
+ };
+
+ cfg = config.krebs.on-failure;
+
+ api = {
+ enable = mkEnableOption "krebs.on-failure" // {
+ default = cfg.plans != {};
+ };
+ plans = mkOption {
+ default = {};
+ type = let
+ inherit (config) krebs;
+ in types.attrsOf (types.submodule ({ config, ... }: {
+ options = {
+ enable = mkEnableOption "krebs.on-failure.${config.name}" // {
+ default = true;
+ };
+ journalctl = {
+ lines = mkOption {
+ type = types.int;
+ default = 100;
+ };
+ output = mkOption {
+ type = types.enum [
+ "cat"
+ "export"
+ "json"
+ "json-pretty"
+ "json-sse"
+ "short"
+ "short-iso"
+ "short-precise"
+ "verbose"
+ ];
+ default = "short-iso";
+ };
+ };
+ mailto = mkOption {
+ type = types.str;
+ default = krebs.build.user.mail;
+ description = "Mail address to send journal extract to.";
+ };
+ subject = mkOption {
+ type = types.str;
+ default = "[${krebs.build.host.name}] ${config.name} has failed";
+ };
+ name = mkOption {
+ type = types.str;
+ default = config._module.args.name;
+ description = "Name of the to-be-monitored service.";
+ };
+ };
+ }));
+ };
+ sendmail = mkOption {
+ type = types.str;
+ default = "/var/setuid-wrappers/sendmail";
+ };
+ };
+
+ imp = {
+ systemd.services = foldl (a: b: a // b) {} (map to-services enabled-plans);
+ };
+
+ enabled-plans = filter (getAttr "enable") (attrValues cfg.plans);
+
+ to-services = plan: {
+ "${plan.name}".unitConfig.OnFailure = "on-failure.${plan.name}.service";
+ "on-failure.${plan.name}".serviceConfig = rec {
+ ExecStart = start plan;
+ SyslogIdentifier = ExecStart.name;
+ Type = "oneshot";
+ };
+ };
+
+ start = plan: pkgs.writeDash "on-failure.${plan.name}" ''
+ { echo Subject: ${shell.escape plan.subject}
+ echo To: ${shell.escape plan.mailto}
+ echo
+ ${pkgs.systemd}/bin/journalctl \
+ --lines=${toString plan.journalctl.lines} \
+ --output=${plan.journalctl.output} \
+ --unit=${shell.escape plan.name}.service
+ } | ${shell.escape cfg.sendmail} -t
+ '';
+
+in out
diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix
index a0237d361..262f508c3 100644
--- a/krebs/3modules/tv/default.nix
+++ b/krebs/3modules/tv/default.nix
@@ -357,6 +357,35 @@ with config.krebs.lib;
};
tv = {
mail = "tv@nomic.retiolum";
+ pgp.pubkeys.default = ''
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
+ mQINBFbJ/B0BEADZx8l5gRurzhEHcc3PbBepdZqDJQZ2cGHixi8VEk9iN25qJO5y
+ HB0q5sQRsh7oNCbzKp6qRhaG9kXmEda+Uu+qbHWxE32QcT76+W8npH73qthaFwC/
+ 5RA8KcSE8/XFxVBnVb14PNVHyAVxPHawawbhsOeaiZcHrq5IF6sVzcsc2KN87sIE
+ SthR4E01LBK4AFeFuKxga9OKFQV5WJNrihu+6H4wZwUfMpbE552N1rggxT4CouqZ
+ RocSg+el/aPRj3Jk9jDe/JFv4HU7KfioOD+NO8xLAkyw3aLsu/bv9nfUvcvTGeRp
+ z31UOjpNYpT3PS0+lNCUKQKUadAmhwU95V/0GdhadgxCFcS65qNO7ZZYDJqMIT2y
+ YH1d9MaVPDQD9W2v0ITCJcrks9p47o+C8zzDlcVr2VEGrTSngRDkWVNYjKwd3L8w
+ HuaTarqOprLzeZ6yblcLVOrW8tGTmxum0jB4Fn3enpTyJNzCfp6c0CoYp/ZziQ82
+ 2jgLWuqKv3EKhX9aCUUgbeDFhnsM3GzdT5qYupX7UyWTLfiUlAEUQUgtyM7yBUNN
+ PsD5OeYeRQ/xFzUO30kglbjXOOUQpm7kyX38OJA01JdOOhXNI7BTvkFZsJzBLoVM
+ AdK3LvF4Rjau3HzYqL1Cr0ai1Y9jZVXP3vimcvUcI9bTRg9pMfD8LekiQQARAQAB
+ tAl0diA8dHZAcj6JAj0EEwEI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