Compare commits

..

2 Commits

3 changed files with 33 additions and 52 deletions

View File

@@ -556,7 +556,6 @@ $config = [
'module.enable' => [ 'module.enable' => [
'admin' => true, 'admin' => true,
'authpwauth' => true, 'authpwauth' => true,
'themepvv' => true,
], ],
@@ -859,7 +858,7 @@ $config = [
/* /*
* Which theme directory should be used? * Which theme directory should be used?
*/ */
'theme.use' => 'themepvv:pvv', 'theme.use' => 'default',
/* /*
* Set this option to the text you would like to appear at the header of each page. Set to false if you don't want * Set this option to the text you would like to appear at the header of each page. Set to false if you don't want

View File

@@ -1,24 +1,8 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
let let
themePvv = pkgs.fetchFromGitea {
domain = "git.pvv.ntnu.no";
owner = "Drift";
repo = "ssp-theme";
rev = "bda4314030be5f81aeaf2fb1927aee582f1194d9";
hash = "sha256-naNRyPL6PAsZKW2w1Vt9wrHT9inCL/yAFnvpy4glv+c=";
};
pwAuthScript = pkgs.writeShellApplication { pwAuthScript = pkgs.writeShellApplication {
name = "pwauth"; name = "pwauth";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [ coreutils heimdal ];
coreutils
heimdal
];
text = '' text = ''
read -r user1 read -r user1
user2="$(echo -n "$user1" | tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz')" user2="$(echo -n "$user1" | tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz')"
@@ -49,7 +33,7 @@ let
"metadata/saml20-sp-remote.php" = pkgs.writeText "saml20-sp-remote.php" '' "metadata/saml20-sp-remote.php" = pkgs.writeText "saml20-sp-remote.php" ''
<?php <?php
${lib.pipe config.services.idp.sp-remote-metadata [ ${ lib.pipe config.services.idp.sp-remote-metadata [
(map (url: '' (map (url: ''
$metadata['${url}'] = [ $metadata['${url}'] = [
'SingleLogoutService' => [ 'SingleLogoutService' => [
@@ -101,27 +85,18 @@ let
substituteInPlace "$out" \ substituteInPlace "$out" \
--replace-warn '$SAML_COOKIE_SECURE' 'true' \ --replace-warn '$SAML_COOKIE_SECURE' 'true' \
--replace-warn '$SAML_COOKIE_SALT' 'file_get_contents("${ --replace-warn '$SAML_COOKIE_SALT' 'file_get_contents("${config.sops.secrets."idp/cookie_salt".path}")' \
config.sops.secrets."idp/cookie_salt".path
}")' \
--replace-warn '$SAML_ADMIN_NAME' '"Drift"' \ --replace-warn '$SAML_ADMIN_NAME' '"Drift"' \
--replace-warn '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \ --replace-warn '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \
--replace-warn '$SAML_ADMIN_PASSWORD' 'file_get_contents("${ --replace-warn '$SAML_ADMIN_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/admin_password".path}")' \
config.sops.secrets."idp/admin_password".path
}")' \
--replace-warn '$SAML_TRUSTED_DOMAINS' 'array( "idp.pvv.ntnu.no" )' \ --replace-warn '$SAML_TRUSTED_DOMAINS' 'array( "idp.pvv.ntnu.no" )' \
--replace-warn '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=idp"' \ --replace-warn '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=idp"' \
--replace-warn '$SAML_DATABASE_USERNAME' '"idp"' \ --replace-warn '$SAML_DATABASE_USERNAME' '"idp"' \
--replace-warn '$SAML_DATABASE_PASSWORD' 'file_get_contents("${ --replace-warn '$SAML_DATABASE_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/postgres_password".path}")' \
config.sops.secrets."idp/postgres_password".path
}")' \
--replace-warn '$CACHE_DIRECTORY' '/var/cache/idp' --replace-warn '$CACHE_DIRECTORY' '/var/cache/idp'
''; '';
"modules/authpwauth/src/Auth/Source/PwAuth.php" = ./authpwauth.php; "modules/authpwauth/src/Auth/Source/PwAuth.php" = ./authpwauth.php;
# PVV theme module (themepvv).
"modules/themepvv" = themePvv;
}; };
}; };
in in
@@ -183,25 +158,23 @@ in
services.phpfpm.pools.idp = { services.phpfpm.pools.idp = {
user = "idp"; user = "idp";
group = "idp"; group = "idp";
settings = settings = let
let listenUser = config.services.nginx.user;
listenUser = config.services.nginx.user; listenGroup = config.services.nginx.group;
listenGroup = config.services.nginx.group; in {
in "pm" = "dynamic";
{ "pm.max_children" = 32;
"pm" = "dynamic"; "pm.max_requests" = 500;
"pm.max_children" = 32; "pm.start_servers" = 2;
"pm.max_requests" = 500; "pm.min_spare_servers" = 2;
"pm.start_servers" = 2; "pm.max_spare_servers" = 4;
"pm.min_spare_servers" = 2; "listen.owner" = listenUser;
"pm.max_spare_servers" = 4; "listen.group" = listenGroup;
"listen.owner" = listenUser;
"listen.group" = listenGroup;
"catch_workers_output" = true; "catch_workers_output" = true;
"php_admin_flag[log_errors]" = true; "php_admin_flag[log_errors]" = true;
# "php_admin_value[error_log]" = "stderr"; # "php_admin_value[error_log]" = "stderr";
}; };
}; };
services.nginx.virtualHosts."idp.pvv.ntnu.no" = { services.nginx.virtualHosts."idp.pvv.ntnu.no" = {
@@ -209,7 +182,7 @@ in
enableACME = true; enableACME = true;
kTLS = true; kTLS = true;
root = "${package}/share/php/simplesamlphp/public"; root = "${package}/share/php/simplesamlphp/public";
locations = { locations = {
# based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx # based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx
"/" = { "/" = {
alias = "${package}/share/php/simplesamlphp/public/"; alias = "${package}/share/php/simplesamlphp/public/";

View File

@@ -11,6 +11,15 @@
]; ];
systemd.network.enable = lib.mkForce false; systemd.network.enable = lib.mkForce false;
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot.loader = {
systemd-boot.enable = false; # no uefi support on this device
grub.device = "/dev/sda";
grub.enable = true;
};
boot.tmp.cleanOnBoot = true;
networking = networking =
let let
hostConf = values.hosts.gluttony; hostConf = values.hosts.gluttony;