From 5bf45be2fb6f18e0a3fd778c290908acdd9153f6 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Wed, 1 Apr 2015 21:30:58 +0200 Subject: [PATCH 1/1] - initial --- apache-mod_auth_radius-apache.patch | 57 +++++++++++++++++++++++++ apache-mod_auth_radius-conf.patch | 58 +++++++++++++++++++++++++ apache-mod_auth_radius.spec | 65 +++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 apache-mod_auth_radius-apache.patch create mode 100644 apache-mod_auth_radius-conf.patch create mode 100644 apache-mod_auth_radius.spec diff --git a/apache-mod_auth_radius-apache.patch b/apache-mod_auth_radius-apache.patch new file mode 100644 index 0000000..d355a4e --- /dev/null +++ b/apache-mod_auth_radius-apache.patch @@ -0,0 +1,57 @@ +--- mod_auth_radius-1.5.8/mod_auth_radius-2.0.c.orig 2009-05-16 10:31:47.000000000 +0200 ++++ mod_auth_radius-1.5.8/mod_auth_radius-2.0.c 2015-03-31 22:13:50.312803792 +0200 +@@ -288,6 +288,8 @@ + */ + + #include ++#include ++#include + #include + #include + +@@ -534,10 +536,12 @@ + } + + static const char * +-set_int_slot(cmd_parms *cmd, char *struct_ptr, const char *arg) ++set_int_slot(cmd_parms *cmd, void *mconfig, const char *arg) + { +- int offset = (int)cmd->info; +- *(int *)(struct_ptr + offset) = atoi(arg); ++ char *struct_ptr = mconfig; ++ int offset = (int)cmd->info; ++ int *ptr = (int*)(struct_ptr + offset); ++ *ptr = atoi(arg); + return NULL; + } + +@@ -680,7 +684,7 @@ + * benefit here. + */ + apr_snprintf(one, COOKIE_SIZE, "%s%s%s%s%s%08x", scr->secret, +- r->user, passwd, c->remote_ip, hostname, expires); ++ r->user, passwd, r->useragent_ip, hostname, (unsigned)expires); + + /* if you're REALLY worried about what's going on */ + +@@ -697,10 +701,10 @@ + apr_snprintf(two, COOKIE_SIZE, "%s%s", scr->secret, ap_md5(r->pool, one)); + if (string == NULL) { + apr_snprintf(cookie, COOKIE_SIZE, "%s%08x", +- ap_md5(r->pool, two), expires); ++ ap_md5(r->pool, two), (unsigned)expires); + } else { + apr_snprintf(cookie, COOKIE_SIZE, "%s%08x%s", +- ap_md5(r->pool, two), expires, string); ++ ap_md5(r->pool, two), (unsigned)expires, string); + } + return cookie; + } +@@ -1310,7 +1314,6 @@ + /* Apache 2.1+ */ + static const char * const aszPost[]={ "mod_authz_user.c", NULL }; + ap_register_provider(p, AUTHN_PROVIDER_GROUP, "radius", "0", &authn_radius_provider); +- ap_hook_check_user_id(authenticate_basic_user,NULL,aszPost,APR_HOOK_MIDDLE); + } + + module AP_MODULE_DECLARE_DATA radius_auth_module = diff --git a/apache-mod_auth_radius-conf.patch b/apache-mod_auth_radius-conf.patch new file mode 100644 index 0000000..2621ad0 --- /dev/null +++ b/apache-mod_auth_radius-conf.patch @@ -0,0 +1,58 @@ +--- mod_auth_radius-1.5.8/httpd.conf.orig 2009-05-16 10:31:47.000000000 +0200 ++++ mod_auth_radius-1.5.8/httpd.conf 2015-04-01 21:29:22.804391917 +0200 +@@ -1,14 +1,7 @@ + ###################################################################### +-# Modifications to the httpd.conf file for mod_auth_radius.c ++# Additions to the httpd.conf file for mod_auth_radius.c + # written by Alan DeKok + # +-# Version: $Id$ +-# +-###################################################################### +-# +-# These configuration options should be ADDED to the httpd.conf file +-# for your site. +-# + ###################################################################### + + +@@ -16,17 +9,7 @@ + # + # Tell Apache to load the module. + # +-LoadModule radius_auth_module libexec/mod_auth_radius.so +-# the path to the module file will depend on your Apache installation, e.g. +-#LoadModule radius_auth_module /usr/lib/apache2/modules/mod_auth_radius.so +- +-###################################################################### +-# +-# With Apache 1.x, it is necessary to add an 'AddModule' statement. +-# The order of the modules listed by 'AddModule' can be important. +-# This seems to work: +-# just AFTER 'AddModule mod_auth.c' add: +-# AddModule mod_auth_radius.c ++LoadModule radius_auth_module modules/mod_auth_radius.so + + + ###################################################################### +@@ -92,20 +75,6 @@ + # + AuthName "RADIUS authentication for localhost" + +-# Apache 1.x specific settings: +-# +-# don't use 'mod_auth'. +-# You might want to disable other authentication types here. +-# You can get a similar effect by commenting out the +-# 'AddModule mod_auth_*' lines, previously in httpd.conf +-# +-#AuthAuthoritative off +-# +-# Use mod_auth_radius for all authentication, and make the responses +-# from it authoritative. +-# +-#AuthRadiusAuthoritative on +- + # Apache 2.x specific setting: + # + # Set RADIUS to be the provider for this basic authentication diff --git a/apache-mod_auth_radius.spec b/apache-mod_auth_radius.spec new file mode 100644 index 0000000..7c129d1 --- /dev/null +++ b/apache-mod_auth_radius.spec @@ -0,0 +1,65 @@ +%define apxs %{_sbindir}/apxs +Summary: RADIUS authentication module for the Apache 2 webserver +Summary(pl.UTF-8): Moduł uwierzytelniający RADIUS dla serwera WWW Apache 2 +Name: apache-mod_auth_radius +Version: 1.5.8 +Release: 1 +License: Apache-like +Group: Networking/Daemons/HTTP +Source0: ftp://ftp.freeradius.org/pub/freeradius/mod_auth_radius-%{version}.tar +# Source0-md5: 87d8ef049736254cc09f8b34667f0e59 +Patch0: %{name}-apache.patch +Patch1: %{name}-conf.patch +URL: http://www.freeradius.org/ +BuildRequires: %{apxs} +BuildRequires: apache-devel >= 2.4 +BuildRequires: rpmbuild(macros) >= 1.268 +Requires: apache(modules-api) = %apache_modules_api +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) +%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d + +%description +This is the Apache RADIUS authentication module. It allows any Apache +web-server to become a RADIUS client for authentication and accounting +requests. You will, however, need to supply your own RADIUS server to +perform the actual authentication. + +%description -l pl.UTF-8 +Ten pakiet zawiera moduł uwierzytelniający RADIUS dla serwera WWW +Apache. Pozwala dowolnemu serwerowi Apache stać się klientem RADIUS na +potrzeby żądań uwierzytelniania i rozliczania. Aby wykonywać właściwe +uwierzytelnianie potrzebny jest własny serwer RADIUS. + +%prep +%setup -q -n mod_auth_radius-%{version} +%patch0 -p1 +%patch1 -p1 + +%build +%{apxs} -c -o mod_auth_radius.so mod_auth_radius-2.0.c + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} + +install -p .libs/mod_auth_radius.so $RPM_BUILD_ROOT%{_pkglibdir} +cp -p httpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_auth_radius.conf + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%service -q httpd restart + +%postun +if [ "$1" = "0" ]; then + %service -q httpd restart +fi + +%files +%defattr(644,root,root,755) +%doc README htaccess index.html +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/90_mod_auth_radius.conf +%attr(755,root,root) %{_pkglibdir}/mod_auth_radius.so -- 2.44.0