File apache2-mod_asn.spec of Package apache2-mod_asn
#
# spec file for package apache2-mod_asn
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%if %{defined suse_version}
%define apxs /usr/sbin/apxs2
BuildRequires: apache2-devel apache2-prefork apache2-worker
%endif
#
%if %{defined centos_version} || %{defined fedora_version}
%define apxs /usr/sbin/apxs
BuildRequires: httpd-devel
%endif
#
%define apache apache2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
%define apache_mmn %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
#
Name: apache2-mod_asn
Summary: Look up the AS and network prefix of IP address in Apache
URL: http://mirrorbrain.org/mod_asn/
Version: 1.7
Release: 0
License: Apache-2.0
Group: Productivity/Networking/Web/Servers
#
%if %{defined suse_version}
Recommends: %{name}-tools
Requires: apache2 >= 2.2.6
Requires: %{apache_mmn}
Requires: libapr-util1 >= 1.3.0
Requires: libapr-util1-dbd-pgsql
%else
Requires: httpd
%endif
#
Autoreqprov: on
#
# http://svn.mirrorbrain.org/svn/mod_asn/trunk
Source: mod_asn-%{version}.tar.gz
Patch0: asn_get_routeviews_-_handle_https.patch
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
mod_asn is an Apache module doing lookups of the autonomous system (AS)[1], and
the network prefix[2] which contains a given (clients) IP address.
It is written with scalability in mind. To do high-speed lookups, it uses the
PostgreSQL ip4r datatype[3] that is indexable with a Patricia Trie[4] algorithm to
store network prefixes. This is the only algorithm that can search through the
~250.000 existing prefixes in a breeze.
It comes with script to create such a database (and keep it up to date) with
snapshots from global routing data - from a router's "view of the
world", so to speak.
Apache-internally, the module sets the looked up data as env table variables,
for perusal by other Apache modules. In addition, it can send it as response
headers to the client.
It is published under the Apache License, Version 2.0.
Source code can be obtained from http://mirrorbrain.org/mod_asn/ resp.
http://svn.mirrorbrain.org/svn/mod_asn/
Links:
[1] http://en.wikipedia.org/wiki/Autonomous_system_(Internet)
[2] http://en.wikipedia.org/wiki/Subnetwork
[3] http://pgfoundry.org/projects/ip4r/
[4] http://en.wikipedia.org/wiki/Radix_tree
Author: Peter Poeml
%package tools
License: Apache-2.0
Group: Productivity/Networking/Web/Servers
#
Summary: Tools for maintaining the pgsql db for mod_asn
%description tools
Tools for maintaining the pgsql db for mod_asn
%prep
%setup -n mod_asn-%{version}
%patch0 -p1
%if 0%{?suse_version}
sed -i "s|/usr/bin/env python|%{_bindir}/python|g" *.py
%endif
%build
%{apxs} -c mod_asn.c
%install
mkdir -p %{buildroot}%{apache_libexecdir}
cp -p .libs/mod_asn.so %{buildroot}%{apache_libexecdir}
install -D -m 0755 asn_import.py %{buildroot}%{_bindir}/asn_import
install -D -m 0755 asn_get_routeviews.py %{buildroot}%{_bindir}/asn_get_routeviews
%files
%defattr(-,root,root)
%doc docs
%doc asn.sql
%doc mod_asn.conf
%{apache_libexecdir}/*.so
%files tools
%defattr(-,root,root,-)
%{_bindir}/*
%changelog -n apache2-asn