summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Emilia Torino <emilia.torino@canonical.com>2019-07-22 16:59:23 -0300
committerMaria Emilia Torino <emilia.torino@canonical.com>2019-07-22 16:59:23 -0300
commitda5ee006a903908470de4464c5b1d93f47a546a5 (patch)
treeb951c18b65b58561407c6c28658917c232c141e2
parente3fc6dc09aeec5ffb084f2e4a7318e4dd6348b75 (diff)
parentfed8d43f96f2f6085493bf8b2f779cc5e1195476 (diff)
Merge branch 'master' of git+ssh://git.launchpad.net/qa-regression-testing into docker_testdocker_test
-rw-r--r--README.testing25
-rw-r--r--scripts/apparmor/patches/r3556-drop-CMD_CONTINUE.patch35
-rwxr-xr-xscripts/test-apparmor.py19
-rwxr-xr-xscripts/test-kernel-security.py10
-rwxr-xr-xscripts/test-squid.py110
-rwxr-xr-xscripts/testlib_httpd.py27
6 files changed, 150 insertions, 76 deletions
diff --git a/README.testing b/README.testing
index 513e8d77..1d9ba0ed 100644
--- a/README.testing
+++ b/README.testing
@@ -218,7 +218,6 @@ Build compare bin log
-----------------------------
Xenial - -
Bionic - -
-Cosmic - -
Disco - -
Eoan - -
@@ -226,7 +225,6 @@ ABI (libs only) i386 amd64
-----------------------------
Xenial - -
Bionic - -
-Cosmic - -
Disco - -
Eoan - -
@@ -234,7 +232,6 @@ Build i386 amd64 armhf
--------------------------------------
Xenial - - -
Bionic - - -
-Cosmic - - -
Disco - - -
Eoan - - -
@@ -242,7 +239,6 @@ Test Suite i386 amd64 armhf
--------------------------------------
Xenial - - -
Bionic - - -
-Cosmic - - -
Disco - - -
Eoan - - -
@@ -250,21 +246,20 @@ QA Regression i386 amd64 armhf
--------------------------------------
Xenial - - -
Bionic - - -
-Cosmic - - -
Disco - - -
Eoan - - -
-Overall* Xenial Bionic Cosmic Eoan
+Overall* Xenial Bionic Eoan
---------------------------------------------------------
-Release - - - -
-Version - - - -
-Changelog Text - - - -
-Patched during build - - - -
-Build log compare - - - -
-Build - - - -
-Upgrade - - - -
-Test Suite - - - -
-QA - - - -
+Release - - -
+Version - - -
+Changelog Text - - -
+Patched during build - - -
+Build log compare - - -
+Build - - -
+Upgrade - - -
+Test Suite - - -
+QA - - -
* this is really a high-level combination of SecurityTeam/UpdateProcedures and
the other checklists
diff --git a/scripts/apparmor/patches/r3556-drop-CMD_CONTINUE.patch b/scripts/apparmor/patches/r3556-drop-CMD_CONTINUE.patch
deleted file mode 100644
index 016a31e1..00000000
--- a/scripts/apparmor/patches/r3556-drop-CMD_CONTINUE.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Description: Drop CMD_CONTINUE from ui.py (twice)
- .
- The latest version of pyflakes (1.3.0 / python 3.5) complains that
- CMD_CONTINUE is defined twice in ui.py (with different texts).
- .
- Funnily CMD_CONTINUE isn't used anywhere, so we can just drop both.
- .
-
- .
- Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk, 2.10 and 2.9
-Origin: commit, revision id: apparmor@cboltz.de-20161003190129-lk80ajf2op2zvs00
-Author: Christian Boltz <apparmor@cboltz.de>
-Last-Update: 2016-10-03
-X-Bzr-Revision-Id: apparmor@cboltz.de-20161003190129-lk80ajf2op2zvs00
-
-=== modified file 'utils/apparmor/ui.py'
---- old/utils/apparmor/ui.py 2016-10-01 18:21:06 +0000
-+++ new/utils/apparmor/ui.py 2016-10-03 19:01:29 +0000
-@@ -249,7 +249,6 @@
- 'CMD_EXEC_IX_ON': _('(X) ix On'),
- 'CMD_EXEC_IX_OFF': _('(X) ix Off'),
- 'CMD_SAVE': _('(S)ave Changes'),
-- 'CMD_CONTINUE': _('(C)ontinue Profiling'),
- 'CMD_NEW': _('(N)ew'),
- 'CMD_GLOB': _('(G)lob'),
- 'CMD_GLOBEXT': _('Glob with (E)xtension'),
-@@ -280,7 +279,6 @@
- 'CMD_NET_FAMILY': _('Allow Network Fa(m)ily'),
- 'CMD_OVERWRITE': _('(O)verwrite Profile'),
- 'CMD_KEEP': _('(K)eep Profile'),
-- 'CMD_CONTINUE': _('(C)ontinue'),
- 'CMD_IGNORE_ENTRY': _('(I)gnore')
- }
-
-
diff --git a/scripts/test-apparmor.py b/scripts/test-apparmor.py
index 17384f49..9082d0aa 100755
--- a/scripts/test-apparmor.py
+++ b/scripts/test-apparmor.py
@@ -1587,8 +1587,8 @@ class ApparmorTestsuites(testlib.TestlibCase):
self._apply_patch('tests-convert_ptrace_getregset.patch')
# compensate for LP: #1830984
- if self.lsb_release['Release'] == 16.04 and self.kernel_at_least("4.4") and \
- not self.kernel_at_least("4.8"):
+ if (self.lsb_release['Release'] == 14.04 or self.lsb_release['Release'] == 16.04) and \
+ self.kernel_at_least("4.4") and not self.kernel_at_least("4.8"):
self._apply_patch('tests-add_mmap_perm.patch')
# add patch to compensate for missing sysctl(2) syscall support in
@@ -1631,16 +1631,6 @@ class ApparmorTestsuites(testlib.TestlibCase):
if self.lsb_release['Release'] <= 18.04 and testlib.dpkg_compare_installed_version('apparmor', 'lt', '2.12-3ubuntu1~'):
self._apply_patch('tests-readdir-lp1674245.patch')
- # Temporarily apply this patch in Zesty to fix a test failure. Only
- # apply it to the current package version so that the next person
- # that does an apparmor upload will be reminded to include this
- # patch while they're doing their QA. Note that this patch has been
- # pushed to the apparmor-ubuntu-citrain branch:
- #
- # https://bazaar.launchpad.net/~apparmor-dev/apparmor/apparmor-ubuntu-citrain/revision/1604
- if self.lsb_release['Release'] == 17.04 and testlib.dpkg_compare_installed_version('apparmor', 'le', '2.10.95-4ubuntu5.2'):
- self._apply_patch('3556-drop-CMD_CONTINUE.patch')
-
# 4.11 kernel doesn't allow writing path_max after boot
# for now, mark longpath test as XFAIL if can't write
# path_max parameter. All older supported release of
@@ -1694,13 +1684,14 @@ class ApparmorTestsuites(testlib.TestlibCase):
sys.stdout.flush()
patches = [
- 'tests-convert_ptrace_getregset.patch',
'r2541-tests-adjust-for-parser-escape-fixes.patch',
'r2719-parser-tests.patch',
'r3219-make-sysctl-test-more-resiliant.patch',
'r3376-parser-tests.patch',
'r3401-backport-tests-adjust-expected-errno-for-change-profile.patch',
- 'r3488-3489-fix_onexec_test_races.patch'
+ 'r3488-3489-fix_onexec_test_races.patch',
+ 'tests-convert_ptrace_getregset.patch',
+ 'tests-readdir-lp1674245.patch',
]
for patch in patches:
diff --git a/scripts/test-kernel-security.py b/scripts/test-kernel-security.py
index cddc1594..c4027fc3 100755
--- a/scripts/test-kernel-security.py
+++ b/scripts/test-kernel-security.py
@@ -2247,9 +2247,13 @@ class KernelSecurityConfigTest(KernelSecurityBaseTest):
'''Ensure CONFIG_SECURITY_SELINUX_DISABLE is disabled (LP: #1680315)'''
expected = False
- if not self.kernel_at_least('4.11'):
- expected = True
- self._skipped("l")
+ if not self.kernel_at_least('4.12'):
+ # Don't bother checking before 4.12 because RO after init
+ # LSM structs is not supported prior to then.
+ self._skipped("Kernels before 4.12 don't support LSM hooks being RO after init, " +
+ "so disabling CONFIG_SECURITY_SELINUX_DISABLE is not necessary")
+ return
+
self.assertKernelConfig('SECURITY_SELINUX_DISABLE', expected)
# Intrepid and newer
diff --git a/scripts/test-squid.py b/scripts/test-squid.py
index f34bf84f..e0f24d0b 100755
--- a/scripts/test-squid.py
+++ b/scripts/test-squid.py
@@ -73,9 +73,11 @@
from __future__ import print_function
import unittest
import os
+import subprocess
import sys
import testlib
import testlib_httpd
+import time
try:
from private.qrt.squid import PrivateSquidTest
@@ -91,15 +93,17 @@ class BasicTest(testlib_httpd.HttpdCommon, PrivateSquidTest):
# Trusty uses upstart
if self.lsb_release['Release'] == 14.04:
- self._set_initscript("squid3", initdaemon="upstart")
+ self.initscript = "squid3"
+ self.initdaemon = "upstart"
elif self.lsb_release['Release'] >= 16.04:
- self._set_initscript("/etc/init.d/squid")
+ self.initscript = "squid"
+ self.initdaemon = "systemd"
else:
- self._set_initscript("/etc/init.d/squid3")
-
- testlib_httpd.HttpdCommon._setUp(self)
+ self.initscript = "/etc/init.d/squid3"
+ self.initdaemon = "sysv"
self.gophermap = "/var/gopher/gophermap"
+ self.squid_conf = "/etc/squid/squid.conf"
if self.lsb_release['Release'] >= 19.04:
self.aa_profile = "usr.sbin.squid"
@@ -112,10 +116,86 @@ class BasicTest(testlib_httpd.HttpdCommon, PrivateSquidTest):
# unconfined
self.aa_unload_at_teardown = False
+ self.squid_users = "/etc/squid/qrt_squid_users"
+ self.squid_username = "testuser"
+ self.squid_password = "testpass"
+ # testuser/testpass, created with htpasswd
+ testlib.create_fill(self.squid_users, "testuser:$apr1$kpAHY2dB$cDkfC8l8lW0Eha9K/kCTr.")
+
+ self._restart()
+
def tearDown(self):
'''Shutdown methods'''
- testlib_httpd.HttpdCommon._tearDown(self)
+
+ #self._stop()
+
+ if os.path.exists(self.squid_users):
+ os.unlink(self.squid_users)
+
testlib.config_restore(self.gophermap)
+ testlib.config_restore(self.squid_conf)
+
+ def _start(self):
+ '''Start squid'''
+ #print(self.initscript + " start")
+ expected = 0
+ if self.initdaemon == 'upstart':
+ rc, report = testlib.cmd(['start', self.initscript])
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'start', self.initscript])
+ else:
+ rc, report = testlib.cmd([self.initscript, 'start'])
+ result = 'Got exit code %d, expected %d\n' % (rc, expected)
+ self.assertEqual(expected, rc, result + report)
+ time.sleep(2)
+
+ def _stop(self):
+ '''Stop squid'''
+ #print(self.initscript + " stop")
+ expected = 0
+ if self.initdaemon == 'upstart':
+ rc, report = testlib.cmd(['stop', self.initscript])
+ if rc != expected and 'Unknown instance' in report:
+ rc = 0
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'stop', self.initscript])
+ else:
+ rc, report = testlib.cmd([self.initscript, 'stop'])
+ result = 'Got exit code %d, expected %d\n' % (rc, expected)
+ self.assertEqual(expected, rc, result + report)
+
+ def _reload(self):
+ '''Reload squid'''
+ #print(self.initscript + " reload")
+ expected = 0
+ if self.initdaemon == 'upstart':
+ rc, report = testlib.cmd(['reload', self.initscript])
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'reload', self.initscript])
+ else:
+ rc, report = testlib.cmd([self.initscript, 'force-reload'])
+ result = 'Got exit code %d, expected %d\n' % (rc, expected)
+ self.assertEqual(expected, rc, result + report)
+
+ def _restart(self):
+ '''Restart squid'''
+ #print(self.initscript + " restart")
+ self._stop()
+ self._start()
+
+ def _setup_basic_auth(self):
+ '''Setup basic auth'''
+
+ testlib.config_replace(self.squid_conf, "", append=True)
+
+ subprocess.call(['sed', '-i', 's/^##auth_param basic program.*$/auth_param basic program \/usr\/lib\/squid\/basic_ncsa_auth \/etc\/squid\/qrt_squid_users/', self.squid_conf])
+ subprocess.call(['sed', '-i', 's/^##auth_param basic children 5 startup=5 idle=1$/auth_param basic children 5 startup=5 idle=1/', self.squid_conf])
+ subprocess.call(['sed', '-i', 's/^##auth_param basic realm Squid proxy-caching web server$/auth_param basic realm Squid proxy-caching web server/', self.squid_conf])
+ subprocess.call(['sed', '-i', 's/^##auth_param basic credentialsttl 2 hours$/auth_param basic credentialsttl 2 hours/', self.squid_conf])
+ subprocess.call(['sed', '-i', "s/^acl SSL_ports port 443$/acl authenticatedusers proxy_auth REQUIRED\\nacl SSL_ports port 443/", self.squid_conf])
+ subprocess.call(['sed', '-i', 's/^http_access allow localhost$/http_access allow authenticatedusers/', self.squid_conf])
+
+ self._restart()
def test_daemons(self):
'''Test daemon'''
@@ -147,6 +227,24 @@ class BasicTest(testlib_httpd.HttpdCommon, PrivateSquidTest):
'''Test ftp'''
self._test_url_proxy("ftp://ftp.ubuntu.com/", "irectory", "http://localhost:3128/")
+ def test_basic_auth(self):
+ '''Test basic auth'''
+
+ self._setup_basic_auth()
+
+ self._test_url_proxy("http://www.ubuntu.com/", "Canonical",
+ "http://localhost:3128/", self.squid_username,
+ self.squid_password)
+
+ def test_basic_auth_wrong(self):
+ '''Test basic auth - wrong password'''
+
+ self._setup_basic_auth()
+
+ self._test_url_proxy("http://www.ubuntu.com/", "Cache Access Denied.",
+ "http://localhost:3128/", self.squid_username,
+ "wrongpass")
+
def test_squidclient(self):
'''Test squidclient'''
urls = ['http://www.ubuntu.com/', 'https://wiki.ubuntu.com/', \
diff --git a/scripts/testlib_httpd.py b/scripts/testlib_httpd.py
index c079831d..ff047a4d 100755
--- a/scripts/testlib_httpd.py
+++ b/scripts/testlib_httpd.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
#
# testlib_httpd.py quality assurance test script
-# Copyright (C) 2008-2013 Canonical Ltd.
+# Copyright (C) 2008-2019 Canonical Ltd.
# Author: Jamie Strandboge <jamie@canonical.com>
# Author: Marc Deslauriers <marc.deslauriers@canonical.com>
#
@@ -101,6 +101,8 @@ class HttpdCommon(testlib.TestlibCase):
expected = 0
if self.initdaemon == 'upstart':
rc, report = testlib.cmd(['start', self.initscript])
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'start', self.initscript])
else:
rc, report = testlib.cmd([self.initscript, 'start'])
result = 'Got exit code %d, expected %d\n' % (rc, expected)
@@ -115,6 +117,8 @@ class HttpdCommon(testlib.TestlibCase):
rc, report = testlib.cmd(['stop', self.initscript])
if rc != expected and 'Unknown instance' in report:
rc = 0
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'stop', self.initscript])
else:
rc, report = testlib.cmd([self.initscript, 'stop'])
result = 'Got exit code %d, expected %d\n' % (rc, expected)
@@ -268,9 +272,12 @@ class HttpdCommon(testlib.TestlibCase):
def _reload(self):
'''Reload httpd'''
+ #print self.initscript,"reload"
expected = 0
if self.initdaemon == 'upstart':
rc, report = testlib.cmd(['reload', self.initscript])
+ elif self.initdaemon == 'systemd':
+ rc, report = testlib.cmd(['systemctl', 'reload', self.initscript])
else:
rc, report = testlib.cmd([self.initscript, 'force-reload'])
result = 'Got exit code %d, expected %d\n' % (rc, expected)
@@ -278,6 +285,7 @@ class HttpdCommon(testlib.TestlibCase):
def _restart(self):
'''Restart httpd'''
+ #print self.initscript,"restart"
self._stop()
self._start()
@@ -317,9 +325,22 @@ NameVirtualHost *:443
testlib.create_fill(self.ssl_site, site_contents)
self._reload()
- def _test_url_proxy(self, url="http://localhost/", content="", proxy="localhost:3128"):
+ def _test_url_proxy(self, url="http://localhost/", content="",
+ proxy="localhost:3128", username=None,
+ password=None):
'''Test the given url'''
- rc, report = testlib.cmd(['elinks', '-verbose', '2', '-no-home', '1', '-eval', 'set protocol.ftp.proxy.host = "%s"' %(proxy), '-eval', 'set protocol.http.proxy.host = "%s"' %(proxy), '-eval', 'set protocol.https.proxy.host = "%s"' %(proxy), '-dump', url])
+
+ cmd = ['elinks', '-verbose', '2', '-no-home', '1',
+ '-eval', 'set protocol.ftp.proxy.host = "%s"' %(proxy),
+ '-eval', 'set protocol.http.proxy.host = "%s"' %(proxy),
+ '-eval', 'set protocol.https.proxy.host = "%s"' %(proxy)]
+
+ if username:
+ cmd += ['-eval', 'set protocol.http.proxy.user = "%s"' %(username),
+ '-eval', 'set protocol.http.proxy.passwd = "%s"' %(password)]
+
+ cmd += ['-dump', url]
+ rc, report = testlib.cmd(cmd)
expected = 0
result = 'Got exit code %d, expected %d\n' % (rc, expected)
self.assertEqual(expected, rc, result + report)