1 {pkgs, config, lib, ...}:
6 cfg = config.services.hologram-server;
8 cfgFile = pkgs.writeText "hologram-server.json" (builtins.toJSON {
13 password = cfg.ldapBindPassword;
15 insecureldap = cfg.ldapInsecure;
16 userattr = cfg.ldapUserAttr;
17 baseDN = cfg.ldapBaseDN;
18 enableldapRoles = cfg.enableLdapRoles;
19 roleAttr = cfg.roleAttr;
20 groupClassAttr = cfg.groupClassAttr;
23 account = cfg.awsAccount;
24 defaultrole = cfg.awsDefaultRole;
26 stats = cfg.statsAddress;
27 listen = cfg.listenAddress;
28 cachetimeout = cfg.cacheTimeoutSeconds;
32 services.hologram-server = {
36 description = "Whether to enable the Hologram server for AWS instance credentials";
39 listenAddress = mkOption {
41 default = "0.0.0.0:3100";
42 description = "Address and port to listen on";
47 description = "Address of the LDAP server to use";
50 ldapInsecure = mkOption {
53 description = "Whether to connect to LDAP over SSL or not";
56 ldapUserAttr = mkOption {
59 description = "The LDAP attribute for usernames";
62 ldapBaseDN = mkOption {
64 description = "The base DN for your Hologram users";
67 ldapBindDN = mkOption {
69 description = "DN of account to use to query the LDAP server";
72 ldapBindPassword = mkOption {
74 description = "Password of account to use to query the LDAP server";
77 enableLdapRoles = mkOption {
80 description = "Whether to assign user roles based on the user's LDAP group memberships";
83 groupClassAttr = mkOption {
85 default = "groupOfNames";
86 description = "The objectclass attribute to search for groups when enableLdapRoles is true";
91 default = "businessCategory";
92 description = "Which LDAP group attribute to search for authorized role ARNs";
95 awsAccount = mkOption {
97 description = "AWS account number";
100 awsDefaultRole = mkOption {
102 description = "AWS default role";
105 statsAddress = mkOption {
108 description = "Address of statsd server";
111 cacheTimeoutSeconds = mkOption {
114 description = "How often (in seconds) to refresh the LDAP cache";
119 config = mkIf cfg.enable {
120 systemd.services.hologram-server = {
121 description = "Provide EC2 instance credentials to machines outside of EC2";
122 after = [ "network.target" ];
123 wantedBy = [ "multi-user.target" ];
126 ExecStart = "${pkgs.hologram}/bin/hologram-server --debug --conf ${cfgFile}";