aboutsummaryrefslogblamecommitdiff
path: root/nixops/modules/ssh/default.nix
blob: b28f6cac6242cce8105529b19e81edb25b3f8dc2 (plain) (tree)





























                                                                                                     
{ lib, pkgs, config, mylibs, myconfig, ... }:
{
  config = {
    networking.firewall.allowedTCPPorts = [ 22 ];

    services.openssh.extraConfig = ''
      AuthorizedKeysCommand     /etc/ssh/ldap_authorized_keys
      AuthorizedKeysCommandUser nobody
      '';

    environment.etc."ssh/ldap_authorized_keys" = let
      ldap_authorized_keys =
        mylibs.wrap {
          name = "ldap_authorized_keys";
          file = ./ldap_authorized_keys.sh;
          vars = {
            LDAP_PASS = myconfig.env.sshd.ldap.password;
            GITOLITE_SHELL = "${pkgs.gitolite}/bin/gitolite-shell";
            ECHO = "${pkgs.coreutils}/bin/echo";
          };
          paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.gnused pkgs.coreutils ];
        };
    in {
      enable = true;
      mode = "0755";
      user = "root";
      source = ldap_authorized_keys;
    };
  };
}