Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build environment #407

Merged
merged 7 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- centos-7
- ol-8
- rocky-9
- el-9
- amazon-2
- debian-buster
- debian-bullseye
Expand Down
1 change: 1 addition & 0 deletions builder-support/dockerfiles/Dockerfile.target.el-7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@INCLUDE Dockerfile.target.centos-7
1 change: 1 addition & 0 deletions builder-support/dockerfiles/Dockerfile.target.el-8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@INCLUDE Dockerfile.target.ol-8
1 change: 1 addition & 0 deletions builder-support/dockerfiles/Dockerfile.target.el-9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@INCLUDE Dockerfile.target.ol-9
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

# This defines the distribution base layer
# Put only the bare minimum of common commands here, without dev tools
FROM rockylinux:9 as dist-base
FROM oraclelinux:9 as dist-base

RUN touch /var/lib/rpm/* && dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
dnf install -y 'dnf-command(config-manager)' yum && dnf config-manager --set-enabled devel && \
dnf install -y 'dnf-command(config-manager)' yum && dnf config-manager --set-enabled ol9_codeready_builder && \
dnf install -y curl procps-ng --allowerasing # This is to ensure we don't have curlminimal and we do have pkill

RUN dnf -y install dnf-plugins-core clang
Expand Down
9 changes: 0 additions & 9 deletions builder-support/specs/wforce.spec
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,7 @@ Requires(postun): systemd
Requires: initscripts
Requires(postun): /sbin/service
%endif
%if 0%{?centos} == 7 || 0%{?rhel} == 7
%if 0%{?amzn} != 2
BuildRequires: devtoolset-7-gcc-c++
%define scl scl enable devtoolset-7
%else
%define scl bash
%endif
%else
%define scl bash
%endif
AutoReqProv: yes

%description
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/test_8bit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def test8Bit(self):
print(json.dumps(j))
count = int(j["r_attrs"]["count"])

self.assertEquals(count, 2)
self.assertEqual(count, 2)
8 changes: 4 additions & 4 deletions regression-tests/test_Attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ def test_Attrs(self):
attrs['accountStatus'] = "normal"
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

attrs['accountStatus'] = "blocked"
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)

attrs['accountStatus'] = "normal"
attrs['countryList'] = [ "UK", "US" ]
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

attrs['countryList'] = [ "UK", "US", "Blockmestan" ]
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)

34 changes: 17 additions & 17 deletions regression-tests/test_Basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class TestBasics(ApiTestCase):

def test_unauth(self):
r = requests.get(self.url("/?command=stats"))
self.assertEquals(r.status_code, requests.codes.unauthorized)
self.assertEqual(r.status_code, requests.codes.unauthorized)

def test_auth_stats(self):
r = self.session.get(self.url("/?command=stats"))
self.assertEquals(r.status_code, requests.codes.ok)
self.assertEqual(r.status_code, requests.codes.ok)

def test_ping(self):
for _ in range(10):
Expand All @@ -22,53 +22,53 @@ def test_ping(self):
if j['status'] == 'ok':
break
time.sleep(1)
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

def test_ping_acl_deny(self):
self.writeCmdToConsole('setACL({})')
r = self.pingFunc()
self.assertEquals(r.status_code, 401)
self.assertEqual(r.status_code, 401)
j = r.json()
self.assertEquals(j['status'], 'failure')
self.assertEquals(j['reason'], 'Source IP Address not in ACL')
self.assertEqual(j['status'], 'failure')
self.assertEqual(j['reason'], 'Source IP Address not in ACL')
self.writeCmdToConsole('setACL({"0.0.0.0/0"})')

def test_getBL(self):
r = self.getBLFunc()
j = r.json()
self.assertEquals(j['bl_entries'], [])
self.assertEqual(j['bl_entries'], [])

def test_customFunc(self):
r = self.customFunc("custom1")
j = r.json()
self.assertEquals(j['r_attrs']['login'], 'custom1')
self.assertEqual(j['r_attrs']['login'], 'custom1')

def test_customGetFunc(self):
r = self.customGetFunc("testCustomGet")
t = r.text
self.assertEquals(t, '1.2.3.4/32\n')
self.assertEqual(t, '1.2.3.4/32\n')

def test_deviceParsing(self):
r = self.allowFuncDeviceProtocol('foobar', '127.0.0.1', "12432", '"name" "Mac OS X Mail" "version" "10.0 (3226)" "os" "Mac OS X" "os-version" "10.12 (16A323)" "vendor" "Apple Inc."', "imap")
j = r.json()
self.assertRegexpMatches(json.dumps(j), "Mac OS X")
self.assertRegex(json.dumps(j), "Mac OS X")
r = self.allowFuncDeviceProtocol('foobar', '127.0.0.1', "12432", 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A', "http")
j = r.json()
self.assertRegexpMatches(json.dumps(j), "Mac OS X")
self.assertRegex(json.dumps(j), "Mac OS X")
r = self.allowFuncDeviceProtocol('foobar', '127.0.0.1', "12432", 'OpenXchange.Android.Mail/1.0+1234 (OS: 7.0; device: Samsung/GT9700)', "mobileapi")
j = r.json()
self.assertRegexpMatches(json.dumps(j), "Android")
self.assertRegex(json.dumps(j), "Android")

def test_getDBStats(self):
self.reportFunc('dbstats', '1.4.3.2', '1234', False);
r = self.getDBStatsLogin('dbstats')
j = r.json();
self.assertRegexpMatches(json.dumps(j), "countLogins")
self.assertRegex(json.dumps(j), "countLogins")
r = self.getDBStatsIP('1.4.3.2')
j = r.json();
self.assertRegexpMatches(json.dumps(j), "countLogins")
self.assertRegexpMatches(json.dumps(j), "bl_reason")
self.assertRegexpMatches(json.dumps(j), '"blacklisted": false')
self.assertRegex(json.dumps(j), "countLogins")
self.assertRegex(json.dumps(j), "bl_reason")
self.assertRegex(json.dumps(j), '"blacklisted": false')

def chunkGen(self):
payload = dict()
Expand All @@ -85,4 +85,4 @@ def testChunked(self):
data=self.chunkGen(),
headers={'Content-Type': 'application/json'})
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')
54 changes: 27 additions & 27 deletions regression-tests/test_Blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,137 +11,137 @@ class TestBlacklist(ApiTestCase):
def test_NetmaskBlacklist(self):
r = self.allowFunc('goodie', '193.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.allowFunc('goodie', '2002:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.addBLEntryNetmask("193.168.0.0/16", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.addBLEntryNetmask("2002:503:ba3e::/64", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.allowFunc('goodie', '193.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

r = self.allowFunc('goodie', '2002:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

time.sleep(11);

r = self.allowFunc('goodie', '193.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.allowFunc('goodie', '2002:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

def test_IPBlacklist(self):
r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.allowFunc('goodie', '2001:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.addBLEntryIP("192.168.72.14", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.addBLEntryIP("2001:503:ba3e::2:30", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

r = self.allowFunc('goodie', '2001:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

time.sleep(11);

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.allowFunc('goodie', '2001:503:ba3e::2:30', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

def test_LoginBlacklist(self):
r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.addBLEntryLogin("goodie", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

time.sleep(11);

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

def test_IPLoginBlacklist(self):
r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.addBLEntryIPLogin("192.168.72.14", "goodie", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

r = self.allowFunc('goody', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

r = self.allowFunc('goodie', '192.168.72.15', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

time.sleep(11);

r = self.allowFunc('goodie', '192.168.72.14', "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

def test_PersistBlacklist(self):
Expand All @@ -151,7 +151,7 @@ def test_PersistBlacklist(self):

r = self.addBLEntryIPPersist("99.99.99.99", 10, "test blacklist")
j = r.json()
self.assertEquals(j['status'], 'ok')
self.assertEqual(j['status'], 'ok')

print("Killing process")
proc3.terminate()
Expand Down
4 changes: 2 additions & 2 deletions regression-tests/test_Block.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestBlock(ApiTestCase):
def test_block(self):
r = self.allowFunc("baddie", "127.0.0.1", "1234")
j = r.json()
self.assertEquals(j['status'], 0)
self.assertEqual(j['status'], 0)
r.close()

for i in range(100):
Expand All @@ -18,6 +18,6 @@ def test_block(self):

r = self.allowFunc('baddie', '127.0.0.1', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertEqual(j['status'], -1)
r.close()

10 changes: 5 additions & 5 deletions regression-tests/test_GeoIP.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def test_geoIP(self):
# don't allow IPs from Japan (arbitrary)
r = self.allowFunc('baddie', '112.78.112.20', "1234")
j = r.json()
self.assertEquals(j['status'], -1)
self.assertRegexpMatches(json.dumps(j), "Japan")
self.assertEqual(j['status'], -1)
self.assertRegex(json.dumps(j), "Japan")
r.close()

# def test_geoIP2City(self):
# attrs = dict()
# attrs['ip'] = '128.243.1.1'
# r = self.customFuncWithName("geoip2", attrs)
# j = r.json()
# self.assertRegexpMatches(json.dumps(j), "Nottingham")
# self.assertRegex(json.dumps(j), "Nottingham")
# r.close()

def test_geoIP2LookupVals(self):
Expand All @@ -39,6 +39,6 @@ def test_geoIP2LookupVals(self):
r = self.customFuncWithName("geoip2_lookupValue", attrs)
j = r.json()
print(json.dumps(j))
self.assertRegexpMatches(json.dumps(j['r_attrs']['city']), "Nottingham")
self.assertRegexpMatches(json.dumps(j['r_attrs']['latitude']), "52.9538")
self.assertRegex(json.dumps(j['r_attrs']['city']), "Nottingham")
self.assertRegex(json.dumps(j['r_attrs']['latitude']), "52.9538")
r.close()
Loading
Loading