summaryrefslogtreecommitdiffstats
path: root/recipes-security
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-10-13 15:55:29 -0700
committerArmin Kuster <akuster808@gmail.com>2021-10-18 21:50:22 -0700
commit30a5e16b75a6c413b5b059baf82c795c91df1ed1 (patch)
treee0a046843ee08b0dabdba19baaef44978304b5a5 /recipes-security
parent7f9a5b311e98bb3932b1c8a0647ae0b1c6aee2e8 (diff)
downloadmeta-security-30a5e16b75a6c413b5b059baf82c795c91df1ed1.tar.gz
python3-fail2ban: fix build failure and cleanup
Fixes: error in fail2ban setup command: use_2to3 is invalid. ERROR: 'python3 setup.py build ' execution failed. drop custom fail2ban_setup.py remove pyhton-fail2ban as its a symlink to python3 Update to tip for 11.2 branch Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-security')
-rwxr-xr-xrecipes-security/fail2ban/files/fail2ban_setup.py174
-rw-r--r--recipes-security/fail2ban/python3-fail2ban_0.11.2.bb8
2 files changed, 4 insertions, 178 deletions
diff --git a/recipes-security/fail2ban/files/fail2ban_setup.py b/recipes-security/fail2ban/files/fail2ban_setup.py
deleted file mode 100755
index e231949..0000000
--- a/recipes-security/fail2ban/files/fail2ban_setup.py
+++ /dev/null
@@ -1,174 +0,0 @@
1# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
2# vi: set ft=python sts=4 ts=4 sw=4 noet :
3
4# This file is part of Fail2Ban.
5#
6# Fail2Ban is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# Fail2Ban is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Fail2Ban; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20__author__ = "Cyril Jaquier, Steven Hiscocks, Yaroslav Halchenko"
21__copyright__ = "Copyright (c) 2004 Cyril Jaquier, 2008-2016 Fail2Ban Contributors"
22__license__ = "GPL"
23
24import platform
25
26try:
27 import setuptools
28 from setuptools import setup
29 from setuptools.command.install import install
30 from setuptools.command.install_scripts import install_scripts
31except ImportError:
32 setuptools = None
33 from distutils.core import setup
34
35# all versions
36from distutils.command.build_py import build_py
37from distutils.command.build_scripts import build_scripts
38if setuptools is None:
39 from distutils.command.install import install
40 from distutils.command.install_scripts import install_scripts
41try:
42 # python 3.x
43 from distutils.command.build_py import build_py_2to3
44 from distutils.command.build_scripts import build_scripts_2to3
45 _2to3 = True
46except ImportError:
47 # python 2.x
48 _2to3 = False
49
50import os
51from os.path import isfile, join, isdir, realpath
52import sys
53import warnings
54from glob import glob
55
56from fail2ban.setup import updatePyExec
57
58if setuptools and "test" in sys.argv:
59 import logging
60 logSys = logging.getLogger("fail2ban")
61 hdlr = logging.StreamHandler(sys.stdout)
62 fmt = logging.Formatter("%(asctime)-15s %(message)s")
63 hdlr.setFormatter(fmt)
64 logSys.addHandler(hdlr)
65 if set(["-q", "--quiet"]) & set(sys.argv):
66 logSys.setLevel(logging.CRITICAL)
67 warnings.simplefilter("ignore")
68 sys.warnoptions.append("ignore")
69 elif set(["-v", "--verbose"]) & set(sys.argv):
70 logSys.setLevel(logging.DEBUG)
71 else:
72 logSys.setLevel(logging.INFO)
73elif "test" in sys.argv:
74 print("python distribute required to execute fail2ban tests")
75 print("")
76
77longdesc = '''
78Fail2Ban scans log files like /var/log/pwdfail or
79/var/log/apache/error_log and bans IP that makes
80too many password failures. It updates firewall rules
81to reject the IP address or executes user defined
82commands.'''
83
84if setuptools:
85 setup_extra = {
86 'test_suite': "fail2ban.tests.utils.gatherTests",
87 'use_2to3': True,
88 }
89else:
90 setup_extra = {}
91
92data_files_extra = []
93
94# Installing documentation files only under Linux or other GNU/ systems
95# (e.g. GNU/kFreeBSD), since others might have protective mechanisms forbidding
96# installation there (see e.g. #1233)
97platform_system = platform.system().lower()
98doc_files = ['README.md', 'DEVELOP', 'FILTERS', 'doc/run-rootless.txt']
99if platform_system in ('solaris', 'sunos'):
100 doc_files.append('README.Solaris')
101if platform_system in ('linux', 'solaris', 'sunos') or platform_system.startswith('gnu'):
102 data_files_extra.append(
103 ('/usr/share/doc/fail2ban', doc_files)
104 )
105
106# Get version number, avoiding importing fail2ban.
107# This is due to tests not functioning for python3 as 2to3 takes place later
108exec(open(join("fail2ban", "version.py")).read())
109
110setup(
111 name = "fail2ban",
112 version = version,
113 description = "Ban IPs that make too many password failures",
114 long_description = longdesc,
115 author = "Cyril Jaquier & Fail2Ban Contributors",
116 author_email = "cyril.jaquier@fail2ban.org",
117 url = "http://www.fail2ban.org",
118 license = "GPL",
119 platforms = "Posix",
120 cmdclass = {
121 'build_py': build_py, 'build_scripts': build_scripts,
122 },
123 scripts = [
124 'bin/fail2ban-client',
125 'bin/fail2ban-server',
126 'bin/fail2ban-regex',
127 'bin/fail2ban-testcases',
128 # 'bin/fail2ban-python', -- link (binary), will be installed via install_scripts_f2b wrapper
129 ],
130 packages = [
131 'fail2ban',
132 'fail2ban.client',
133 'fail2ban.server',
134 'fail2ban.tests',
135 'fail2ban.tests.action_d',
136 ],
137 package_data = {
138 'fail2ban.tests':
139 [ join(w[0], f).replace("fail2ban/tests/", "", 1)
140 for w in os.walk('fail2ban/tests/files')
141 for f in w[2]] +
142 [ join(w[0], f).replace("fail2ban/tests/", "", 1)
143 for w in os.walk('fail2ban/tests/config')
144 for f in w[2]] +
145 [ join(w[0], f).replace("fail2ban/tests/", "", 1)
146 for w in os.walk('fail2ban/tests/action_d')
147 for f in w[2]]
148 },
149 data_files = [
150 ('/etc/fail2ban',
151 glob("config/*.conf")
152 ),
153 ('/etc/fail2ban/filter.d',
154 glob("config/filter.d/*.conf")
155 ),
156 ('/etc/fail2ban/filter.d/ignorecommands',
157 [p for p in glob("config/filter.d/ignorecommands/*") if isfile(p)]
158 ),
159 ('/etc/fail2ban/action.d',
160 glob("config/action.d/*.conf") +
161 glob("config/action.d/*.py")
162 ),
163 ('/etc/fail2ban/fail2ban.d',
164 ''
165 ),
166 ('/etc/fail2ban/jail.d',
167 ''
168 ),
169 ('/var/lib/fail2ban',
170 ''
171 ),
172 ] + data_files_extra,
173 **setup_extra
174)
diff --git a/recipes-security/fail2ban/python3-fail2ban_0.11.2.bb b/recipes-security/fail2ban/python3-fail2ban_0.11.2.bb
index ed75a0e..627496f 100644
--- a/recipes-security/fail2ban/python3-fail2ban_0.11.2.bb
+++ b/recipes-security/fail2ban/python3-fail2ban_0.11.2.bb
@@ -9,10 +9,9 @@ HOMEPAGE = "http://www.fail2ban.org"
9LICENSE = "GPL-2.0" 9LICENSE = "GPL-2.0"
10LIC_FILES_CHKSUM = "file://COPYING;md5=ecabc31e90311da843753ba772885d9f" 10LIC_FILES_CHKSUM = "file://COPYING;md5=ecabc31e90311da843753ba772885d9f"
11 11
12SRCREV ="eea1881b734b73599a21df2bfbe58b11f78d0a46" 12SRCREV ="d6b884f3b72b8a42b21da863836569ef6836c2ea"
13SRC_URI = " git://github.com/fail2ban/fail2ban.git;branch=0.11 \ 13SRC_URI = " git://github.com/fail2ban/fail2ban.git;branch=0.11 \
14 file://initd \ 14 file://initd \
15 file://fail2ban_setup.py \
16 file://run-ptest \ 15 file://run-ptest \
17" 16"
18 17
@@ -20,13 +19,13 @@ inherit update-rc.d ptest setuptools3
20 19
21S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
22 21
23do_compile:prepend () { 22do_compile () {
24 cp ${WORKDIR}/fail2ban_setup.py ${S}/setup.py
25 cd ${S} 23 cd ${S}
26 ./fail2ban-2to3 24 ./fail2ban-2to3
27} 25}
28 26
29do_install:append () { 27do_install:append () {
28 rm -f ${D}/${bindir}/fail2ban-python
30 install -d ${D}/${sysconfdir}/fail2ban 29 install -d ${D}/${sysconfdir}/fail2ban
31 install -d ${D}/${sysconfdir}/init.d 30 install -d ${D}/${sysconfdir}/init.d
32 install -m 0755 ${WORKDIR}/initd ${D}${sysconfdir}/init.d/fail2ban-server 31 install -m 0755 ${WORKDIR}/initd ${D}${sysconfdir}/init.d/fail2ban-server
@@ -38,6 +37,7 @@ do_install_ptest:append () {
38 install -d ${D}${PTEST_PATH}/bin 37 install -d ${D}${PTEST_PATH}/bin
39 sed -i -e 's/##PYTHON##/${PYTHON_PN}/g' ${D}${PTEST_PATH}/run-ptest 38 sed -i -e 's/##PYTHON##/${PYTHON_PN}/g' ${D}${PTEST_PATH}/run-ptest
40 install -D ${S}/bin/* ${D}${PTEST_PATH}/bin 39 install -D ${S}/bin/* ${D}${PTEST_PATH}/bin
40 rm -f ${D}${PTEST_PATH}/bin/fail2ban-python
41} 41}
42 42
43FILES:${PN} += "/run" 43FILES:${PN} += "/run"