This repository has been archived by the owner on Aug 17, 2018. It is now read-only.
forked from NETWAYS/ElasticArmor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elasticarmor.spec
92 lines (71 loc) · 2.44 KB
/
elasticarmor.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# ElasticArmor | (c) 2016 NETWAYS GmbH | GPLv2+
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%define revision 2
%define pre_release_tag rc2
Name: elasticarmor
Version: 1.0
Summary: HTTP reverse proxy to secure Elasticsearch.
Group: System Environment/Daemons
License: GPLv2+
URL: https://www.netways.org/projects/elasticarmor
Source0: https://github.com/NETWAYS/ElasticArmor/archive/v%{version}%{?pre_release_tag}.tar.gz
Vendor: NETWAYS GmbH <info@netways.de>
Packager: NETWAYS GmbH <info@netways.de>
%if %{?pre_release_tag}
Release: 0.%{revision}.%{pre_release_tag}%{?dist}
%else
Release: %{revision}%{?dist}
%endif
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildRequires: python-setuptools
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(postun): /sbin/service
Requires(preun): /sbin/service
Requires: python < 3
Requires: python-ldap
Requires: python-requests >= 2.4.2
%if 0%{?rhel} == 6
Requires: python >= 2.6
Requires: python-simplejson >= 2.1
%else
Requires: python >= 2.7
%endif
%define configdir %{_sysconfdir}/%{name}
%description
ElasticArmor is a HTTP reverse proxy placed in front of
Elasticsearch to regulate access to its REST api.
%files
%defattr(-,root,root)
%doc AUTHORS COPYING doc
%{python2_sitelib}
%attr(0755,root,root) %{_initddir}/%name
%attr(0750,root,%{name}) %dir %{_sysconfdir}/%{name}
%attr(0750,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
%prep
%setup -q -n ElasticArmor-%{version}%{?pre_release_tag}
%build
%install
%{__python2} setup.py install --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}%{_initddir}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
cp etc/init.d/elasticarmor %{buildroot}%{_initddir}/%{name}
%clean
rm -rf %{buildroot}
%pre
getent group %{name} >/dev/null || /sbin/groupadd -r %{name}
getent passwd %{name} >/dev/null || /sbin/useradd -c "%{name}" -s /sbin/nologin -r -g %{name} %{name}
%post
/sbin/chkconfig --add %{name}
%preun
if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%postun
if [ $1 -ge 1 ] ; then
/sbin/service %{name} restart > /dev/null 2>&1 || :
fi