2024-01-02 11:29:13 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.shibboleth-sp;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.shibboleth-sp = {
|
2024-01-02 11:29:13 +00:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Whether to enable the shibboleth service";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
configFile = lib.mkOption {
|
|
|
|
type = lib.types.path;
|
|
|
|
example = lib.literalExpression ''"''${pkgs.shibboleth-sp}/etc/shibboleth/shibboleth2.xml"'';
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Path to shibboleth config file";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
fastcgi.enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Whether to include the shibauthorizer and shibresponder FastCGI processes";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
fastcgi.shibAuthorizerPort = lib.mkOption {
|
|
|
|
type = lib.types.int;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = 9100;
|
2022-12-28 21:21:41 +00:00
|
|
|
description = lib.mdDoc "Port for shibauthorizer FastCGI process to bind to";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
fastcgi.shibResponderPort = lib.mkOption {
|
|
|
|
type = lib.types.int;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = 9101;
|
2022-12-28 21:21:41 +00:00
|
|
|
description = lib.mdDoc "Port for shibauthorizer FastCGI process to bind to";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2020-04-24 23:36:52 +00:00
|
|
|
systemd.services.shibboleth-sp = {
|
|
|
|
description = "Provides SSO and federation for web applications";
|
|
|
|
after = lib.optionals cfg.fastcgi.enable [ "shibresponder.service" "shibauthorizer.service" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.shibboleth-sp}/bin/shibd -F -d ${pkgs.shibboleth-sp} -c ${cfg.configFile}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
systemd.services.shibresponder = lib.mkIf cfg.fastcgi.enable {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Provides SSO through Shibboleth via FastCGI";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
path = [ "${pkgs.spawn_fcgi}" ];
|
|
|
|
environment.SHIBSP_CONFIG = "${cfg.configFile}";
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.spawn_fcgi}/bin/spawn-fcgi -n -p ${toString cfg.fastcgi.shibResponderPort} ${pkgs.shibboleth-sp}/lib/shibboleth/shibresponder";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
systemd.services.shibauthorizer = lib.mkIf cfg.fastcgi.enable {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Provides SSO through Shibboleth via FastCGI";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
path = [ "${pkgs.spawn_fcgi}" ];
|
|
|
|
environment.SHIBSP_CONFIG = "${cfg.configFile}";
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.spawn_fcgi}/bin/spawn-fcgi -n -p ${toString cfg.fastcgi.shibAuthorizerPort} ${pkgs.shibboleth-sp}/lib/shibboleth/shibauthorizer";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
meta.maintainers = with lib.maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|