initial commit of file from CVS for smeserver-mod_maxminddb on Sat Sep 7 20:42:45 AEST 2024

This commit is contained in:
Trevor Batley 2024-09-07 20:42:45 +10:00
parent 4d5856e4cc
commit 26d83ef9c2
12 changed files with 202 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.gz

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-mod_maxminddb
# $Id: Makefile,v 1.1 2021/04/02 19:22:44 jpp Exp $
NAME := smeserver-mod_maxminddb
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,3 +1,15 @@
# smeserver-mod_maxminddb
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-mod_maxminddb
SMEServer Koozali developed git repo for smeserver-mod_maxminddb smecontribs
SMEServer Koozali developed git repo for smeserver-mod_maxminddb smecontribs
## Wiki
<br />https://wiki.koozali.org/
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-mod_maxminddb&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
## Description
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
*Once it has been checked, then this comment will be deleted*
<br />

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

7
createlinks Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
my $event ="smeserver-mod_maxminddb-update";
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
templates2events("/etc/httpd-e-smith/conf/httpd.conf", $event);

View File

@ -0,0 +1 @@
/usr/share/GeoIP

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1,32 @@
{
# vim: ft=perl:
my $status = $modMaxminddb{status} || 'disabled';
my $path = $modMaxminddb{Path} || '/usr/share/GeoIP';
if ( $status eq "enabled" )
{
$OUT .= "LoadModule maxminddb_module modules/mod_maxminddb.so\n";
$OUT .= "<IfModule mod_maxminddb.c>\n";
$OUT .= " MaxMindDBEnable On\n";
$OUT .= " MaxMindDBFile COUNTRY_DB $path/GeoLite2-Country.mmdb\n";
$OUT .= " MaxMindDBFile CITY_DB $path/GeoLite2-City.mmdb\n";
$OUT .= " MaxMindDBEnv COUNTRY_CODE COUNTRY_DB/country/iso_code\n";
$OUT .= " MaxMindDBEnv REGION_CODE CITY_DB/subdivisions/0/iso_code\n";
$OUT .= " MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code\n";
$OUT .= " MaxMindDBEnv MM_COUNTRY_NAME CITY_DB/country/names/en\n";
$OUT .= " MaxMindDBEnv MM_CITY_NAME CITY_DB/city/names/en\n";
$OUT .= " MaxMindDBEnv MM_LONGITUDE CITY_DB/location/longitude\n";
$OUT .= " MaxMindDBEnv MM_LATITUDE CITY_DB/location/latitude\n";
$OUT .= " MaxMindDBEnv MM_CONTINENT_CODE CITY_DB/continent/code\n";
$OUT .= " MaxMindDBEnv MM_CONTINENT_NAME CITY_DB/continent/names/en\n";
$OUT .= " MaxMindDBEnv MM_REGION_CODE CITY_DB/subdivisions/0/iso_code\n";
$OUT .= " MaxMindDBEnv MM_REGION_NAME CITY_DB/continent/names/en\n";
$OUT .= " MaxMindDBEnv MM_POSTAL_CODE CITY_DB/postal/code\n";
$OUT .= " MaxMindDBEnv MM_LOCATION_TIME_ZONE CITY_DB/location/time_zone\n";
$OUT .= "</Ifmodule>\n";
}
else
{
$OUT .= "# mod_maxminddb disabled\n";
}
}

View File

@ -0,0 +1,17 @@
{
#---------------------------------------------------------------------
# Grab ValidFromGeoIP access list property of httpd-admin
# SSL enabled virtual hosts should only allow access from IP's in
# this list, as well as local networks.
#---------------------------------------------------------------------
$OUT = '# Mod_maxminddb variable definition';
my $validFromGeoIP = ${'httpd-admin'}{'ValidFromGeoIP'};
return "#disabled\n" unless (defined $validFromGeoIP && ($modMaxminddb{'status'}||'disabled') eq 'enabled' );
$validFromGeoIP =~ s/,/|/g;
$OUT .= "\nSetEnvIf MM_COUNTRY_CODE ^($validFromGeoIP) AllowCountries\n";
# prior apache 2.4 you could combine ip and env by doing $externalSSLAccess .= ' env=AllowCountries';
# now you should add "Require env AllowCountries" in Files, Directory or Location section
}

View File

@ -0,0 +1,23 @@
{
$OUT =" # Mod_maxminddb\n";
return " #disabled\n" unless ( ($modMaxminddb{'status'}||'disabled') eq 'enabled' || defined (${'httpd-admin'}{'ValidFromGeoIP'}) );
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
if (($haveSSL eq 'yes') && ($port eq $httpsPort) ) {
$OUT .=" <Location /server-manager>
Require ip $localAccess $externalSSLAccess
Require env AllowCountries
</Location>\n" if (-d "/etc/e-smith/web/panels/manager/" && (${'httpd-admin'}{'GeoIPManager'} || 'enabled' ) eq 'enabled' );
$OUT .=" <Location /server-common>
Require ip $localAccess $externalSSLAccess
Require env AllowCountries
</Location>\n" if ( (${'httpd-admin'}{'GeoIPManager'} || 'enabled' ) eq 'enabled' || (${'httpd-admin'}{'GeoIPUser'} || 'enabled' ) eq 'enabled' || (${'httpd-admin'}{'GeoIPPassword'} || 'enabled' ) eq 'enabled') ;
$OUT .=" <Location /user-manager>
Require ip $localAccess $externalSSLAccess
Require env AllowCountries
</Location>\n" if (-d "/etc/e-smith/web/panels/user/" && (${'httpd-admin'}{'GeoIPUser'} || 'enabled' ) eq 'enabled' );
$OUT .=" <Location /user-password>
Require ip $localAccess $externalSSLAccess
Require env AllowCountries
</Location>\n" if (-d "/etc/e-smith/web/panels/password/" && (${'httpd-admin'}{'GeoIPPassword'} || 'enabled' ) eq 'enabled' );
}
}

View File

@ -0,0 +1,80 @@
%define name smeserver-mod_maxminddb
%define version 1.1.0
%define release 15
Summary: SME Server mod_dav implementation
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GPL
Group: Applications/Internet
Source: %{name}-%{version}.tar.xz
BuildArchitectures: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: smeserver-release >= 10
Requires: e-smith-apache >= 2.6.0-19
Requires: httpd >= 2
Requires: mod_maxminddb
Requires: libmaxminddb-devel
Requires: geolite2-city
Requires: geolite2-country
BuildRequires: e-smith-devtools >= 1.13.1-03
%description
Implementation of mod_dav for SME Server 7.
%changelog
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 1.1.0-15.sme
- Roll up patches and move to git repo [SME: 12338]
* Sat Sep 07 2024 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Mon Jul 25 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.1.0-14.sme
- make compatible with httpd24 access [SME: 12052]
* Fri Apr 02 2021 Jean-Philippe Pialasse <tests@pialasse.com> 1.1.0-11.sme
- add option to allow countries to external access to manager [SME: 10768]
ValidFromGeoIP will add access to listed countries to managers and all
ressources using the usual list from httpd-admin Validfrom (local ibays, contribs...)
* Fri Apr 02 2021 Jean-Philippe Pialasse <tests@pialasse.com> 1.1.0-10.sme
- initial import to SME 10 [SME: 11521]
- update event created
* Thu Apr 11 2019 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.0-7.sme
- fix missing db on installation [SME: 10770]
* Thu Mar 14 2019 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.0-6.sme
- configure necessary variables [SME: 10759]
* Wed Mar 13 2019 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.0-4.sme
- fix typo [SME: 10759]
- add requires mod_maxminddb
- rename template
* Tue Mar 12 2019 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.0-1.sme
- Initial version [SME: 10759]
%prep
%setup
%build
perl createlinks
%install
rm -rf %buildroot
(cd root ; find . -depth -print | cpio -dump %buildroot)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist %buildroot \
--dir /var/run/davLocks 'attr(0755,www,www)' \
> %{name}-%{version}-filelist
%clean
rm -rf %buildroot
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)