From 7d24e2dfc197053f05f792a689171ab10a6cdf60 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sun, 6 Oct 2024 16:19:36 +0200 Subject: [PATCH] feat(dgsi): Update, with SAML provisional auth --- machines/compute01/dgsi/default.nix | 62 ++++++++++-------- .../compute01/secrets/dgsi-x509_cert_file | Bin 0 -> 3616 bytes machines/compute01/secrets/dgsi-x509_key_file | Bin 0 -> 4864 bytes machines/compute01/secrets/secrets.nix | 2 + npins/sources.json | 4 +- 5 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 machines/compute01/secrets/dgsi-x509_cert_file create mode 100644 machines/compute01/secrets/dgsi-x509_key_file diff --git a/machines/compute01/dgsi/default.nix b/machines/compute01/dgsi/default.nix index 1e972c3..f7fd9e2 100644 --- a/machines/compute01/dgsi/default.nix +++ b/machines/compute01/dgsi/default.nix @@ -8,7 +8,7 @@ }: let - inherit (lib) mapAttrsToList; + inherit (lib) toLower; python = let @@ -33,25 +33,29 @@ let }; }; - pythonEnv = python.withPackages (ps: [ - ps.django - ps.gunicorn - ps.psycopg - ps.django-compressor - ps.django-import-export + pythonEnv = python.withPackages ( + ps: + [ + ps.django + ps.gunicorn + ps.psycopg + ps.django-compressor + ps.django-import-export - # Local packages - ps.django-allauth - ps.django-allauth-cas - ps.django-browser-reload - ps.django-bulma-forms - ps.django-sass-processor - ps.django-sass-processor-dart-sass - ps.django-unfold - ps.loadcredential - ps.pykanidm - ps.python-cas - ]); + # Local packages + ps.django-allauth + ps.django-allauth-cas + ps.django-browser-reload + ps.django-bulma-forms + ps.django-sass-processor + ps.django-sass-processor-dart-sass + ps.django-unfold + ps.loadcredential + ps.pykanidm + ps.python-cas + ] + ++ ps.django-allauth.optional-dependencies.saml + ); staticDrv = pkgs.stdenv.mkDerivation { name = "dgsi-static"; @@ -67,8 +71,10 @@ let configurePhase = '' export DGSI_STATIC_ROOT=$out/static export CREDENTIALS_DIRECTORY=$(pwd)/../.credentials - export DGSI_KANIDM_CLIENT="dgsi_test"; - export DGSI_KANIDM_AUTH_TOKEN="fake.token"; + export DGSI_KANIDM_CLIENT="dgsi_test" + export DGSI_KANIDM_AUTH_TOKEN="fake.token" + export DGSI_X509_KEY="" + export DGSI_X509_CERT="" ''; doBuild = false; @@ -101,12 +107,14 @@ in serviceConfig = { DynamicUser = true; - LoadCredential = mapAttrsToList (name: value: "${name}:${value}") { - SECRET_KEY = config.age.secrets."dgsi-secret_key_file".path; - KANIDM_AUTH_TOKEN = config.age.secrets."dgsi-kanidm_auth_token_file".path; - KANIDM_SECRET = config.age.secrets."dgsi-kanidm_secret_file".path; - EMAIL_HOST_PASSWORD = config.age.secrets."dgsi-email_host_password_file".path; - }; + LoadCredential = map (name: "${name}:${config.age.secrets."dgsi-${toLower name}_file".path}") [ + "EMAIL_HOST_PASSWORD" + "KANIDM_AUTH_TOKEN" + "KANIDM_SECRET" + "SECRET_KEY" + "X509_CERT" + "X509_KEY" + ]; RuntimeDirectory = "django-apps/dgsi"; StateDirectory = "django-apps/dgsi"; UMask = "0027"; diff --git a/machines/compute01/secrets/dgsi-x509_cert_file b/machines/compute01/secrets/dgsi-x509_cert_file new file mode 100644 index 0000000000000000000000000000000000000000..93b5ce601dfa2ff243bbf67c7d7c76e59ffdca20 GIT binary patch literal 3616 zcmZY8=UHc3=Q_D;C7NMb1@A-S{ncHoO5A_C$n1qTSW zhzbRzQU{=-Rt0LEh!sT&#ZeRo*ede&`Oq&uf5GuPuj@SJpekNvQrf&0ht_ObZnl9i z7XlKW6l1q*;#FBl3_IR6>l1?v`0-5;-CZqb8&}4aigl3&5MzE(4uR%Hn0o z@En#A?k0nv83M=+IG;g6FbMfJmjmQuKp7vdq0li35G2BM2#GY!4w#G%j0*Ru1{nB6 zJP;$pqD?3d0b#`{oiv(~V-tWNg^ATOxo`@=PjjRp1yngyF61K^5D%UvL1ghcB)dgS zk?4p-AI-sF5Cw7))1`%bIL<7kg=x0Z^kUAZnhk1V!GIVe9IwJ7(_{{g2_+OkZAMU~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