summary refs log tree commit diff
path: root/nixos/modules/services/security/hologram-server.nix
diff options
context:
space:
mode:
authorFernando J Pando <fernando.pando@stelligent.com>2017-02-01 11:26:55 -0500
committerFernando J Pando <fernando.pando@stelligent.com>2017-02-02 11:31:42 -0500
commit1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b (patch)
treef494799b9d3545060ddf3ca833a351621d040a60 /nixos/modules/services/security/hologram-server.nix
parentdbd4a35060b242839ba4d41e9bb743365faef8ce (diff)
downloadnixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar.gz
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar.bz2
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar.lz
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar.xz
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.tar.zst
nixpkgs-1d85e0bbab6a9f1b5a0d0a66c0ed927f6198f63b.zip
hologram: 8d86e3f -> d20d1c3
- Updates dependencies
- Adds configuration module
- Tested on Nixos Unstable
Diffstat (limited to 'nixos/modules/services/security/hologram-server.nix')
-rw-r--r--nixos/modules/services/security/hologram-server.nix102
1 files changed, 102 insertions, 0 deletions
diff --git a/nixos/modules/services/security/hologram-server.nix b/nixos/modules/services/security/hologram-server.nix
new file mode 100644
index 00000000000..e267fed2795
--- /dev/null
+++ b/nixos/modules/services/security/hologram-server.nix
@@ -0,0 +1,102 @@
+{pkgs, config, lib, ...}:
+
+with lib;
+
+let
+  cfg = config.services.hologram-server;
+
+  cfgFile = pkgs.writeText "hologram-server.json" (builtins.toJSON {
+    ldap = {
+      host = cfg.ldapHost;
+      bind = {
+        dn       = cfg.ldapBindDN;
+        password = cfg.ldapBindPassword;
+      };
+      insecureldap = cfg.ldapInsecure;
+      userattr     = cfg.ldapUserAttr;
+      baseDN       = cfg.ldapBaseDN;
+    };
+    aws = {
+      account     = cfg.awsAccount;
+      defaultrole = cfg.awsDefaultRole;
+    };
+    stats  = cfg.statsAddress;
+    listen = cfg.listenAddress;
+  });
+in {
+  options = {
+    services.hologram-server = {
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Whether to enable the Hologram server for AWS instance credentials";
+      };
+
+      listenAddress = mkOption {
+        type        = types.str;
+        default     = "0.0.0.0:3100";
+        description = "Address and port to listen on";
+      };
+
+      ldapHost = mkOption {
+        type        = types.str;
+        description = "Address of the LDAP server to use";
+      };
+
+      ldapInsecure = mkOption {
+        type        = types.bool;
+        default     = false;
+        description = "Whether to connect to LDAP over SSL or not";
+      };
+
+      ldapUserAttr = mkOption {
+        type        = types.str;
+        default     = "cn";
+        description = "The LDAP attribute for usernames";
+      };
+
+      ldapBaseDN = mkOption {
+        type        = types.str;
+        description = "The base DN for your Hologram users";
+      };
+
+      ldapBindDN = mkOption {
+        type        = types.str;
+        description = "DN of account to use to query the LDAP server";
+      };
+
+      ldapBindPassword = mkOption {
+        type        = types.str;
+        description = "Password of account to use to query the LDAP server";
+      };
+
+      awsAccount = mkOption {
+        type        = types.str;
+        description = "AWS account number";
+      };
+
+      awsDefaultRole = mkOption {
+        type        = types.str;
+        description = "AWS default role";
+      };
+
+      statsAddress = mkOption {
+        type        = types.str;
+        default     = "";
+        description = "Address of statsd server";
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.hologram-server = {
+      description = "Provide EC2 instance credentials to machines outside of EC2";
+      after       = [ "network.target" ];
+      wantedBy    = [ "multi-user.target" ];
+
+      serviceConfig = {
+        ExecStart = "${pkgs.hologram.bin}/bin/hologram-server --debug --conf ${cfgFile}";
+      };
+    };
+  };
+}