From 9c3e83dc8143d8571201ee2a61c2ca0837fdeb5c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 14 Aug 2019 18:23:46 +0300 Subject: [PATCH] build and package maxminddb --- lighttpd.spec | 25 ++++++++++++++++++++++++- mod_maxminddb.conf | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 mod_maxminddb.conf diff --git a/lighttpd.spec b/lighttpd.spec index 7031dcd..4cc11ec 100644 --- a/lighttpd.spec +++ b/lighttpd.spec @@ -17,6 +17,7 @@ %bcond_without mysql # mysql support in mod_mysql_vhost, mod_vhostdb_mysql %bcond_without pgsql # PgSQL, enables mod_vhostdb_pgsql %bcond_without geoip # GeoIP support +%bcond_without maxminddb # MaxMind GeoIP2 module %bcond_with krb5 # krb5 support (does not work with heimdal) %bcond_without ldap # ldap support in mod_auth, mod_vhostdb_ldap %bcond_without lua # LUA support in mod_cml (needs LUA >= 5.1) @@ -42,7 +43,7 @@ Summary: Fast and light HTTP server Summary(pl.UTF-8): Szybki i lekki serwer HTTP Name: lighttpd Version: 1.4.54 -Release: 1 +Release: 2 License: BSD Group: Networking/Daemons/HTTP Source0: https://download.lighttpd.net/lighttpd/releases-1.4.x/%{name}-%{version}.tar.xz @@ -113,6 +114,7 @@ Source143: mod_vhostdb.conf Source144: mod_wstunnel.conf Source145: mod_authn_mysql.conf Source146: mod_sockproxy.conf +Source147: mod_maxminddb.conf # use branch.sh script to create branch.diff #Patch100: %{name}-branch.diff ## Patch100-md5: 7bd09235304c8bcb16f34d49d480c0fb @@ -123,6 +125,7 @@ Patch4: systemd.patch Patch5: test-port-setup.patch URL: https://www.lighttpd.net/ %{?with_geoip:BuildRequires: GeoIP-devel} +%{?with_maxminddb:BuildRequires: libmaxminddb-devel} %{?with_xattr:BuildRequires: attr-devel} BuildRequires: autoconf >= 2.57 %if "%{pld_release}" != "ac" @@ -566,6 +569,14 @@ mod_magnet is a module to control the request handling in lighty. %description mod_magnet -l pl.UTF-8 mod_magnet to moduł sterujący obsługą żądań w lighty. +%package mod_maxminddb +Summary: lighttpd module +Group: Networking/Daemons/HTTP +#URL: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModGeoip +Requires: %{name} = %{version}-%{release} + +%description mod_maxminddb + %package mod_mysql_vhost Summary: lighttpd module for MySQL based vhosting Summary(pl.UTF-8): Moduł lighttpd obsługujący vhosty oparte na MySQL-u @@ -998,6 +1009,7 @@ fi %{?with_dbi:--with-dbi} \ %{?with_krb5:--with-krb5} \ %{?with_geoip:--with-geoip} \ + %{?with_maxminddb:--with-maxminddb} \ %{?with_mysql:--with-mysql} \ %{?with_ldap:--with-ldap} \ %{?with_ssl:--with-openssl} \ @@ -1070,6 +1082,9 @@ cp -p %{SOURCE113} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/50_mod_flv_streaming.con %if %{with geoip} cp -p %{SOURCE140} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/50_mod_geoip.conf %endif +%if %{with maxminddb} +cp -p %{SOURCE147} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/50_mod_maxminddb.conf +%endif %if %{with ldap} cp -p %{SOURCE141} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/50_mod_authn_ldap.conf %endif @@ -1213,6 +1228,7 @@ fi %module_scripts mod_h264_streaming %module_scripts mod_indexfile %module_scripts mod_magnet +%module_scripts mod_maxminddb %module_scripts mod_mysql_vhost %module_scripts mod_openssl %module_scripts mod_proxy @@ -1428,6 +1444,13 @@ fi %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*mod_magnet.conf %attr(755,root,root) %{pkglibdir}/mod_magnet.so +%if %{with maxminddb} +%files mod_maxminddb +%defattr(644,root,root,755) +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*mod_maxminddb.conf +%attr(755,root,root) %{pkglibdir}/mod_maxminddb.so +%endif + %if %{with mysql} %files mod_mysql_vhost %defattr(644,root,root,755) diff --git a/mod_maxminddb.conf b/mod_maxminddb.conf new file mode 100644 index 0000000..fcc3e66 --- /dev/null +++ b/mod_maxminddb.conf @@ -0,0 +1,34 @@ +# Module for IP Based Geographic Lookups +# +# Documentation: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModMaxMindDB +# +# mod_maxminddb is a module for fast ip/location lookups. It uses MaxMind +# GeoIP2 databases. If the IP was found in the database, the module sets the +# appropriate environment variables to the request, thus making this +# information available to other modules/fcgi. +# +# Redirecting based on GeoIP2 data can be performed inside lighttpd using +# mod_magnet or using backend CGI, FastCGI, SCGI, etc. +# +# mod_maxminddb consumes MaxMind GeoIP2 databases. This is the successor to +# GeoIP Legacy databases. GeoIP Legacy databases were discontinued 2 Jan 2019 +# (https://dev.maxmind.com/geoip/legacy/release-notes/) and mod_geoip is now +# deprecated. + +server.modules += ( + "mod_maxminddb" +) + +# default: "disable" +#maxminddb.activate = "enable" + +#maxminddb.db = "/path/to/the/GeoIP2/database.mmdb" + +# list of environment variables to set and associated lookup keys in GeoIP2 .mmdb. +#maxminddb.env = ( +# "GEOIP_COUNTRY_CODE" => "country/iso_code", +# "GEOIP_COUNTRY_NAME" => "country/names/en", +# "GEOIP_CITY_NAME" => "city/names/en", +# "GEOIP_CITY_LATITUDE" => "location/latitude", +# "GEOIP_CITY_LONGITUDE" => "location/longitude", +#) -- 2.43.0