forked from DGNum/infrastructure
feat(radius): Init config
This commit is contained in:
parent
3e763f419a
commit
f173138848
14 changed files with 426 additions and 0 deletions
34
machines/compute01/k-radius/packages/pykanidm.nix
Normal file
34
machines/compute01/k-radius/packages/pykanidm.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ lib, fetchFromGitHub, python3 }:
|
||||
|
||||
let
|
||||
pname = "kanidm";
|
||||
version = "0.0.3";
|
||||
in python3.pkgs.buildPythonPackage {
|
||||
inherit pname version;
|
||||
format = "pyproject";
|
||||
|
||||
disabled = python3.pythonOlder "3.8";
|
||||
|
||||
src = (fetchFromGitHub {
|
||||
owner = pname;
|
||||
repo = pname;
|
||||
# Latest 1.1.0-rc.15 tip
|
||||
rev = "a5ca8018e3a636dbb0a79b3fd869db059d92979d";
|
||||
hash = "sha256-PFGoeGn7a/lVR6rOmOKA3ydAoo3/+9RlkwBAKS22Psg=";
|
||||
}) + "/pykanidm";
|
||||
|
||||
nativeBuildInputs = with python3.pkgs; [ poetry-core ];
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [ aiohttp pydantic toml (authlib.overridePythonAttrs (_: { doCheck = false; })) ];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "kanidm" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Kanidm client library";
|
||||
homepage = "https://github.com/kanidm/kanidm/tree/master/pykanidm";
|
||||
license = licenses.mpl20;
|
||||
maintainers = with maintainers; [ arianvp hexa ];
|
||||
};
|
||||
}
|
13
machines/compute01/k-radius/packages/python_path.patch
Normal file
13
machines/compute01/k-radius/packages/python_path.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/rlm_python/mods-available/python3 b/rlm_python/mods-available/python3
|
||||
index 978536f8a..90c71fca0 100644
|
||||
--- a/rlm_python/mods-available/python3
|
||||
+++ b/rlm_python/mods-available/python3
|
||||
@@ -13,7 +13,7 @@ python3 {
|
||||
# item is GLOBAL TO THE SERVER. That is, you cannot have two
|
||||
# instances of the python module, each with a different path.
|
||||
#
|
||||
- python_path="/usr/lib64/python3.8:/usr/lib/python3.8:/usr/lib/python3.8/site-packages:/usr/lib64/python3.8/site-packages:/usr/lib64/python3.8/lib-dynload:/usr/local/lib/python3.8/site-packages:/etc/raddb/mods-config/python3/"
|
||||
+ python_path="@kanidm_python@:/etc/raddb/mods-config/python3/"
|
||||
|
||||
module = "kanidm.radius"
|
||||
# python_path = ${modconfdir}/${.:name}
|
33
machines/compute01/k-radius/packages/rlm_python.nix
Normal file
33
machines/compute01/k-radius/packages/rlm_python.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ stdenv, fetchFromGitHub, python3, pykanidm }:
|
||||
|
||||
let pythonPath = with python3.pkgs; makePythonPath [ pykanidm ];
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "rlm_python";
|
||||
version = "1.1.0-rc.15";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kanidm";
|
||||
repo = "kanidm";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-0y8juXS61Z9zxOdsWAQ6lJurP+n855Nela6egYRecok=";
|
||||
};
|
||||
|
||||
patches = [ ./python_path.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace rlm_python/mods-available/python3 \
|
||||
--replace "@kanidm_python@" "${pythonPath}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/etc/raddb/
|
||||
cp -R rlm_python/{mods-available,sites-available} $out/etc/raddb/
|
||||
'';
|
||||
|
||||
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
||||
|
||||
passthru = { inherit pythonPath; };
|
||||
|
||||
preferLocalBuild = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue