summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rwxr-xr-xmakedeps.sh22
-rw-r--r--valkey-ldap.spec104
4 files changed, 139 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/makedeps.sh b/makedeps.sh
new file mode 100755
index 0000000..3369a2f
--- /dev/null
+++ b/makedeps.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+NAME=$(sed -n '/^Name:/{s/.* //;p}' *.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+MODULE=$(sed -n '/^%global gh_proj/{s/.* //;p}' $NAME.spec)
+
+if [ -f $NAME-$VERSION.tar.gz ]; then
+ echo "+ Unpack"
+ tar xf $NAME-$VERSION.tar.gz
+
+ pushd $MODULE-$VERSION
+ echo "+ Fetch"
+ cargo vendor mycargo
+
+ echo "+ Pack"
+ tar czf ../$NAME-deps-$VERSION.tgz mycargo
+ popd
+
+ echo "+ Clean"
+ rm -r $MODULE-$VERSION
+else
+ echo $NAME-$VERSION.tar.gz missing
+fi
diff --git a/valkey-ldap.spec b/valkey-ldap.spec
new file mode 100644
index 0000000..432f4eb
--- /dev/null
+++ b/valkey-ldap.spec
@@ -0,0 +1,104 @@
+# remirepo/fedora spec file for valkey-ldap
+#
+# SPDX-FileCopyrightText: Copyright 2025 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+#
+# Please, preserve the changelog entries
+#
+
+%global cfgname ldap.conf
+%global libname ldap.so
+# Github forge
+%global gh_vend valkey-io
+%global gh_proj valkey-ldap
+%global forgeurl https://github.com/%{gh_vend}/%{gh_proj}
+#global commit afe5de4ce52bb2b80af565a6f297bf330a65d0d8
+%global tag %{version}
+
+Name: valkey-ldap
+Version: 1.0.0
+%forgemeta
+Release: 1%{?dist}
+Summary: Probabilistic data structures
+# this module is BSD-3-Clause
+# rust libraries are Apache-2.0, MIT, BSD-2-CLAUSE
+License: BSD-3-Clause AND BSD-2-CLAUSE AND Apache-2.0 AND MIT AND Zlib AND Unicode-3.0
+URL: %{forgeurl}
+Source0: %{forgesource}
+# get rust dependencies
+Source2: %{name}-deps-%{version}.tgz
+Source3: makedeps.sh
+
+BuildRequires: valkey-devel >= 8.0
+BuildRequires: cargo-rpm-macros >= 24
+BuildRequires: cargo >= 1.81
+BuildRequires: rust >= 1.81
+BuildRequires: clang-devel
+BuildRequires: openssl-devel
+
+Requires: valkey(modules_abi)%{?_isa} = %{valkey_modules_abi}
+Requires: valkey >= 8.0
+# only a hint as auth module
+Enhances: valkey
+
+
+%description
+The valkey-ldap module is a Rust based Valkey module that adds the support
+for handling user authentication against LDAP based identity providers.
+
+The module works by registering and authentication handler that intercepts
+the valkey AUTH command, which validates the the username and password,
+specified in the AUTH command, using an LDAP server. Therefore the user must
+already exist in Valkey before LDAP can be used for authentication.
+
+
+%prep
+%setup -q -n %{gh_proj}-%{version} -a2
+
+: Configuration file
+cat << EOF | tee %{cfgname}
+# %{gh_proj}
+loadmodule %{valkey_modules_dir}/%{libname}
+EOF
+
+: Create cargo configuration to use vendor directory
+%cargo_prep -v $PWD/mycargo
+cat .cargo/config.toml
+
+: Bundled projects Licenses
+for proj in mycargo/*; do
+ for lic in $proj/LICENSE*; do
+ [ -f $lic ] && cp $lic $(basename $lic).$(basename $proj)
+ done
+done
+
+: Licenses list
+cargo tree \
+ --workspace --offline --edges no-build,no-dev,no-proc-macro \
+ --no-dedupe --target all --prefix none --format "{l}: {p}" \
+ | sed -e "s: ($(pwd)[^)]*)::g" -e "s: / :/:g" -e "s:/: OR :g" | sort -u
+
+: Required rust version
+grep -h rust-version mycargo/*/Cargo.toml Cargo.toml | sort -u | tail -n 8
+
+
+%build
+%cargo_build
+
+
+%install
+install -Dpm755 target/rpm/*%{libname} %{buildroot}%{valkey_modules_dir}/%{libname}
+install -Dpm640 %{cfgname} %{buildroot}%{valkey_modules_cfg}/%{cfgname}
+
+
+%files
+%license LICENSE*
+%doc *.md
+%attr(0640, valkey, root) %config(noreplace) %{valkey_modules_cfg}/%{cfgname}
+%{valkey_modules_dir}/%{libname}
+
+
+%changelog
+* Wed Aug 6 2025 Remi Collet <remi@remirepo.net> - 1.0.0-1
+- initial package