Merge ~racb/ubuntu/+source/squid3:merge into ~usd-import-team/ubuntu/+source/squid3:debian/sid
- Git
- lp:~racb/ubuntu/+source/squid3
- merge
- Merge into debian/sid
| Status: | Merged |
|---|---|
| Merge reported by: | Robie Basak |
| Merged at revision: | not available |
| Proposed branch: | ~racb/ubuntu/+source/squid3:merge |
| Merge into: | ~usd-import-team/ubuntu/+source/squid3:debian/sid |
| Diff against target: |
2828 lines (+2552/-30) 19 files modified
debian/NEWS.debian (+11/-0) debian/changelog (+678/-1) debian/control (+6/-6) debian/patches/90-cf.data.ubuntu.patch (+12/-0) debian/patches/99-ubuntu-ssl-cert-snakeoil.patch (+22/-0) debian/patches/series (+2/-0) debian/rules (+6/-1) debian/squid.install (+3/-0) debian/squid.preinst (+15/-0) debian/squid.rc (+0/-2) debian/squid3.postinst (+0/-11) debian/squid3.preinst (+0/-8) debian/tests/control (+4/-0) debian/tests/squid (+11/-0) debian/tests/test-squid.py (+221/-0) debian/tests/testlib.py (+1133/-0) debian/tests/testlib_httpd.py (+352/-0) debian/tests/upstream-test-suite (+1/-1) debian/usr.sbin.squid (+75/-0) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| ChristianEhrhardt | Approve on 2017-02-10 | ||
| Ubuntu Server Dev import team | 2017-02-06 | Pending | |
|
Review via email:
|
|||
Commit Message
Description of the Change
| ChristianEhrhardt (paelzer) wrote : | # |
| Robie Basak (racb) wrote : | # |
Thank you for the review!
On Thu, Feb 09, 2017 at 01:05:04PM -0000, ChristianEhrhardt wrote:
> - There is a new ubuntu 9 with CVEs in Yakkety
> ok - I checked, both patches are in the new upstream
> ok - I wondered if we would need to "drop" that in the changelog, but found a generic "Drop security fixes: all included in 3.5.23 upstream."
> ? - But we might want/need the 3.5.12-1ubuntu9 in the merged version history right?
It's in Zesty, uploaded last week, and I missed this, basing my merge
against 3.5.12-1ubuntu8 since I'd done the work earlier. Thank you for
spotting it!
In terms of process, I suppose there's always a race here. My old/ubuntu
tag is behind (pointing at import/
(work in progress) is capable of spotting this/reducing the race.
I will redo my git-merge-
3.5.12-1ubuntu9.
> - Why are you "Robie BAsak @ horsea" in some commits (upper case A and @horsea)
> ? - Do you want/need to rewrite that?
Well spotted :)
The commits data back from before we were saving the logical commits, so
I didn't care about the attribution back then and never set git's
user.email on temporary hosts I used to do the work. I rewrote the
attribution for my merge branch going forward, but I didn't do the
logical tag since that would mutate the commit hashes that I had in my
notes. But now that I'm done, I guess I can rewrite this too before
pushing.
> - 5a9b760 "Include upgrade migration handling" does this no more change the cache format (dropped from news)
> ok -> ok, dropped anyway so old text is valid now
> ok -> well later comes "Note historical migration in d/NEWS.debian" 96d065d
> ? -> with that the text is in place again - I wonder if that is a mistake (to no more mention the format incompatibility)
> ? -> the changelog of this only says "Correct attribution in d/NEWS.debian." but you also change content, need to adapt?
I've come across Ubuntu-specific entries in debian/NEWS before, so I put
this change that I'm carrying forward in the same category. Since we
merge debian/changelog without a specific note in debian/changelog, I
have also been merging debian/NEWS without a specific note in
debian/changelog. In squid3 I've been treating debian/NEWS.debian the
same way. So I only noted the change to debian/NEWS.debian, not the
merge of the previous Ubuntu delta in debian/NEWS.debian. Does that make
sense, or have I misunderstood your point?
| ChristianEhrhardt (paelzer) wrote : | # |
> > ok -> well later comes "Note historical migration in d/NEWS.debian"
> 96d065d
> > ? -> with that the text is in place again - I wonder if that is a
> mistake (to no more mention the format incompatibility)
> > ? -> the changelog of this only says "Correct attribution in
> d/NEWS.debian." but you also change content, need to adapt?
>
> I've come across Ubuntu-specific entries in debian/NEWS before, so I put
> this change that I'm carrying forward in the same category. Since we
> merge debian/changelog without a specific note in debian/changelog, I
> have also been merging debian/NEWS without a specific note in
> debian/changelog. In squid3 I've been treating debian/NEWS.debian the
> same way. So I only noted the change to debian/NEWS.debian, not the
> merge of the previous Ubuntu delta in debian/NEWS.debian. Does that make
> sense, or have I misunderstood your point?
I'm fine for the (not)mentioning in the changelog now.
I still wonder though if this change in NEWS dropped important information.
The following part is effectively gone:
- Please note that cache store format changed from squid 2.x and cannot be reused with squid 3.x
I wonder - since we try to move it automatically - is it:
- actually not incompatible (then all is fine here)?
- do we move stuff that might break as it is actually incompatible?
- should we leave the note that it is incompatible intact in NEWS (even when adding Steves section)?
I understand the comment was squid2 -> squid3 and we now move squid3 -> squid.
But it is confusing at least to me - I'd love to have that in a new NEWS section instead of modifying the old one.
- 0525413... by Robie Basak on 2017-02-09
-
git-merge-
changelogs
| Robie Basak (racb) wrote : | # |
I've reworked the merge against 3.5.12-1ubuntu9. old/ubuntu now points to import/
| Robie Basak (racb) wrote : | # |
My old merge was merge.v8 (1bc7eb7). This is merge.v9 (43e5b2d). For convenience, here is the diff between the two: http://
Preview Diff
| 1 | diff --git a/debian/NEWS.debian b/debian/NEWS.debian |
| 2 | index 3987e99..7a738d5 100644 |
| 3 | --- a/debian/NEWS.debian |
| 4 | +++ b/debian/NEWS.debian |
| 5 | @@ -26,6 +26,17 @@ squid3 (3.5.6-1) unstable; urgency=medium |
| 6 | that cache store format changed from squid 2.x and cannot be reused with |
| 7 | squid 3.x |
| 8 | |
| 9 | + [ Robie Basak ] |
| 10 | + In Ubuntu, data in /var/spool/squid3 *was* moved automatically on upgrade to |
| 11 | + Xenial (3.5.12-1ubuntu7). Upgrades from before Xenial to after Xenial are not |
| 12 | + supported; you must upgrade through Xenial. Details of the historic migration |
| 13 | + path are in Steve's note below. |
| 14 | + |
| 15 | + [ Steve Langasek ] |
| 16 | + An attempt will be made to move the data in /var/spool/squid3 automatically. |
| 17 | + If this is a mountpoint, the move will fail and you will need to migrate |
| 18 | + your mount configuration by hand. |
| 19 | + |
| 20 | -- Luigi Gangitano <luigi@debian.org> Wed, 22 Jul 2015 15:48:13 +0200 |
| 21 | |
| 22 | squid3 (3.0.STABLE15-1) unstable; urgency=low |
| 23 | diff --git a/debian/changelog b/debian/changelog |
| 24 | index 7a90b8d..776ec61 100644 |
| 25 | --- a/debian/changelog |
| 26 | +++ b/debian/changelog |
| 27 | @@ -1,3 +1,52 @@ |
| 28 | +squid3 (3.5.23-1ubuntu1) zesty; urgency=medium |
| 29 | + |
| 30 | + * Merge from Debian (LP: #1644538). Remaining changes: |
| 31 | + - Add additional dep8 tests. |
| 32 | + - Use snakeoil certificates. |
| 33 | + - Add an example refresh pattern for debs. |
| 34 | + - Add disabled by default AppArmor profile. |
| 35 | + - Revert "Set pidfile for systemd's sysv-generator" from Debian. |
| 36 | + - Drop wrong short-circuiting of various invocations; we always want to |
| 37 | + call the debhelper block. |
| 38 | + - Add missing Pre-Depends on adduser. |
| 39 | + - Enable autoreconf. This is no longer required for the security updates, |
| 40 | + but is needed for the seddery of test-suite/Makefile.am in |
| 41 | + d/t/upstream-test-suite. |
| 42 | + * Drop changes (adopted in Debian): |
| 43 | + - Run sarg-reports if present before rotating logs. |
| 44 | + - Add lsb-release build dep. |
| 45 | + * Drop changes that no longer make a functional difference in Ubuntu, but may |
| 46 | + still be relevant to send to Debian: |
| 47 | + - d/squid3.postinst: don't try to stop squid3 again. |
| 48 | + - d/squid3.postrm: don't rm -f conffiles in purge. |
| 49 | + - Drop squid3 dependencies on ${shlib:Depends} and lsb-base. |
| 50 | + - Drop creation of /etc/squid. |
| 51 | + * Drop unnecessary changes: |
| 52 | + - Add executable bits to d/squid.preinst. |
| 53 | + * Drop changes relating to the upgrade path from prior to Xenial, so no |
| 54 | + longer required: |
| 55 | + - /var/spool/squid3 upgrade path handling. |
| 56 | + - Conffile upgrade path handling. |
| 57 | + - Remove redundant version-guarded restart code from squid postinst. |
| 58 | + - Clean up apparmor links for usr.sbin.squid3 on upgrade. |
| 59 | + - Attempt to migrate /var/log/squid3 -> /var/log/squid on upgrade. |
| 60 | + - Add Breaks on older ufw to fix upgrade path. |
| 61 | + - Use Breaks instead of Conflicts. Instead, drop the Conflicts/Replaces |
| 62 | + entirely (see below). |
| 63 | + * Drop security fixes: all included in 3.5.23 upstream. |
| 64 | + * Drop Conflicts/Replaces of squid against squid3. In Ubuntu, the migration |
| 65 | + happened in Xenial, so no upgrade path still requires this code. This |
| 66 | + reduces upgrade ordering difficulty. |
| 67 | + * Fix failing autopkgtests: |
| 68 | + - Adjust Python module dependencies. |
| 69 | + - Correctly handle the squid3 -> squid rename. |
| 70 | + - Adjust seddery for upstream test squid binary location. |
| 71 | + * Drop dependency on init-system-helpers. This was introduced in LP 1432683. |
| 72 | + Since we no longer ship an upstart job, it is no longer required. |
| 73 | + * Correct attribution and add explanatory note in d/NEWS.debian. |
| 74 | + |
| 75 | + -- Robie Basak <robie.basak@ubuntu.com> Tue, 24 Jan 2017 15:47:44 +0000 |
| 76 | + |
| 77 | squid3 (3.5.23-1) unstable; urgency=high |
| 78 | |
| 79 | [ Amos Jeffries <amosjeffries@squid-cache.org> ] |
| 80 | @@ -119,6 +168,186 @@ squid3 (3.5.14-1) unstable; urgency=medium |
| 81 | |
| 82 | -- Luigi Gangitano <luigi@debian.org> Tue, 16 Feb 2016 23:14:00 +0100 |
| 83 | |
| 84 | +squid3 (3.5.12-1ubuntu9) zesty; urgency=medium |
| 85 | + |
| 86 | + * SECURITY UPDATE: cookie data leak via If-Not-Modified HTTP conditional |
| 87 | + - debian/patches/CVE-2016-10002.patch: properly handle combination of |
| 88 | + If-Match and a Cache Hit in src/LogTags.h, src/client_side.cc, |
| 89 | + src/client_side_reply.cc, src/client_side_reply.h. |
| 90 | + - CVE-2016-10002 |
| 91 | + * SECURITY UPDATE: incorrect HTTP Request header comparison |
| 92 | + - debian/patches/CVE-2016-10003.patch: don't share private responses |
| 93 | + with collapsed client in src/client_side_reply.cc. |
| 94 | + - CVE-2016-10003 |
| 95 | + |
| 96 | + -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Fri, 03 Feb 2017 13:07:31 -0500 |
| 97 | + |
| 98 | +squid3 (3.5.12-1ubuntu8) yakkety; urgency=medium |
| 99 | + |
| 100 | + * SECURITY UPDATE: denial of service via pinger and ICMPv6 packet |
| 101 | + - debian/patches/CVE-2016-3947.patch: fix sizes in src/icmp/Icmp6.cc. |
| 102 | + - CVE-2016-3947 |
| 103 | + * SECURITY UPDATE: denial of service and possible code execution via |
| 104 | + seeding manager reporter with crafted data |
| 105 | + - debian/patches/CVE-2016-4051.patch: use dynamic MemBuf for internal |
| 106 | + content generation in tools/cachemgr.cc, src/tests/stub_cbdata.cc, |
| 107 | + src/tests/stub_mem.cc, tools/Makefile.am. |
| 108 | + - CVE-2016-4051 |
| 109 | + * SECURITY UPDATE: denial of service or arbitrary code execution via |
| 110 | + crafted ESI responses |
| 111 | + - debian/patches/CVE-2016-4052.patch: perform bounds checking and |
| 112 | + remove asserts in src/esi/Esi.cc. |
| 113 | + - CVE-2016-4052 |
| 114 | + - CVE-2016-4053 |
| 115 | + - CVE-2016-4054 |
| 116 | + * SECURITY UPDATE: cache-poisoning attacks via an HTTP request with an |
| 117 | + absolute-URI |
| 118 | + - debian/patches/CVE-2016-4553.patch: properly handle condition in |
| 119 | + src/client_side.cc |
| 120 | + - CVE-2016-4553 |
| 121 | + * SECURITY UPDATE: same-origin bypass and cache-poisoning attack via |
| 122 | + crafted HTTP host header |
| 123 | + - debian/patches/CVE-2016-4554.patch: properly handle whitespace in |
| 124 | + src/mime_header.cc. |
| 125 | + - CVE-2016-4554 |
| 126 | + * SECURITY UPDATE: denial of service via ESI responses |
| 127 | + - debian/patches/CVE-2016-4555.patch: fix segfaults in |
| 128 | + src/client_side_request.cc, src/esi/Context.h, src/esi/Esi.cc. |
| 129 | + - CVE-2016-4555 |
| 130 | + - CVE-2016-4556 |
| 131 | + * debian/rules: include autoreconf.mk. |
| 132 | + * debian/control: add dh-autoreconf to BuildDepends. |
| 133 | + |
| 134 | + -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Wed, 08 Jun 2016 08:05:32 -0400 |
| 135 | + |
| 136 | +squid3 (3.5.12-1ubuntu7.1) xenial; urgency=medium |
| 137 | + |
| 138 | + * Add Breaks on older ufw to fix upgrade path (LP: #1571174). |
| 139 | + |
| 140 | + -- Robie Basak <robie.basak@ubuntu.com> Thu, 12 May 2016 11:03:06 +0000 |
| 141 | + |
| 142 | +squid3 (3.5.12-1ubuntu7) xenial; urgency=medium |
| 143 | + |
| 144 | + * Update apparmor profile to be correct for maas-proxy. |
| 145 | + |
| 146 | + -- LaMont Jones <lamont@ubuntu.com> Tue, 12 Apr 2016 13:05:00 -0600 |
| 147 | + |
| 148 | +squid3 (3.5.12-1ubuntu6) xenial; urgency=medium |
| 149 | + |
| 150 | + * Attempt to migrate /var/log/squid3 -> /var/log/squid on upgrade. |
| 151 | + * Update apparmor profile for s/squid3/squid/ and /dev/shm access. |
| 152 | + |
| 153 | + -- Adam Conrad <adconrad@ubuntu.com> Sun, 03 Apr 2016 21:34:50 -0600 |
| 154 | + |
| 155 | +squid3 (3.5.12-1ubuntu5) xenial; urgency=medium |
| 156 | + |
| 157 | + * Use versioned Breaks/Replaces instead of an unversioned Conflicts, to |
| 158 | + further clean up the upgrade ordering. |
| 159 | + |
| 160 | + -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 01 Apr 2016 21:05:38 +0000 |
| 161 | + |
| 162 | +squid3 (3.5.12-1ubuntu4) xenial; urgency=medium |
| 163 | + |
| 164 | + * Remove redundant version-guarded restart code from squid postinst, which |
| 165 | + doesn't do the right thing on Ubuntu upgrades. |
| 166 | + * Remove duplicated conffile handling from the squid3 dummy package with |
| 167 | + extreme prejudice. The conffile moving absolutely *must* be done |
| 168 | + exclusively in the squid package; trying to do it in the squid3 package |
| 169 | + causes pristine conffiles to be silently overwritten with any |
| 170 | + locally-modified version from the squid3 package, with hilarious effect. |
| 171 | + * Adjust squid.{pre,post}inst to trick dpkg-maintscript-helper into |
| 172 | + believing we had a previously installed version of this package even if |
| 173 | + we did not, which appears to be a requirement for mv_conffile to DTRT. |
| 174 | + This is certainly a dpkg bug that needs to be filed. |
| 175 | + * Move all Ubuntu-specific dpkg-maintscript-helper delta into |
| 176 | + debian/squid.maintscript for clarity/sanity. Among other things, |
| 177 | + this uncovers a bug where we're trying to call both mv_conffile and |
| 178 | + rm_conffile for /etc/init.d/squid3. |
| 179 | + * debian/squid3.{pre,post}inst: drop wrong short-circuiting of various |
| 180 | + invocations; we always want to call the debhelper block. |
| 181 | + * debian/squid3.postinst: don't try to stop squid3 again, this is |
| 182 | + redundant. |
| 183 | + * debian/squid3.postrm: don't rm -f conffiles in purge when dpkg already |
| 184 | + handles these. |
| 185 | + * Add missing pre-depends on adduser |
| 186 | + * Anchor the Conflicts/Replaces to the version of the package that |
| 187 | + introduced the name change in Ubuntu, to avoid upgrade ordering problems |
| 188 | + later. |
| 189 | + * Include upgrade migration handling for /var/spool/squid3 -> |
| 190 | + /var/spool/squid. This won't work if /var/spool/squid3 is a mount point, |
| 191 | + so fail gracefully, but leaving two full squid cache directories around |
| 192 | + after upgrade is a nuisance. |
| 193 | + * Remove empty /etc/squid3 dir on upgrade. |
| 194 | + * Clean up apparmor links for usr.sbin.squid3 on upgrade. We don't migrate |
| 195 | + these apparmor settings over, so at least don't leave stale links behind. |
| 196 | + |
| 197 | + -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 31 Mar 2016 19:01:47 -0700 |
| 198 | + |
| 199 | +squid3 (3.5.12-1ubuntu3) xenial; urgency=medium |
| 200 | + |
| 201 | + * Revert last postinst change as it's buggy. |
| 202 | + * Remove /etc/init.d/squid3 from preinst on upgrade. |
| 203 | + |
| 204 | + -- Stéphane Graber <stgraber@ubuntu.com> Tue, 29 Mar 2016 22:46:16 -0400 |
| 205 | + |
| 206 | +squid3 (3.5.12-1ubuntu2) xenial; urgency=medium |
| 207 | + |
| 208 | + * debian/squid.postinst: Fix dist-upgrade of squid by detecting service |
| 209 | + name (/etc/init.d/squid vs. squid3). |
| 210 | + |
| 211 | + -- Ryan Harper <ryan.harper@canonical.com> Mon, 28 Mar 2016 11:20:35 -0500 |
| 212 | + |
| 213 | +squid3 (3.5.12-1ubuntu1) xenial; urgency=medium |
| 214 | + |
| 215 | + * Merge from Debian (LP: #1473691). Remaining changes: |
| 216 | + - Add dep8 tests. |
| 217 | + - Use snakeoil certificates. |
| 218 | + - Run sarg-reports if present before rotating logs |
| 219 | + - debian/patches/90-cf.data.ubuntu.dpatch: add an example refresh |
| 220 | + pattern for debs. |
| 221 | + - Add disabled by default AppArmor profile. Versioned dependency on |
| 222 | + init-system-helpers (>> 1.22ubuntu5) to ensure we have the |
| 223 | + apparmor-profile-load script at boot time. |
| 224 | + * Drop changes: |
| 225 | + - No longer needed: |
| 226 | + + Upstart job. |
| 227 | + + Dependency package for squid -> squid3: depcrecated; the transitional package now runs the other way. |
| 228 | + + Fix perl & pod2man config.tests. |
| 229 | + + fix-logical-not-parentheses-warning.patch. |
| 230 | + + fix-pod2name-pipe-failure.patch. |
| 231 | + + --disable-strict-error-checking to fix FTBFS. |
| 232 | + - NEWS.Debian: no longer relevant. |
| 233 | + - Hardening options: deprecated. |
| 234 | + - Add patch to show distribution: fixed in Debian (but see |
| 235 | + lsb-release B-D). |
| 236 | + - Enable parallel build: makes no difference to build time. |
| 237 | + - Force -O2 to work around build failure with -O3: presumed no |
| 238 | + longer needed. |
| 239 | + - Fixed upstream: |
| 240 | + + CVE-2014-3609.patch: confirmed fixed since 3.4.7 from upstream |
| 241 | + advisory. |
| 242 | + + Fix various ICMP handling issues in Squid pinger: confirmed |
| 243 | + fixed since 3.4.7 from upstream advisory. |
| 244 | + + fix-caching-vary-header.patch. |
| 245 | + + netfilter_fix.patch. |
| 246 | + * Drop Testsuite: header from dep8 tests: no longer required since |
| 247 | + dpkg-source >= 1.17.11 does it. |
| 248 | + * Revert "Set pidfile for systemd's sysv-generator" from Debian. |
| 249 | + systemd races the squid daemon for pidfile creation, causing systemd |
| 250 | + to consider the service start to have failed. Work around for now by |
| 251 | + not telling systemd to use the pidfile. |
| 252 | + * Add lsb-release build dep. This is required for the |
| 253 | + --enable-build-info line in debian/rules to work correctly. |
| 254 | + * Correctly rename conffiles migrated by Debian from squid3 to squid. |
| 255 | + * Remove conffile for old upstart job Ubuntu delta. |
| 256 | + * Rename Apparmor profile conffile. |
| 257 | + * Drop old transitional Apparmor code no longer required. |
| 258 | + * Adjust AppArmor profile for squid3->squid rename. |
| 259 | + * Drop versioned AppArmor dependency (transitional; no longer |
| 260 | + required). |
| 261 | + |
| 262 | + -- Robie Basak <robie.basak@ubuntu.com> Thu, 25 Feb 2016 11:42:03 +0000 |
| 263 | + |
| 264 | squid3 (3.5.12-1) unstable; urgency=medium |
| 265 | |
| 266 | [ Amos Jeffries <amosjeffries@squid-cache.org> ] |
| 267 | @@ -371,6 +600,180 @@ squid3 (3.3.8-1.1) unstable; urgency=low |
| 268 | |
| 269 | -- gregor herrmann <gregoa@debian.org> Sat, 23 Nov 2013 21:05:10 +0100 |
| 270 | |
| 271 | +squid3 (3.3.8-1ubuntu17) xenial; urgency=medium |
| 272 | + |
| 273 | + * --disable-strict-error-checking to fix FTBFS due to auto_ptr defined |
| 274 | + in unique pointer headers. (LP: #1521234). |
| 275 | + |
| 276 | + -- Dimitri John Ledkov <xnox@ubuntu.com> Mon, 30 Nov 2015 15:32:14 +0000 |
| 277 | + |
| 278 | +squid3 (3.3.8-1ubuntu16) wily; urgency=medium |
| 279 | + |
| 280 | + [ Tiago Stürmer Daitx ] |
| 281 | + * d/patches/fix-logical-not-parentheses-warning.patch: Fix warning for |
| 282 | + logical-not-parentheses which caused squid to FTBFS. (LP: #1496924) |
| 283 | + * d/patches/netfilter_fix.patch: Backported from Squid Bug #4323. |
| 284 | + (LP: #1496223) |
| 285 | + * d/patches/fix-pod2name-pipe-failure.patch: Add --name parameter to |
| 286 | + pod2man (LP: #1501566) |
| 287 | + * roll back build-dependency to libecap2-dev, this version of squid3 is not |
| 288 | + compatible with libecap3 and libecap3 transition has been rolled back for |
| 289 | + wily. |
| 290 | + |
| 291 | + -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 09 Oct 2015 00:29:47 +0000 |
| 292 | + |
| 293 | +squid3 (3.3.8-1ubuntu15) wily; urgency=medium |
| 294 | + |
| 295 | + * Build-depend on libecap3-dev instead of libecap2-dev. |
| 296 | + |
| 297 | + -- Matthias Klose <doko@ubuntu.com> Wed, 02 Sep 2015 12:16:29 +0200 |
| 298 | + |
| 299 | +squid3 (3.3.8-1ubuntu14) vivid; urgency=medium |
| 300 | + |
| 301 | + * Add versioned dependency on init-system-helpers (>> 1.22ubuntu5) to ensure |
| 302 | + we have the apparmor-profile-load script at boot time. (LP: #1432683) |
| 303 | + |
| 304 | + -- Serge Hallyn <serge.hallyn@ubuntu.com> Thu, 02 Apr 2015 11:12:27 -0500 |
| 305 | + |
| 306 | +squid3 (3.3.8-1ubuntu13) vivid; urgency=medium |
| 307 | + |
| 308 | + * d/squid3.prerm: Removed redundant upstart-only code. Equivalent |
| 309 | + operations are carried out by debhelper-generated code in a more |
| 310 | + generic manner. (LP: #1424508) |
| 311 | + |
| 312 | + -- Oleg Strikov <oleg.strikov@canonical.com> Thu, 05 Mar 2015 14:24:33 +0300 |
| 313 | + |
| 314 | +squid3 (3.3.8-1ubuntu12) vivid; urgency=medium |
| 315 | + |
| 316 | + * debian/tests/testlib_httpd.py: Use "service" command instead of upstart |
| 317 | + specific ones, and simplify the logic. |
| 318 | + * debian/tests/testlib.py, check_exe(): Check /proc/pid/exe symlink instead |
| 319 | + of parsing cmdline; the latter has "(squid-1)" with the init.d script, and |
| 320 | + it's not really what we are interested in. |
| 321 | + |
| 322 | + -- Martin Pitt <martin.pitt@ubuntu.com> Fri, 06 Mar 2015 12:10:59 +0100 |
| 323 | + |
| 324 | +squid3 (3.3.8-1ubuntu11) vivid; urgency=medium |
| 325 | + |
| 326 | + * d/patches/fix-caching-vary-header.patch: Added upstream patch |
| 327 | + for the bug which prevented squid from caching responses with |
| 328 | + Vary header. (LP: #1336742) |
| 329 | + |
| 330 | + -- Oleg Strikov <oleg.strikov@canonical.com> Wed, 04 Mar 2015 15:08:54 +0300 |
| 331 | + |
| 332 | +squid3 (3.3.8-1ubuntu10) vivid; urgency=medium |
| 333 | + |
| 334 | + [Jacek Nykis] |
| 335 | + * d/usr.sbin.squid3: Apparmor profile has been changed to allow child |
| 336 | + processes to run execvp(argv[0], [kidname, ...]). (LP: #1416039) |
| 337 | + |
| 338 | + -- Oleg Strikov <oleg.strikov@canonical.com> Tue, 03 Mar 2015 18:18:20 +0300 |
| 339 | + |
| 340 | +squid3 (3.3.8-1ubuntu9) vivid; urgency=medium |
| 341 | + |
| 342 | + * Fix various ICMP handling issues in Squid pinger. (LP: #1384943) |
| 343 | + |
| 344 | + -- Jorge Niedbalski <jorge.niedbalski@canonical.com> Tue, 18 Nov 2014 14:47:33 -0300 |
| 345 | + |
| 346 | +squid3 (3.3.8-1ubuntu8) utopic; urgency=medium |
| 347 | + |
| 348 | + * SECURITY UPDATE: Ignore Range headers with unidentifiable byte-range |
| 349 | + values |
| 350 | + - debian/patches/CVE-2014-3609.patch: adjust src/HttpHdrRange.cc to |
| 351 | + return an error if unable to determine the byte value for ranges |
| 352 | + - CVE-2014-3609 |
| 353 | + |
| 354 | + -- Jamie Strandboge <jamie@ubuntu.com> Tue, 26 Aug 2014 13:51:07 -0500 |
| 355 | + |
| 356 | +squid3 (3.3.8-1ubuntu7) utopic; urgency=medium |
| 357 | + |
| 358 | + * Put back the init.d script, for compatibility with insserv. (LP: #1323274) |
| 359 | + |
| 360 | + -- Martin Pitt <martin.pitt@ubuntu.com> Mon, 26 May 2014 23:27:57 +0200 |
| 361 | + |
| 362 | +squid3 (3.3.8-1ubuntu6) trusty; urgency=medium |
| 363 | + |
| 364 | + * debian/rules: Force -O2 to work around build failure with -O3. |
| 365 | + |
| 366 | + -- Adam Conrad <adconrad@ubuntu.com> Mon, 17 Feb 2014 20:13:30 -0700 |
| 367 | + |
| 368 | +squid3 (3.3.8-1ubuntu5) trusty; urgency=low |
| 369 | + |
| 370 | + [ Yolanda Robla ] |
| 371 | + * debian/control: added lsb-release dependency |
| 372 | + * debian/patches/fix-distribution.patch: added patch to show distribution |
| 373 | + |
| 374 | + [ Dimitri John Ledkov ] |
| 375 | + * Enable parallel build |
| 376 | + |
| 377 | + -- Yolanda Robla <yolanda.robla@canonical.com> Wed, 11 Dec 2013 10:51:45 +0000 |
| 378 | + |
| 379 | +squid3 (3.3.8-1ubuntu4) trusty; urgency=low |
| 380 | + |
| 381 | + * Fix perl & pod2man config.tests. |
| 382 | + |
| 383 | + -- Dmitrijs Ledkovs <xnox@ubuntu.com> Mon, 04 Nov 2013 02:17:30 +0000 |
| 384 | + |
| 385 | +squid3 (3.3.8-1ubuntu3) saucy; urgency=low |
| 386 | + |
| 387 | + * d/tests/squid: Disable seccomp sandboxing in vsftpd until it works |
| 388 | + reliably (http://pad.lv/1219857), restart vsftpd using service |
| 389 | + command. |
| 390 | + |
| 391 | + -- James Page <james.page@ubuntu.com> Mon, 02 Sep 2013 15:50:41 +0100 |
| 392 | + |
| 393 | +squid3 (3.3.8-1ubuntu2) saucy; urgency=low |
| 394 | + |
| 395 | + * d/usr.sbin.squid3: Update apparmor profile to allow pinger process to |
| 396 | + create and use ICMP ports for ipv4/ipv6. |
| 397 | + |
| 398 | + -- James Page <james.page@ubuntu.com> Mon, 02 Sep 2013 11:06:54 +0100 |
| 399 | + |
| 400 | +squid3 (3.3.8-1ubuntu1) saucy; urgency=low |
| 401 | + |
| 402 | + * Merge from Debian unstable, remaining changes: |
| 403 | + + debian/control: |
| 404 | + - Update maintainer. |
| 405 | + - Suggests apparmor (>= 2.3) |
| 406 | + - Depends on ssl-cert ((>= 1.0-11ubuntu1), autopkgtests |
| 407 | + + debian/squid3.upstart |
| 408 | + - Move ulimit command to script section so that it applies |
| 409 | + to the started squid daemon. Thanks to Timur Irmatov (LP: 986159) |
| 410 | + - Work around squid not handling SIGHUP by adding respawn to |
| 411 | + upstart job. (LP: 978356) |
| 412 | + + debian/NEWS.Debian: Rename NEWS.debian, add note regarding squid3 |
| 413 | + transition in 12.04 (LP: 924739) |
| 414 | + + debian/rules |
| 415 | + - Re-enable all hardening options lost in the squid->squid3 |
| 416 | + transition (LP: 986314) |
| 417 | + + squid3.resolvconf, debian/squid3.postinst, debian/squid3.postrm, |
| 418 | + debian/squid3.preinst, debian/squid3.prerm: |
| 419 | + - Convert init script to upstart |
| 420 | + + debian/patches/99-ubuntu-ssl-cert-snakeoil: |
| 421 | + - Use snakeoil certificates. |
| 422 | + + debian/logrotate |
| 423 | + - Use sar-reports rather than sarg-maint. (LP: 26616) |
| 424 | + + debian/patches/90-cf.data.ubuntu.dpatch: |
| 425 | + - Add an example refresh pattern for debs. |
| 426 | + (foundations-lucid-local-report spec) |
| 427 | + + Add disabled by default AppArmor profile (LP: 497790) |
| 428 | + - debian/squid3.upstart: load profile in pre-start stanza |
| 429 | + - add debian/usr.sbin.squid3 profile |
| 430 | + - debian/rules: |
| 431 | + + install debian/usr.sbin.squid3, etc/apparmor.d/force-complain and |
| 432 | + etc/apparmor.d/disable into $(INSTALLDIR) |
| 433 | + + use dh_apparmor |
| 434 | + - debian/squid3.install: install etc/apparmor.d/disable, force-complain |
| 435 | + and usr.sbin.squid3 |
| 436 | + - debian/squid3.preinst: disable profile on clean install or upgrades |
| 437 | + from earlier than when we shipped the profile |
| 438 | + + debian/tests: |
| 439 | + - Add autopkgtests. |
| 440 | + * d/control: Add dependency package for squid -> squid3 (LP: #1211942). |
| 441 | + * d/control: Add dh-apparmor to BD's. |
| 442 | + |
| 443 | + -- James Page <james.page@ubuntu.com> Wed, 14 Aug 2013 09:03:55 +0100 |
| 444 | + |
| 445 | squid3 (3.3.8-1) unstable; urgency=high |
| 446 | |
| 447 | * Urgency high due to security fixes |
| 448 | @@ -391,6 +794,65 @@ squid3 (3.3.8-1) unstable; urgency=high |
| 449 | |
| 450 | -- Luigi Gangitano <luigi@debian.org> Sun, 21 Jul 2013 18:28:36 +0200 |
| 451 | |
| 452 | +squid3 (3.3.4-1ubuntu1) saucy; urgency=low |
| 453 | + |
| 454 | + * Merge from Debian unstable (LP: #1199883). Remaining changes: |
| 455 | + + debian/control: |
| 456 | + - Update maintainer. |
| 457 | + - Suggests apparmor (>= 2.3) |
| 458 | + - Depends on ssl-cert ((>= 1.0-11ubuntu1), autopkgtests |
| 459 | + + debian/squid3.upstart |
| 460 | + - Move ulimit command to script section so that it applies |
| 461 | + to the started squid daemon. Thanks to Timur Irmatov (LP: 986159) |
| 462 | + - Work around squid not handling SIGHUP by adding respawn to |
| 463 | + upstart job. (LP: 978356) |
| 464 | + + debian/NEWS.Debian: Rename NEWS.debian, add note regarding squid3 |
| 465 | + transition in 12.04 (LP: 924739) |
| 466 | + + debian/rules |
| 467 | + - Re-enable all hardening options lost in the squid->squid3 |
| 468 | + transition (LP: 986314) |
| 469 | + + squid3.resolvconf, debian/squid3.postinst, debian/squid3.postrm, |
| 470 | + debian/squid3.preinst, debian/squid3.prerm: |
| 471 | + - Convert init script to upstart |
| 472 | + + debian/patches/99-ubuntu-ssl-cert-snakeoil: |
| 473 | + - Use snakeoil certificates. |
| 474 | + + debian/logrotate |
| 475 | + - Use sar-reports rather than sarg-maint. (LP: 26616) |
| 476 | + + debian/patches/90-cf.data.ubuntu.dpatch: |
| 477 | + - Add an example refresh pattern for debs. |
| 478 | + (foundations-lucid-local-report spec) |
| 479 | + + Add disabled by default AppArmor profile (LP: 497790) |
| 480 | + - debian/squid3.upstart: load profile in pre-start stanza |
| 481 | + - add debian/usr.sbin.squid3 profile |
| 482 | + - debian/rules: |
| 483 | + + install debian/usr.sbin.squid3, etc/apparmor.d/force-complain and |
| 484 | + etc/apparmor.d/disable into $(INSTALLDIR) |
| 485 | + + use dh_apparmor |
| 486 | + - debian/squid3.install: install etc/apparmor.d/disable, force-complain |
| 487 | + and usr.sbin.squid3 |
| 488 | + - debian/squid3.preinst: disable profile on clean install or upgrades |
| 489 | + from earlier than when we shipped the profile |
| 490 | + + debian/tests: |
| 491 | + - Add autopkgtests. |
| 492 | + |
| 493 | + * Dropped: |
| 494 | + - debian/patches: dropped patches, superseded by new release: |
| 495 | + + 98-CVE-2012-5643.patch |
| 496 | + + 99-lp1117517_r12473.patch |
| 497 | + - debian/rules: fix FTBFS, removed --with-cppunit-basedir flag, |
| 498 | + included in Debian. |
| 499 | + - debian/control: Dropped transitional packages from squid, no |
| 500 | + longer required. |
| 501 | + |
| 502 | + * Refreshed patches: |
| 503 | + - 01-cf.data.debian.patch |
| 504 | + - 02-makefile-defaults.patch |
| 505 | + - 15-cachemgr-default-config.patch |
| 506 | + |
| 507 | + * debian/tests/test-squid.py: fixed case problem with ftp test |
| 508 | + |
| 509 | + -- Yolanda Robla <yolanda.robla@canonical.com> Wed, 10 Jul 2013 17:12:42 +0200 |
| 510 | + |
| 511 | squid3 (3.3.4-1) unstable; urgency=low |
| 512 | |
| 513 | * New upstream release |
| 514 | @@ -494,6 +956,92 @@ squid3 (3.1.20-2) unstable; urgency=low |
| 515 | |
| 516 | -- Luigi Gangitano <luigi@debian.org> Thu, 06 Dec 2012 20:02:56 +0100 |
| 517 | |
| 518 | +squid3 (3.1.20-1ubuntu7) saucy; urgency=low |
| 519 | + |
| 520 | + * debian/tests: Run ftp tests against local vsftpd instead of ftp.ubuntu.com. |
| 521 | + |
| 522 | + -- Yolanda Robla <yolanda.robla@canonical.com> Mon, 17 Jun 2013 11:00:17 +0200 |
| 523 | + |
| 524 | +squid3 (3.1.20-1ubuntu6) saucy; urgency=low |
| 525 | + |
| 526 | + * debian/tests: Fix start/stop of squid3. |
| 527 | + |
| 528 | + -- Yolanda Robla <yolanda.robla@canonical.com> Mon, 10 Jun 2013 10:30:33 +0200 |
| 529 | + |
| 530 | +squid3 (3.1.20-1ubuntu5) saucy; urgency=low |
| 531 | + |
| 532 | + * debian/rules: fix FTBFS, removed --with-cppunit-basedir flag |
| 533 | + |
| 534 | + -- Yolanda Robla <yolanda.robla@canonical.com> Mon, 27 May 2013 14:50:11 +0200 |
| 535 | + |
| 536 | +squid3 (3.1.20-1ubuntu4) saucy; urgency=low |
| 537 | + |
| 538 | + * debian/tests: Add autopkgtest. |
| 539 | + |
| 540 | + -- Yolanda <yolanda.robla@canonical.com> Mon, 27 May 2013 11:24:35 +0200 |
| 541 | + |
| 542 | +squid3 (3.1.20-1ubuntu3) raring-proposed; urgency=low |
| 543 | + |
| 544 | + * fix FTBFS with newer glibc (LP: #1117517) |
| 545 | + |
| 546 | + -- Jamie Strandboge <jamie@ubuntu.com> Wed, 06 Feb 2013 11:37:29 -0600 |
| 547 | + |
| 548 | +squid3 (3.1.20-1ubuntu2) raring-proposed; urgency=low |
| 549 | + |
| 550 | + [ Seth Arnold ] |
| 551 | + * SECURITY UPDATE: denial of service via cachemgr.cgi insufficient input |
| 552 | + validation |
| 553 | + - debian/patches/98-CVE-2012-5643.patch: modify cachemgr.cc to properly |
| 554 | + free memory and handle input in chunks |
| 555 | + - Based on |
| 556 | + http://www.squid-cache.org/Versions/v3/3.1/changesets/SQUID-2012_1.patch |
| 557 | + - CVE-2012-5643 |
| 558 | + - CVE-2013-0189 |
| 559 | + |
| 560 | + -- Jamie Strandboge <jamie@ubuntu.com> Wed, 06 Feb 2013 09:56:53 -0600 |
| 561 | + |
| 562 | +squid3 (3.1.20-1ubuntu1) quantal; urgency=low |
| 563 | + |
| 564 | + * Merge from Debian testing (LP: #1016560). Remaining changes: |
| 565 | + + debian/control: |
| 566 | + - Update maintainer. |
| 567 | + - Suggests apparmor (>= 2.3) |
| 568 | + - Depends on ssl-cert ((>= 1.0-11ubuntu1) |
| 569 | + - Add transitional dummy packages |
| 570 | + + debian/squid3.upstart |
| 571 | + - Move ulimit command to script section so that it applies |
| 572 | + to the started squid daemon. Thanks to Timur Irmatov (LP: 986159) |
| 573 | + - Work around squid not handling SIGHUP by adding respawn to |
| 574 | + upstart job. (LP: 978356) |
| 575 | + + debian/NEWS.Debian: Rename NEWS.debian, add note regarding squid3 |
| 576 | + transition in 12.04 (LP: 924739) |
| 577 | + + debian/rules |
| 578 | + - Re-enable all hardening options lost in the squid->squid3 |
| 579 | + transition (LP: 986314) |
| 580 | + + squid3.resolvconf, debian/squid3.postinst, debian/squid3.postrm, |
| 581 | + debian/squid3.preinst, debian/squid3.prerm: |
| 582 | + - Convert init script to upstart |
| 583 | + + debian/patches/99-ubuntu-ssl-cert-snakeoil: |
| 584 | + - Use snakeoil certificates. |
| 585 | + + debian/logrotate |
| 586 | + - Use sar-reports rather than sarg-maint. (LP: 26616) |
| 587 | + + debian/patches/90-cf.data.ubuntu.dpatch: |
| 588 | + - Add an example refresh pattern for debs. |
| 589 | + (foundations-lucid-local-report spec) |
| 590 | + + Add disabled by default AppArmor profile (LP: 497790) |
| 591 | + - debian/squid3.upstart: load profile in pre-start stanza |
| 592 | + - add debian/usr.sbin.squid3 profile |
| 593 | + - debian/rules: |
| 594 | + + install debian/usr.sbin.squid3, etc/apparmor.d/force-complain and |
| 595 | + etc/apparmor.d/disable into $(INSTALLDIR) |
| 596 | + + use dh_apparmor |
| 597 | + - debian/squid3.install: install etc/apparmor.d/disable, force-complain |
| 598 | + and usr.sbin.squid3 |
| 599 | + - debian/squid3.preinst: disable profile on clean install or upgrades |
| 600 | + from earlier than when we shipped the profile |
| 601 | + |
| 602 | + -- Stefan Bader <stefan.bader@canonical.com> Fri, 22 Jun 2012 14:18:00 +0200 |
| 603 | + |
| 604 | squid3 (3.1.20-1) unstable; urgency=low |
| 605 | |
| 606 | * New upstream release |
| 607 | @@ -510,6 +1058,66 @@ squid3 (3.1.20-1) unstable; urgency=low |
| 608 | |
| 609 | -- Luigi Gangitano <luigi@debian.org> Mon, 18 Jun 2012 14:20:53 +0200 |
| 610 | |
| 611 | +squid3 (3.1.19-1ubuntu5) quantal; urgency=low |
| 612 | + |
| 613 | + * d/squid3.upstart: Work around squid not handling SIGHUP by |
| 614 | + adding respawn to upstart job. (LP: #978356) |
| 615 | + |
| 616 | + -- Clint Byrum <clint@ubuntu.com> Tue, 19 Jun 2012 15:35:19 -0700 |
| 617 | + |
| 618 | +squid3 (3.1.19-1ubuntu4) quantal; urgency=low |
| 619 | + |
| 620 | + * Add disabled by default AppArmor profile (LP: #497790) |
| 621 | + - debian/squid3.upstart: load profile in pre-start stanza |
| 622 | + - add debian/usr.sbin.squid3 profile |
| 623 | + - debian/rules: |
| 624 | + + install debian/usr.sbin.squid3, etc/apparmor.d/force-complain and |
| 625 | + etc/apparmor.d/disable into $(INSTALLDIR) |
| 626 | + + use dh_apparmor |
| 627 | + - debian/control: suggests apparmor (>= 2.3) |
| 628 | + - debian/squid3.install: install etc/apparmor.d/disable, force-complain |
| 629 | + and usr.sbin.squid3 |
| 630 | + - debian/squid3.preinst: disable profile on clean install or upgrades |
| 631 | + from earlier than when we shipped the profile |
| 632 | + |
| 633 | + -- Jamie Strandboge <jamie@ubuntu.com> Wed, 13 Jun 2012 11:32:14 -0500 |
| 634 | + |
| 635 | +squid3 (3.1.19-1ubuntu3.1) quantal; urgency=low |
| 636 | + |
| 637 | + * debian/rules: re-enable all hardening options lost in the |
| 638 | + squid->squid3 transition (LP: #986314) |
| 639 | + * debian/squid3.upstart: move ulimit command to script section |
| 640 | + so that it applies to the started squid daemon. Thanks to Timur |
| 641 | + Irmatov (LP: #986159) |
| 642 | + |
| 643 | + -- Jamie Strandboge <jamie@ubuntu.com> Wed, 13 Jun 2012 09:06:51 -0500 |
| 644 | + |
| 645 | +squid3 (3.1.19-1ubuntu2) precise; urgency=low |
| 646 | + |
| 647 | + * debian/NEWS.Debian: Rename NEWS.debian, add note regarding squid3 |
| 648 | + transition in 12.04 (LP: #924739) |
| 649 | + |
| 650 | + -- Adam Gandelman <adamg@canonical.com> Thu, 12 Apr 2012 13:46:10 -0700 |
| 651 | + |
| 652 | +squid3 (3.1.19-1ubuntu1) precise; urgency=low |
| 653 | + |
| 654 | + * Merge from Debian testing. Remaining changes: |
| 655 | + + debian/control: |
| 656 | + - Update maintainer. |
| 657 | + + debian/squid3.upstart, debian/rules, squid3.resolvconf, |
| 658 | + debian/squid3.postinst, debian/squid3.postrm, debian/squid3.preinst, |
| 659 | + debian/squid3.prerm: Convert init script to upstart |
| 660 | + + debian/control, debian/patches/99-ubuntu-ssl-cert-snakeoil: Use |
| 661 | + snakeoil certificates. |
| 662 | + + debian/logrotate: Use sar-reports rather than sarg-maint. (LP: 26616) |
| 663 | + + debian/patches/90-cf.data.ubuntu.dpatch: Add an example refresh pattern |
| 664 | + for debs. (foundations-lucid-local-report spec) |
| 665 | + + Add transitional dummy packages |
| 666 | + * New upstream bugfix release fixes swap.state corruption, so squid will |
| 667 | + now start after a reboot. (LP: #930252) |
| 668 | + |
| 669 | + -- Christopher James Halse Rogers <raof@ubuntu.com> Tue, 21 Feb 2012 18:51:26 +1100 |
| 670 | + |
| 671 | squid3 (3.1.19-1) unstable; urgency=low |
| 672 | |
| 673 | * New upstream release |
| 674 | @@ -521,6 +1129,24 @@ squid3 (3.1.19-1) unstable; urgency=low |
| 675 | |
| 676 | -- Luigi Gangitano <luigi@debian.org> Tue, 07 Feb 2012 16:19:12 +0100 |
| 677 | |
| 678 | +squid3 (3.1.18-1ubuntu1) precise; urgency=low |
| 679 | + |
| 680 | + [ Ubuntu Merge-o-Matic ] |
| 681 | + * Merge from Debian testing. Remaining changes: |
| 682 | + + debian/control: |
| 683 | + - Update maintainer. |
| 684 | + + debian/squid3.upstart, debian/rules, squid3.resolvconf, |
| 685 | + debian/squid3.postinst, debian/squid3.postrm, debian/squid3.preinst, |
| 686 | + debian/squid3.prerm: Convert init script to upstart |
| 687 | + + debian/control, debian/patches/99-ubuntu-ssl-cert-snakeoil: Use |
| 688 | + snakeoil certificates. |
| 689 | + + debian/logrotate: Use sar-reports rather than sarg-maint. (LP: #26616) |
| 690 | + + debian/patches/90-cf.data.ubuntu.dpatch: Add an example refresh pattern |
| 691 | + for debs. (foundations-lucid-local-report spec) |
| 692 | + + Add transitional dummy packages |
| 693 | + |
| 694 | + -- Chuck Short <zulcss@ubuntu.com> Mon, 30 Jan 2012 10:24:33 -0500 |
| 695 | + |
| 696 | squid3 (3.1.18-1) unstable; urgency=low |
| 697 | |
| 698 | * New upstream release |
| 699 | @@ -530,6 +1156,23 @@ squid3 (3.1.18-1) unstable; urgency=low |
| 700 | |
| 701 | -- Luigi Gangitano <luigi@debian.org> Mon, 26 Dec 2011 22:04:28 +0100 |
| 702 | |
| 703 | +squid3 (3.1.16-1ubuntu1) precise; urgency=low |
| 704 | + |
| 705 | + * Merge from Debian testing. Remaining changes: |
| 706 | + + debian/control: |
| 707 | + - Update maintainer. |
| 708 | + + debian/squid3.upstart, debian/rules, squid3.resolvconf, |
| 709 | + debian/squid3.postinst, debian/squid3.postrm, debian/squid3.preinst, |
| 710 | + debian/squid3.prerm: Convert init script to upstart |
| 711 | + + debian/control, debian/patches/99-ubuntu-ssl-cert-snakeoil: Use |
| 712 | + snakeoil certificates. |
| 713 | + + debian/logrotate: Use sar-reports rather than sarg-maint. (LP: #26616) |
| 714 | + + debian/patches/90-cf.data.ubuntu.dpatch: Add an example refresh pattern |
| 715 | + for debs. (foundations-lucid-local-report spec) |
| 716 | + + Add transitional dummy packages |
| 717 | + |
| 718 | + -- Chuck Short <zulcss@ubuntu.com> Mon, 19 Dec 2011 21:35:43 +0000 |
| 719 | + |
| 720 | squid3 (3.1.16-1) unstable; urgency=low |
| 721 | |
| 722 | * New upstream release |
| 723 | @@ -542,6 +1185,40 @@ squid3 (3.1.16-1) unstable; urgency=low |
| 724 | |
| 725 | -- Luigi Gangitano <luigi@debian.org> Thu, 3 Nov 2011 13:37:17 +0100 |
| 726 | |
| 727 | +squid3 (3.1.15-1ubuntu3) precise; urgency=low |
| 728 | + |
| 729 | + * debian/squid3.upstart: Properly return 0 from maxfds() if $SQUID_MAXFD is |
| 730 | + unset, else pre-start will fail as well. Also fix paths to config file. |
| 731 | + (LP: #891445) |
| 732 | + * debian/squid3.upstart: Modify to better reflect functionality of Debian's |
| 733 | + squid3.rc |
| 734 | + * debian/rules: Fix permissions on upstart job |
| 735 | + |
| 736 | + -- Adam Gandelman <adamg@canonical.com> Wed, 16 Nov 2011 18:26:25 -0800 |
| 737 | + |
| 738 | +squid3 (3.1.15-1ubuntu2) precise; urgency=low |
| 739 | + |
| 740 | + * Fix spelling of squid-common transitional package name. |
| 741 | + * Remove meaningless self-conflicts. |
| 742 | + |
| 743 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 11 Nov 2011 10:33:44 +0000 |
| 744 | + |
| 745 | +squid3 (3.1.15-1ubuntu1) precise; urgency=low |
| 746 | + |
| 747 | + * debian/control: |
| 748 | + + Update maintainer. |
| 749 | + * debian/squid3.upstart, debian/rules, squid3.resolvconf, |
| 750 | + debian/squid3.postinst, debian/squid3.postrm, debian/squid3.preinst, |
| 751 | + debian/squid3.prerm: Convert init script to upstart |
| 752 | + * debian/control, debian/patches/99-ubuntu-ssl-cert-snakeoil: Use |
| 753 | + snakeoil certificates. |
| 754 | + * debian/logrotate: Use sar-reports rather than sarg-maint. (LP: #26616) |
| 755 | + * debian/patches/90-cf.data.ubuntu.dpatch: Add an example refresh pattern |
| 756 | + for debs. (foundations-lucid-local-report spec) |
| 757 | + * Add transitional dummy packages. |
| 758 | + |
| 759 | + -- Chuck Short <zulcss@ubuntu.com> Thu, 10 Nov 2011 08:59:31 -0500 |
| 760 | + |
| 761 | squid3 (3.1.15-1) unstable; urgency=high |
| 762 | |
| 763 | * Urgency high due to security fixes |
| 764 | @@ -1287,7 +1964,6 @@ squid3 (3.0.PRE4-1) unstable; urgency=low |
| 765 | |
| 766 | -- Luigi Gangitano <luigi@debian.org> Mon, 3 Jul 2006 16:47:43 +0200 |
| 767 | |
| 768 | - |
| 769 | squid3 (3.0.PRE3.20060422-2) unstable; urgency=low |
| 770 | |
| 771 | * debian/control |
| 772 | @@ -1300,3 +1976,4 @@ squid3 (3.0.PRE3.20060422-1) unstable; urgency=low |
| 773 | * First package attempt |
| 774 | |
| 775 | -- Luigi Gangitano <luigi@debian.org> Sat, 22 Apr 2006 01:19:36 +0200 |
| 776 | + |
| 777 | diff --git a/debian/control b/debian/control |
| 778 | index f6a5a6a..6a6181b 100644 |
| 779 | --- a/debian/control |
| 780 | +++ b/debian/control |
| 781 | @@ -1,11 +1,12 @@ |
| 782 | Source: squid3 |
| 783 | Section: web |
| 784 | Priority: optional |
| 785 | -Maintainer: Luigi Gangitano <luigi@debian.org> |
| 786 | +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
| 787 | +XSBC-Original-Maintainer: Luigi Gangitano <luigi@debian.org> |
| 788 | Homepage: http://www.squid-cache.org |
| 789 | Standards-Version: 3.9.8 |
| 790 | Vcs-Git: git://anonscm.debian.org/pkg-squid/pkg-squid3.git/ |
| 791 | -Build-Depends: libldap2-dev, libpam0g-dev, libdb-dev, cdbs, libsasl2-dev, debhelper (>=10), libcppunit-dev, libkrb5-dev, comerr-dev, libcap2-dev [linux-any], libecap3-dev (>= 1.0.1-2), libexpat1-dev, libxml2-dev, autotools-dev, libltdl-dev, dpkg-dev (>= 1.16.1~), pkg-config, libnetfilter-conntrack-dev [linux-any], nettle-dev, libgnutls28-dev, lsb-release |
| 792 | +Build-Depends: libldap2-dev, libpam0g-dev, libdb-dev, cdbs, libsasl2-dev, debhelper (>=10), libcppunit-dev, libkrb5-dev, comerr-dev, libcap2-dev [linux-any], libecap3-dev (>= 1.0.1-2), libexpat1-dev, libxml2-dev, autotools-dev, libltdl-dev, dpkg-dev (>= 1.16.1~), pkg-config, libnetfilter-conntrack-dev [linux-any], nettle-dev, libgnutls28-dev, lsb-release, dh-apparmor, dh-autoreconf |
| 793 | XS-Testsuite: autopkgtest |
| 794 | |
| 795 | Package: squid3 |
| 796 | @@ -22,11 +23,10 @@ Description: Transitional package |
| 797 | |
| 798 | Package: squid |
| 799 | Architecture: any |
| 800 | -Depends: ${shlibs:Depends}, ${misc:Depends}, netbase, adduser, logrotate (>= 3.5.4-1), squid-common (= ${source:Version}), lsb-base, libdbi-perl |
| 801 | -Suggests: squidclient, squid-cgi, squid-purge, resolvconf (>= 0.40), smbclient, ufw, winbindd |
| 802 | +Pre-Depends: adduser |
| 803 | +Depends: ${shlibs:Depends}, ${misc:Depends}, netbase, logrotate (>= 3.5.4-1), squid-common (= ${source:Version}), lsb-base, libdbi-perl, ssl-cert |
| 804 | +Suggests: squidclient, squid-cgi, squid-purge, resolvconf (>= 0.40), smbclient, ufw, winbindd, apparmor |
| 805 | Recommends: libcap2-bin [linux-any] |
| 806 | -Conflicts: squid3 (<< ${binary:Version}) |
| 807 | -Replaces: squid3 |
| 808 | Description: Full featured Web Proxy cache (HTTP proxy) |
| 809 | Squid is a high-performance proxy caching server for web clients, supporting |
| 810 | FTP, gopher, ICY and HTTP data objects. |
| 811 | diff --git a/debian/patches/90-cf.data.ubuntu.patch b/debian/patches/90-cf.data.ubuntu.patch |
| 812 | new file mode 100644 |
| 813 | index 0000000..86e412c |
| 814 | --- /dev/null |
| 815 | +++ b/debian/patches/90-cf.data.ubuntu.patch |
| 816 | @@ -0,0 +1,12 @@ |
| 817 | +--- a/src/cf.data.pre |
| 818 | ++++ b/src/cf.data.pre |
| 819 | +@@ -4545,6 +4545,9 @@ NOCOMMENT_START |
| 820 | + refresh_pattern ^ftp: 1440 20% 10080 |
| 821 | + refresh_pattern ^gopher: 1440 0% 1440 |
| 822 | + refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 |
| 823 | ++refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 |
| 824 | ++# example lin deb packages |
| 825 | ++#refresh_pattern (\.deb|\.udeb)$ 129600 100% 129600 |
| 826 | + refresh_pattern . 0 20% 4320 |
| 827 | + NOCOMMENT_END |
| 828 | + DOC_END |
| 829 | diff --git a/debian/patches/99-ubuntu-ssl-cert-snakeoil.patch b/debian/patches/99-ubuntu-ssl-cert-snakeoil.patch |
| 830 | new file mode 100644 |
| 831 | index 0000000..d9aa380 |
| 832 | --- /dev/null |
| 833 | +++ b/debian/patches/99-ubuntu-ssl-cert-snakeoil.patch |
| 834 | @@ -0,0 +1,22 @@ |
| 835 | +--- a/src/cf.data.pre |
| 836 | ++++ b/src/cf.data.pre |
| 837 | +@@ -2728,6 +2728,19 @@ DOC_START |
| 838 | + If 'sslkey' is not specified 'sslcert' is assumed to |
| 839 | + reference a combined file containing both the |
| 840 | + certificate and the key. |
| 841 | ++ |
| 842 | ++ Notes: |
| 843 | ++ |
| 844 | ++ On Debian/Ubuntu systems a default snakeoil certificate is |
| 845 | ++ available in /etc/ssl and users can set: |
| 846 | ++ |
| 847 | ++ cert=/etc/ssl/certs/ssl-cert-snakeoil.pem |
| 848 | ++ |
| 849 | ++ and |
| 850 | ++ |
| 851 | ++ key=/etc/ssl/private/ssl-cert-snakeoil.key |
| 852 | ++ |
| 853 | ++ for testing. |
| 854 | + |
| 855 | + sslversion=1|2|3|4|5|6 |
| 856 | + The SSL version to use when connecting to this peer |
| 857 | diff --git a/debian/patches/series b/debian/patches/series |
| 858 | index 1c214dd..0b77d79 100644 |
| 859 | --- a/debian/patches/series |
| 860 | +++ b/debian/patches/series |
| 861 | @@ -1,2 +1,4 @@ |
| 862 | 0001-Default-configuration-file-for-debian.patch |
| 863 | 0002-Change-default-file-locations-for-debian.patch |
| 864 | +90-cf.data.ubuntu.patch |
| 865 | +99-ubuntu-ssl-cert-snakeoil.patch |
| 866 | diff --git a/debian/rules b/debian/rules |
| 867 | index 7b2322c..943678b 100755 |
| 868 | --- a/debian/rules |
| 869 | +++ b/debian/rules |
| 870 | @@ -7,7 +7,8 @@ include /usr/share/dpkg/buildflags.mk |
| 871 | |
| 872 | include /usr/share/cdbs/1/rules/debhelper.mk |
| 873 | include /usr/share/cdbs/1/class/autotools.mk |
| 874 | - |
| 875 | +include /usr/share/cdbs/1/rules/autoreconf.mk |
| 876 | + |
| 877 | INSTALLDIR := $(CURDIR)/debian/tmp |
| 878 | datadir=/usr/share/squid |
| 879 | |
| 880 | @@ -84,6 +85,10 @@ install/squid:: |
| 881 | install -m 755 -g root -d $(INSTALLDIR)/usr/share/man/man1 |
| 882 | mv $(INSTALLDIR)/usr/bin/purge $(INSTALLDIR)/usr/bin/squid-purge |
| 883 | install -m 644 -g root debian/squid-purge.8 $(INSTALLDIR)/usr/share/man/man8 |
| 884 | + install -m 755 -g root -d $(INSTALLDIR)/etc/apparmor.d/force-complain |
| 885 | + install -m 755 -g root -d $(INSTALLDIR)/etc/apparmor.d/disable |
| 886 | + install -m 644 -g root debian/usr.sbin.squid $(INSTALLDIR)/etc/apparmor.d |
| 887 | + dh_apparmor --profile-name=usr.sbin.squid -psquid |
| 888 | |
| 889 | clean:: |
| 890 | # nothing to do |
| 891 | diff --git a/debian/squid.install b/debian/squid.install |
| 892 | index 0f21217..003ee23 100644 |
| 893 | --- a/debian/squid.install |
| 894 | +++ b/debian/squid.install |
| 895 | @@ -26,3 +26,6 @@ usr/share/man/man8/log_db_daemon.8 |
| 896 | usr/share/man/man8/negotiate_kerberos_auth.8 |
| 897 | usr/share/man/man8/storeid_file_rewrite.8 |
| 898 | usr/share/man/man8/squid.8 |
| 899 | +etc/apparmor.d/disable |
| 900 | +etc/apparmor.d/force-complain |
| 901 | +etc/apparmor.d/usr.sbin.squid |
| 902 | diff --git a/debian/squid.preinst b/debian/squid.preinst |
| 903 | index 4271ad3..dbf175f 100644 |
| 904 | --- a/debian/squid.preinst |
| 905 | +++ b/debian/squid.preinst |
| 906 | @@ -51,6 +51,21 @@ then |
| 907 | chsh -s /bin/sh proxy |
| 908 | fi |
| 909 | |
| 910 | +disable_profile() { |
| 911 | + APP_CONFFILE="/etc/apparmor.d/usr.sbin.squid" |
| 912 | + APP_DISABLE="/etc/apparmor.d/disable/usr.sbin.squid" |
| 913 | + # Create a symlink to the yet-to-be-unpacked profile |
| 914 | + if [ ! -e "$APP_CONFFILE" ]; then |
| 915 | + mkdir -p `dirname $APP_DISABLE` 2>/dev/null || true |
| 916 | + ln -sf $APP_CONFFILE $APP_DISABLE |
| 917 | + fi |
| 918 | +} |
| 919 | + |
| 920 | +if [ "$1" = "install" ]; then |
| 921 | + # Disable AppArmor profile on install |
| 922 | + disable_profile |
| 923 | +fi |
| 924 | + |
| 925 | # dh_installdeb will replace this with shell code automatically |
| 926 | # generated by other debhelper scripts. |
| 927 | |
| 928 | diff --git a/debian/squid.rc b/debian/squid.rc |
| 929 | index a27fd88..204b676 100644 |
| 930 | --- a/debian/squid.rc |
| 931 | +++ b/debian/squid.rc |
| 932 | @@ -4,8 +4,6 @@ |
| 933 | # |
| 934 | # Version: @(#)squid.rc 1.0 07-Jul-2006 luigi@debian.org |
| 935 | # |
| 936 | -# pidfile: /var/run/squid.pid |
| 937 | -# |
| 938 | ### BEGIN INIT INFO |
| 939 | # Provides: squid |
| 940 | # Required-Start: $network $remote_fs $syslog |
| 941 | diff --git a/debian/squid3.postinst b/debian/squid3.postinst |
| 942 | index bd075d4..bb862d5 100644 |
| 943 | --- a/debian/squid3.postinst |
| 944 | +++ b/debian/squid3.postinst |
| 945 | @@ -29,17 +29,6 @@ if test -d /etc/squid3 && dpkg --compare-versions "$2" lt '3.5'; then |
| 946 | fi |
| 947 | fi |
| 948 | |
| 949 | -case "$1" in |
| 950 | - abort-upgrade|abort-remove|abort-deconfigure) |
| 951 | - ;; |
| 952 | - *) |
| 953 | - # |
| 954 | - # Unknown action - do nothing. |
| 955 | - # |
| 956 | - exit 0 |
| 957 | - ;; |
| 958 | -esac |
| 959 | - |
| 960 | # dh_installdeb will replace this with shell code automatically |
| 961 | # generated by other debhelper scripts. |
| 962 | |
| 963 | diff --git a/debian/squid3.preinst b/debian/squid3.preinst |
| 964 | index 848f286..8ab65e1 100644 |
| 965 | --- a/debian/squid3.preinst |
| 966 | +++ b/debian/squid3.preinst |
| 967 | @@ -26,14 +26,6 @@ if test -d /etc/squid3 ; then |
| 968 | /etc/squid3/errorpage.css /etc/squid/errorpage.css 3.5.4-1~ squid3 -- "$@" |
| 969 | fi |
| 970 | |
| 971 | -case "$1" in |
| 972 | - upgrade|install-upgrade) |
| 973 | - ;; |
| 974 | - abort-upgrade) |
| 975 | - exit 0 |
| 976 | - ;; |
| 977 | -esac |
| 978 | - |
| 979 | # dh_installdeb will replace this with shell code automatically |
| 980 | # generated by other debhelper scripts. |
| 981 | |
| 982 | diff --git a/debian/tests/control b/debian/tests/control |
| 983 | index 0b1e313..4e5b715 100644 |
| 984 | --- a/debian/tests/control |
| 985 | +++ b/debian/tests/control |
| 986 | @@ -1,3 +1,7 @@ |
| 987 | Tests: upstream-test-suite |
| 988 | Depends: @builddeps@, fakeroot, squid |
| 989 | Restrictions: allow-stderr |
| 990 | + |
| 991 | +Tests: squid |
| 992 | +Depends: squid, squidclient, elinks, netcat, pygopherd, apparmor-utils, vsftpd |
| 993 | +Restrictions: needs-root |
| 994 | diff --git a/debian/tests/squid b/debian/tests/squid |
| 995 | new file mode 100755 |
| 996 | index 0000000..f17feef |
| 997 | --- /dev/null |
| 998 | +++ b/debian/tests/squid |
| 999 | @@ -0,0 +1,11 @@ |
| 1000 | +#!/bin/bash |
| 1001 | +#-------------- |
| 1002 | +# Testing squid |
| 1003 | +#-------------- |
| 1004 | +set -e |
| 1005 | + |
| 1006 | +# configure vsftpd |
| 1007 | +sed -i "s/anonymous_enable[[:blank:]]*=[[:blank:]]*.*/anonymous_enable=YES/g" /etc/vsftpd.conf |
| 1008 | +echo "seccomp_sandbox=NO" >> /etc/vsftpd.conf |
| 1009 | +service vsftpd restart 2>&1 > /dev/null |
| 1010 | +python `dirname $0`/test-squid.py 2>&1 |
| 1011 | diff --git a/debian/tests/test-squid.py b/debian/tests/test-squid.py |
| 1012 | new file mode 100644 |
| 1013 | index 0000000..943dd9a |
| 1014 | --- /dev/null |
| 1015 | +++ b/debian/tests/test-squid.py |
| 1016 | @@ -0,0 +1,221 @@ |
| 1017 | +#!/usr/bin/python |
| 1018 | +# |
| 1019 | +# test-squid.py quality assurance test script |
| 1020 | +# Copyright (C) 2008-2013 Canonical Ltd. |
| 1021 | +# Author: Jamie Strandboge <jamie@canonical.com> |
| 1022 | +# |
| 1023 | +# This program is free software: you can redistribute it and/or modify |
| 1024 | +# it under the terms of the GNU General Public License version 2, |
| 1025 | +# as published by the Free Software Foundation. |
| 1026 | +# |
| 1027 | +# This program is distributed in the hope that it will be useful, |
| 1028 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1029 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1030 | +# GNU General Public License for more details. |
| 1031 | +# |
| 1032 | +# You should have received a copy of the GNU General Public License |
| 1033 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 1034 | +# |
| 1035 | + |
| 1036 | +''' |
| 1037 | + *** IMPORTANT *** |
| 1038 | + DO NOT RUN ON A PRODUCTION SERVER. |
| 1039 | + *** IMPORTANT *** |
| 1040 | + |
| 1041 | + How to run: |
| 1042 | + $ sudo apt-get remove --purge squid |
| 1043 | + $ sudo apt-get -y install squid squidclient python-unit elinks netcat |
| 1044 | + $ sudo ./test-squid.py -v |
| 1045 | + |
| 1046 | + NOTE: |
| 1047 | + The host running this script needs to have access to the internet |
| 1048 | + |
| 1049 | + TODO: |
| 1050 | + acls |
| 1051 | + ident |
| 1052 | + purge (via squidclient) |
| 1053 | + ... |
| 1054 | + squidguard: |
| 1055 | + - test with: |
| 1056 | + $ echo "http://blocked.com 1.2.3.4/- - GET -" | squidGuard -c /etc/squid/squidGuard.conf -d |
| 1057 | + if using a 'redirect', then the redirect URL is displayed, otherwise |
| 1058 | + nothing |
| 1059 | + - test block with the following in default acl in squidGuard.conf: |
| 1060 | + pass local none |
| 1061 | + redirect http://www.example.com/redirected.html |
| 1062 | + - test pass with the following in default acl in squidGuard.conf: |
| 1063 | + pass local all |
| 1064 | + redirect http://www.example.com/redirected.html |
| 1065 | + - test domains and urls with something like the following acl: |
| 1066 | + dest bad { |
| 1067 | + domainlist test/domains |
| 1068 | + urllist test/urls |
| 1069 | + } |
| 1070 | + acl { |
| 1071 | + default { |
| 1072 | + pass !bad all |
| 1073 | + redirect http://www.example.com/redirected.html |
| 1074 | + } |
| 1075 | + } |
| 1076 | + |
| 1077 | + then create /var/lib/squidguard/db/test/domains with: |
| 1078 | + blocked.com |
| 1079 | + |
| 1080 | + Test with: |
| 1081 | + $ echo "http://ok.com 1.2.3.4/- - GET -" | squidGuard -c /etc/squid/squidGuard.conf -d |
| 1082 | + $ echo "http://blocked.com 1.2.3.4/- - GET -" | squidGuard -c /etc/squid/squidGuard.conf -d |
| 1083 | +''' |
| 1084 | + |
| 1085 | +# QRT-Packages: squid squidclient python-unit elinks netcat pygopherd apparmor-utils |
| 1086 | +# QRT-Depends: testlib_httpd.py private/qrt/squid.py |
| 1087 | + |
| 1088 | +import unittest, subprocess |
| 1089 | +import os |
| 1090 | +import sys |
| 1091 | +import testlib |
| 1092 | +import testlib_httpd |
| 1093 | +import time |
| 1094 | +import tempfile |
| 1095 | + |
| 1096 | +try: |
| 1097 | + from private.qrt.squid import PrivateSquidTest |
| 1098 | +except ImportError: |
| 1099 | + class PrivateSquidTest(object): |
| 1100 | + '''Empty class''' |
| 1101 | + print >>sys.stdout, "Skipping private tests" |
| 1102 | + |
| 1103 | +class BasicTest(testlib_httpd.HttpdCommon, PrivateSquidTest): |
| 1104 | + '''Test basic functionality''' |
| 1105 | + def setUp(self): |
| 1106 | + '''Setup mechanisms''' |
| 1107 | + |
| 1108 | + # for some reason, squid on maverick is missing the init.d |
| 1109 | + # upstart compatibility symlink |
| 1110 | + if self.lsb_release['Release'] == 10.10 and not os.path.exists("/etc/init.d/squid"): |
| 1111 | + os.symlink("/lib/init/upstart-job", "/etc/init.d/squid") |
| 1112 | + |
| 1113 | + self._set_initscript("/etc/init.d/squid") |
| 1114 | + if self.lsb_release['Release'] >= 12.04: |
| 1115 | + self._set_initscript("squid") |
| 1116 | + |
| 1117 | + testlib_httpd.HttpdCommon._setUp(self) |
| 1118 | + |
| 1119 | + self.gophermap = "/var/gopher/gophermap" |
| 1120 | + |
| 1121 | + self.aa_profile = "usr.sbin.squid" |
| 1122 | + self.aa_abs_profile = "/etc/apparmor.d/%s" % self.aa_profile |
| 1123 | + self.version_with_apparmor = 12.10 |
| 1124 | + # This hack is only used until we have tests run both confined and |
| 1125 | + # unconfined |
| 1126 | + self.aa_unload_at_teardown = False |
| 1127 | + |
| 1128 | + def tearDown(self): |
| 1129 | + '''Shutdown methods''' |
| 1130 | + testlib_httpd.HttpdCommon._tearDown(self) |
| 1131 | + testlib.config_restore(self.gophermap) |
| 1132 | + |
| 1133 | + def test_daemons(self): |
| 1134 | + '''Test daemon''' |
| 1135 | + pidfile = "/run/squid.pid" |
| 1136 | + exe = "squid" |
| 1137 | + |
| 1138 | + if self.lsb_release['Release'] < 12.04: |
| 1139 | + pidfile = "/var/run/squid.pid" |
| 1140 | + exe = "squid" |
| 1141 | + |
| 1142 | + self.assertTrue(testlib.check_pidfile(exe, pidfile)) |
| 1143 | + |
| 1144 | + def test_http_proxy(self): |
| 1145 | + '''Test http''' |
| 1146 | + self._test_url_proxy("http://www.ubuntu.com/", "Canonical", "http://localhost:3128/") |
| 1147 | + |
| 1148 | + def test_https_proxy(self): |
| 1149 | + '''Test https''' |
| 1150 | + self._test_url_proxy("https://wiki.ubuntu.com/", "Community", "http://localhost:3128/") |
| 1151 | + |
| 1152 | + def test_ftp_proxy(self): |
| 1153 | + '''Test ftp''' |
| 1154 | + self._test_url_proxy("ftp://anonymous@localhost:21", "irectory", "http://localhost:3128/") |
| 1155 | + |
| 1156 | + def test_squidclient(self): |
| 1157 | + '''Test squidclient''' |
| 1158 | + urls = ['http://www.ubuntu.com/', 'https://wiki.ubuntu.com/', \ |
| 1159 | + 'ftp://anonymous@localhost:21', 'gopher://127.0.0.1'] |
| 1160 | + |
| 1161 | + for url in urls: |
| 1162 | + rc, report = testlib.cmd(['squidclient', '-h', '127.0.0.1', '-p', '3128', '-r', url]) |
| 1163 | + expected = 0 |
| 1164 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1165 | + self.assertEquals(expected, rc, result + report) |
| 1166 | + |
| 1167 | + def test_CVE_2011_3205(self): |
| 1168 | + '''Test parsing lines > 4096 in length (CVE-2011-3205)''' |
| 1169 | + |
| 1170 | + longline = "ABCDEF" * 4096 |
| 1171 | + |
| 1172 | + testlib.config_replace(self.gophermap, """Welcome to Pygopherd! You can place your documents |
| 1173 | +in /var/gopher for future use. You can remove the gophermap |
| 1174 | +file there to get rid of this message, or you can edit it to |
| 1175 | +use other things. (You'll need to do at least one of these |
| 1176 | +two things in order to get your own data to show up!) |
| 1177 | + |
| 1178 | +%s |
| 1179 | + |
| 1180 | +Some links to get you started: |
| 1181 | + |
| 1182 | +1Pygopherd Home /devel/gopher/pygopherd gopher.quux.org 70 |
| 1183 | +1Quux.Org Mega Server / gopher.quux.org 70 |
| 1184 | +1The Gopher Project /Software/Gopher gopher.quux.org 70 |
| 1185 | +1Traditional UMN Home Gopher / gopher.tc.umn.edu 70 |
| 1186 | + |
| 1187 | +Welcome to the world of Gopher and enjoy! |
| 1188 | +""" %(longline), append=False) |
| 1189 | + |
| 1190 | + rc, report = testlib.cmd(['squidclient', '-h', '127.0.0.1', '-p', '3128', '-r', "gopher://127.0.0.1"]) |
| 1191 | + expected = 0 |
| 1192 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1193 | + self.assertEquals(expected, rc, result + report) |
| 1194 | + |
| 1195 | + # Run this last so if we enable the profile then we don't unload it |
| 1196 | + def test_zz_apparmor(self): |
| 1197 | + '''Test apparmor''' |
| 1198 | + if self.lsb_release['Release'] < 12.10: |
| 1199 | + self._skipped("No profile in 12.04 and under") |
| 1200 | + |
| 1201 | + self.aa_unload_at_teardown = True |
| 1202 | + |
| 1203 | + # Currently while we have a profile, it is shipped disabled by default. |
| 1204 | + # Verify that. |
| 1205 | + rc, report = testlib.check_apparmor(self.aa_abs_profile, 12.10, is_running=False) |
| 1206 | + expected = 1 |
| 1207 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1208 | + self.assertEquals(rc, expected, result + report) |
| 1209 | + |
| 1210 | + # Verify it is syntactically correct |
| 1211 | + rc, report = testlib.cmd(['apparmor_parser', '-p', self.aa_abs_profile]) |
| 1212 | + expected = 0 |
| 1213 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1214 | + self.assertEquals(rc, expected, result + report) |
| 1215 | + |
| 1216 | + # Verify it loads ok |
| 1217 | + rc, report = testlib.cmd(['aa-enforce', self.aa_abs_profile]) |
| 1218 | + expected = 0 |
| 1219 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1220 | + self.assertEquals(rc, expected, result + report) |
| 1221 | + |
| 1222 | + self._stop() |
| 1223 | + self._start() |
| 1224 | + |
| 1225 | + rc, report = testlib.check_apparmor(self.aa_abs_profile, 12.10, is_running=True) |
| 1226 | + expected = 1 |
| 1227 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1228 | + self.assertEquals(rc, expected, result + report) |
| 1229 | + |
| 1230 | + |
| 1231 | +if __name__ == '__main__': |
| 1232 | + suite = unittest.TestSuite() |
| 1233 | + suite.addTest(unittest.TestLoader().loadTestsFromTestCase(BasicTest)) |
| 1234 | + |
| 1235 | + rc = unittest.TextTestRunner(verbosity=2).run(suite) |
| 1236 | + if not rc.wasSuccessful(): |
| 1237 | + sys.exit(1) |
| 1238 | diff --git a/debian/tests/testlib.py b/debian/tests/testlib.py |
| 1239 | new file mode 100644 |
| 1240 | index 0000000..4e51f3d |
| 1241 | --- /dev/null |
| 1242 | +++ b/debian/tests/testlib.py |
| 1243 | @@ -0,0 +1,1133 @@ |
| 1244 | +# |
| 1245 | +# testlib.py quality assurance test script |
| 1246 | +# Copyright (C) 2008-2011 Canonical Ltd. |
| 1247 | +# |
| 1248 | +# This library is free software; you can redistribute it and/or |
| 1249 | +# modify it under the terms of the GNU Library General Public |
| 1250 | +# License as published by the Free Software Foundation; either |
| 1251 | +# version 2 of the License. |
| 1252 | +# |
| 1253 | +# This library is distributed in the hope that it will be useful, |
| 1254 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1255 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1256 | +# Library General Public License for more details. |
| 1257 | +# |
| 1258 | +# You should have received a copy of the GNU Library General Public |
| 1259 | +# License along with this program. If not, see |
| 1260 | +# <http://www.gnu.org/licenses/>. |
| 1261 | +# |
| 1262 | + |
| 1263 | +'''Common classes and functions for package tests.''' |
| 1264 | + |
| 1265 | +import string, random, crypt, subprocess, pwd, grp, signal, time, unittest, tempfile, shutil, os, os.path, re, glob |
| 1266 | +import sys, socket, gzip |
| 1267 | +from stat import * |
| 1268 | +from encodings import string_escape |
| 1269 | + |
| 1270 | +import warnings |
| 1271 | +warnings.filterwarnings('ignore', message=r'.*apt_pkg\.TagFile.*', category=DeprecationWarning) |
| 1272 | +try: |
| 1273 | + import apt_pkg |
| 1274 | + apt_pkg.InitSystem(); |
| 1275 | +except: |
| 1276 | + # On non-Debian system, fall back to simple comparison without debianisms |
| 1277 | + class apt_pkg(object): |
| 1278 | + def VersionCompare(one, two): |
| 1279 | + list_one = one.split('.') |
| 1280 | + list_two = two.split('.') |
| 1281 | + while len(list_one)>0 and len(list_two)>0: |
| 1282 | + if list_one[0] > list_two[0]: |
| 1283 | + return 1 |
| 1284 | + if list_one[0] < list_two[0]: |
| 1285 | + return -1 |
| 1286 | + list_one.pop(0) |
| 1287 | + list_two.pop(0) |
| 1288 | + return 0 |
| 1289 | + |
| 1290 | +bogus_nxdomain = "208.69.32.132" |
| 1291 | + |
| 1292 | +# http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2009-07-02-python-sigpipe.html |
| 1293 | +# This is needed so that the subprocesses that produce endless output |
| 1294 | +# actually quit when the reader goes away. |
| 1295 | +import signal |
| 1296 | +def subprocess_setup(): |
| 1297 | + # Python installs a SIGPIPE handler by default. This is usually not what |
| 1298 | + # non-Python subprocesses expect. |
| 1299 | + signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
| 1300 | + |
| 1301 | +class TimedOutException(Exception): |
| 1302 | + def __init__(self, value = "Timed Out"): |
| 1303 | + self.value = value |
| 1304 | + def __str__(self): |
| 1305 | + return repr(self.value) |
| 1306 | + |
| 1307 | +def _restore_backup(path): |
| 1308 | + pathbackup = path + '.autotest' |
| 1309 | + if os.path.exists(pathbackup): |
| 1310 | + shutil.move(pathbackup, path) |
| 1311 | + |
| 1312 | +def _save_backup(path): |
| 1313 | + pathbackup = path + '.autotest' |
| 1314 | + if os.path.exists(path) and not os.path.exists(pathbackup): |
| 1315 | + shutil.copy2(path, pathbackup) |
| 1316 | + # copy2 does not copy ownership, so do it here. |
| 1317 | + # Reference: http://docs.python.org/library/shutil.html |
| 1318 | + a = os.stat(path) |
| 1319 | + os.chown(pathbackup, a[4], a[5]) |
| 1320 | + |
| 1321 | +def config_copydir(path): |
| 1322 | + if os.path.exists(path) and not os.path.isdir(path): |
| 1323 | + raise OSError, "'%s' is not a directory" % (path) |
| 1324 | + _restore_backup(path) |
| 1325 | + |
| 1326 | + pathbackup = path + '.autotest' |
| 1327 | + if os.path.exists(path): |
| 1328 | + shutil.copytree(path, pathbackup, symlinks=True) |
| 1329 | + |
| 1330 | +def config_replace(path,contents,append=False): |
| 1331 | + '''Replace (or append) to a config file''' |
| 1332 | + _restore_backup(path) |
| 1333 | + if os.path.exists(path): |
| 1334 | + _save_backup(path) |
| 1335 | + if append: |
| 1336 | + contents = file(path).read() + contents |
| 1337 | + open(path, 'w').write(contents) |
| 1338 | + |
| 1339 | +def config_comment(path, field): |
| 1340 | + _save_backup(path) |
| 1341 | + contents = "" |
| 1342 | + for line in file(path): |
| 1343 | + if re.search("^\s*%s\s*=" % (field), line): |
| 1344 | + line = "#" + line |
| 1345 | + contents += line |
| 1346 | + |
| 1347 | + open(path+'.new', 'w').write(contents) |
| 1348 | + os.rename(path+'.new', path) |
| 1349 | + |
| 1350 | +def config_set(path, field, value, spaces=True): |
| 1351 | + _save_backup(path) |
| 1352 | + contents = "" |
| 1353 | + if spaces==True: |
| 1354 | + setting = '%s = %s\n' % (field, value) |
| 1355 | + else: |
| 1356 | + setting = '%s=%s\n' % (field, value) |
| 1357 | + found = False |
| 1358 | + for line in file(path): |
| 1359 | + if re.search("^\s*%s\s*=" % (field), line): |
| 1360 | + found = True |
| 1361 | + line = setting |
| 1362 | + contents += line |
| 1363 | + if not found: |
| 1364 | + contents += setting |
| 1365 | + |
| 1366 | + open(path+'.new', 'w').write(contents) |
| 1367 | + os.rename(path+'.new', path) |
| 1368 | + |
| 1369 | +def config_patch(path, patch, depth=1): |
| 1370 | + '''Patch a config file''' |
| 1371 | + _restore_backup(path) |
| 1372 | + _save_backup(path) |
| 1373 | + |
| 1374 | + handle, name = mkstemp_fill(patch) |
| 1375 | + rc = subprocess.call(['/usr/bin/patch', '-p%s' %(depth), path], stdin=handle, stdout=subprocess.PIPE) |
| 1376 | + os.unlink(name) |
| 1377 | + if rc != 0: |
| 1378 | + raise Exception("Patch failed") |
| 1379 | + |
| 1380 | +def config_restore(path): |
| 1381 | + '''Rename a replaced config file back to its initial state''' |
| 1382 | + _restore_backup(path) |
| 1383 | + |
| 1384 | +def timeout(secs, f, *args): |
| 1385 | + def handler(signum, frame): |
| 1386 | + raise TimedOutException() |
| 1387 | + |
| 1388 | + old = signal.signal(signal.SIGALRM, handler) |
| 1389 | + result = None |
| 1390 | + signal.alarm(secs) |
| 1391 | + try: |
| 1392 | + result = f(*args) |
| 1393 | + finally: |
| 1394 | + signal.alarm(0) |
| 1395 | + signal.signal(signal.SIGALRM, old) |
| 1396 | + |
| 1397 | + return result |
| 1398 | + |
| 1399 | +def require_nonroot(): |
| 1400 | + if os.geteuid() == 0: |
| 1401 | + print >>sys.stderr, "This series of tests should be run as a regular user with sudo access, not as root." |
| 1402 | + sys.exit(1) |
| 1403 | + |
| 1404 | +def require_root(): |
| 1405 | + if os.geteuid() != 0: |
| 1406 | + print >>sys.stderr, "This series of tests should be run with root privileges (e.g. via sudo)." |
| 1407 | + sys.exit(1) |
| 1408 | + |
| 1409 | +def require_sudo(): |
| 1410 | + if os.geteuid() != 0 or os.environ.get('SUDO_USER', None) == None: |
| 1411 | + print >>sys.stderr, "This series of tests must be run under sudo." |
| 1412 | + sys.exit(1) |
| 1413 | + if os.environ['SUDO_USER'] == 'root': |
| 1414 | + print >>sys.stderr, 'Please run this test using sudo from a regular user. (You ran sudo from root.)' |
| 1415 | + sys.exit(1) |
| 1416 | + |
| 1417 | +def random_string(length,lower=False): |
| 1418 | + '''Return a random string, consisting of ASCII letters, with given |
| 1419 | + length.''' |
| 1420 | + |
| 1421 | + s = '' |
| 1422 | + selection = string.letters |
| 1423 | + if lower: |
| 1424 | + selection = string.lowercase |
| 1425 | + maxind = len(selection)-1 |
| 1426 | + for l in range(length): |
| 1427 | + s += selection[random.randint(0, maxind)] |
| 1428 | + return s |
| 1429 | + |
| 1430 | +def mkstemp_fill(contents,suffix='',prefix='testlib-',dir=None): |
| 1431 | + '''As tempfile.mkstemp does, return a (file, name) pair, but with |
| 1432 | + prefilled contents.''' |
| 1433 | + |
| 1434 | + handle, name = tempfile.mkstemp(suffix=suffix,prefix=prefix,dir=dir) |
| 1435 | + os.close(handle) |
| 1436 | + handle = file(name,"w+") |
| 1437 | + handle.write(contents) |
| 1438 | + handle.flush() |
| 1439 | + handle.seek(0) |
| 1440 | + |
| 1441 | + return handle, name |
| 1442 | + |
| 1443 | +def create_fill(path, contents, mode=0644): |
| 1444 | + '''Safely create a page''' |
| 1445 | + # make the temp file in the same dir as the destination file so we |
| 1446 | + # don't get invalid cross-device link errors when we rename |
| 1447 | + handle, name = mkstemp_fill(contents, dir=os.path.dirname(path)) |
| 1448 | + handle.close() |
| 1449 | + os.rename(name, path) |
| 1450 | + os.chmod(path, mode) |
| 1451 | + |
| 1452 | +def login_exists(login): |
| 1453 | + '''Checks whether the given login exists on the system.''' |
| 1454 | + |
| 1455 | + try: |
| 1456 | + pwd.getpwnam(login) |
| 1457 | + return True |
| 1458 | + except KeyError: |
| 1459 | + return False |
| 1460 | + |
| 1461 | +def group_exists(group): |
| 1462 | + '''Checks whether the given login exists on the system.''' |
| 1463 | + |
| 1464 | + try: |
| 1465 | + grp.getgrnam(group) |
| 1466 | + return True |
| 1467 | + except KeyError: |
| 1468 | + return False |
| 1469 | + |
| 1470 | +def recursive_rm(dirPath, contents_only=False): |
| 1471 | + '''recursively remove directory''' |
| 1472 | + names = os.listdir(dirPath) |
| 1473 | + for name in names: |
| 1474 | + path = os.path.join(dirPath, name) |
| 1475 | + if os.path.islink(path) or not os.path.isdir(path): |
| 1476 | + os.unlink(path) |
| 1477 | + else: |
| 1478 | + recursive_rm(path) |
| 1479 | + if contents_only == False: |
| 1480 | + os.rmdir(dirPath) |
| 1481 | + |
| 1482 | +def check_pidfile(exe, pidfile): |
| 1483 | + '''Checks if pid in pidfile is running''' |
| 1484 | + if not os.path.exists(pidfile): |
| 1485 | + return False |
| 1486 | + |
| 1487 | + # get the pid |
| 1488 | + try: |
| 1489 | + fd = open(pidfile, 'r') |
| 1490 | + pid = fd.readline().rstrip('\n') |
| 1491 | + fd.close() |
| 1492 | + except: |
| 1493 | + return False |
| 1494 | + |
| 1495 | + return check_pid(exe, pid) |
| 1496 | + |
| 1497 | +def check_pid(exe, pid): |
| 1498 | + '''Checks if pid is running''' |
| 1499 | + |
| 1500 | + exelink = "/proc/%s/exe" % (str(pid)) |
| 1501 | + if not os.path.exists(exelink): |
| 1502 | + return False |
| 1503 | + pidexe = os.path.basename(os.readlink(exelink)) |
| 1504 | + if pidexe == exe: |
| 1505 | + return True |
| 1506 | + sys.stderr.write('check_pid(%s): expected %s, got %s' % (pid, exe, pidexe)) |
| 1507 | + return False |
| 1508 | + |
| 1509 | +def check_port(port, proto, ver=4): |
| 1510 | + '''Check if something is listening on the specified port. |
| 1511 | + WARNING: for some reason this does not work with a bind mounted /proc |
| 1512 | + ''' |
| 1513 | + assert (port >= 1) |
| 1514 | + assert (port <= 65535) |
| 1515 | + assert (proto.lower() == "tcp" or proto.lower() == "udp") |
| 1516 | + assert (ver == 4 or ver == 6) |
| 1517 | + |
| 1518 | + fn = "/proc/net/%s" % (proto) |
| 1519 | + if ver == 6: |
| 1520 | + fn += str(ver) |
| 1521 | + |
| 1522 | + rc, report = cmd(['cat', fn]) |
| 1523 | + assert (rc == 0) |
| 1524 | + |
| 1525 | + hport = "%0.4x" % port |
| 1526 | + |
| 1527 | + if re.search(': [0-9a-f]{8}:%s [0-9a-f]' % str(hport).lower(), report.lower()): |
| 1528 | + return True |
| 1529 | + return False |
| 1530 | + |
| 1531 | +def get_arch(): |
| 1532 | + '''Get the current architecture''' |
| 1533 | + rc, report = cmd(['uname', '-m']) |
| 1534 | + assert (rc == 0) |
| 1535 | + return report.strip() |
| 1536 | + |
| 1537 | +def get_memory(): |
| 1538 | + '''Gets total ram and swap''' |
| 1539 | + meminfo = "/proc/meminfo" |
| 1540 | + memtotal = 0 |
| 1541 | + swaptotal = 0 |
| 1542 | + if not os.path.exists(meminfo): |
| 1543 | + return (False, False) |
| 1544 | + |
| 1545 | + try: |
| 1546 | + fd = open(meminfo, 'r') |
| 1547 | + for line in fd.readlines(): |
| 1548 | + splitline = line.split() |
| 1549 | + if splitline[0] == 'MemTotal:': |
| 1550 | + memtotal = int(splitline[1]) |
| 1551 | + elif splitline[0] == 'SwapTotal:': |
| 1552 | + swaptotal = int(splitline[1]) |
| 1553 | + fd.close() |
| 1554 | + except: |
| 1555 | + return (False, False) |
| 1556 | + |
| 1557 | + return (memtotal,swaptotal) |
| 1558 | + |
| 1559 | +def is_running_in_vm(): |
| 1560 | + '''Check if running under a VM''' |
| 1561 | + # add other virtualization environments here |
| 1562 | + for search in ['QEMU Virtual CPU']: |
| 1563 | + rc, report = cmd_pipe(['dmesg'], ['grep', search]) |
| 1564 | + if rc == 0: |
| 1565 | + return True |
| 1566 | + return False |
| 1567 | + |
| 1568 | +def ubuntu_release(): |
| 1569 | + '''Get the Ubuntu release''' |
| 1570 | + f = "/etc/lsb-release" |
| 1571 | + try: |
| 1572 | + size = os.stat(f)[ST_SIZE] |
| 1573 | + except: |
| 1574 | + return "UNKNOWN" |
| 1575 | + |
| 1576 | + if size > 1024*1024: |
| 1577 | + raise IOError, 'Could not open "%s" (too big)' % f |
| 1578 | + |
| 1579 | + try: |
| 1580 | + fh = open("/etc/lsb-release", 'r') |
| 1581 | + except: |
| 1582 | + raise |
| 1583 | + |
| 1584 | + lines = fh.readlines() |
| 1585 | + fh.close() |
| 1586 | + |
| 1587 | + pat = re.compile(r'DISTRIB_CODENAME') |
| 1588 | + for line in lines: |
| 1589 | + if pat.search(line): |
| 1590 | + return line.split('=')[1].rstrip('\n').rstrip('\r') |
| 1591 | + |
| 1592 | + return "UNKNOWN" |
| 1593 | + |
| 1594 | +def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None, timeout = None): |
| 1595 | + '''Try to execute given command (array) and return its stdout, or return |
| 1596 | + a textual error if it failed.''' |
| 1597 | + |
| 1598 | + try: |
| 1599 | + sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True, preexec_fn=subprocess_setup) |
| 1600 | + except OSError, e: |
| 1601 | + return [127, str(e)] |
| 1602 | + |
| 1603 | + out, outerr = sp.communicate(input) |
| 1604 | + # Handle redirection of stdout |
| 1605 | + if out == None: |
| 1606 | + out = '' |
| 1607 | + # Handle redirection of stderr |
| 1608 | + if outerr == None: |
| 1609 | + outerr = '' |
| 1610 | + return [sp.returncode,out+outerr] |
| 1611 | + |
| 1612 | +def cmd_pipe(command1, command2, input = None, stderr = subprocess.STDOUT, stdin = None): |
| 1613 | + '''Try to pipe command1 into command2.''' |
| 1614 | + try: |
| 1615 | + sp1 = subprocess.Popen(command1, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) |
| 1616 | + sp2 = subprocess.Popen(command2, stdin=sp1.stdout, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) |
| 1617 | + except OSError, e: |
| 1618 | + return [127, str(e)] |
| 1619 | + |
| 1620 | + out = sp2.communicate(input)[0] |
| 1621 | + return [sp2.returncode,out] |
| 1622 | + |
| 1623 | +def cwd_has_enough_space(cdir, total_bytes): |
| 1624 | + '''Determine if the partition of the current working directory has 'bytes' |
| 1625 | + free.''' |
| 1626 | + rc, df_output = cmd(['df']) |
| 1627 | + result = 'Got exit code %d, expected %d\n' % (rc, 0) |
| 1628 | + if rc != 0: |
| 1629 | + return False |
| 1630 | + |
| 1631 | + kb = total_bytes / 1024 |
| 1632 | + |
| 1633 | + mounts = dict() |
| 1634 | + for line in df_output.splitlines(): |
| 1635 | + if '/' not in line: |
| 1636 | + continue |
| 1637 | + tmp = line.split() |
| 1638 | + mounts[tmp[5]] = int(tmp[3]) |
| 1639 | + |
| 1640 | + cdir = os.getcwd() |
| 1641 | + while cdir != '/': |
| 1642 | + if not mounts.has_key(cdir): |
| 1643 | + cdir = os.path.dirname(cdir) |
| 1644 | + continue |
| 1645 | + if kb < mounts[cdir]: |
| 1646 | + return True |
| 1647 | + else: |
| 1648 | + return False |
| 1649 | + |
| 1650 | + if kb < mounts['/']: |
| 1651 | + return True |
| 1652 | + |
| 1653 | + return False |
| 1654 | + |
| 1655 | +def get_md5(filename): |
| 1656 | + '''Gets the md5sum of the file specified''' |
| 1657 | + |
| 1658 | + (rc, report) = cmd(["/usr/bin/md5sum", "-b", filename]) |
| 1659 | + expected = 0 |
| 1660 | + assert (expected == rc) |
| 1661 | + |
| 1662 | + return report.split(' ')[0] |
| 1663 | + |
| 1664 | +def dpkg_compare_installed_version(pkg, check, version): |
| 1665 | + '''Gets the version for the installed package, and compares it to the |
| 1666 | + specified version. |
| 1667 | + ''' |
| 1668 | + (rc, report) = cmd(["/usr/bin/dpkg", "-s", pkg]) |
| 1669 | + assert (rc == 0) |
| 1670 | + assert ("Status: install ok installed" in report) |
| 1671 | + installed_version = "" |
| 1672 | + for line in report.splitlines(): |
| 1673 | + if line.startswith("Version: "): |
| 1674 | + installed_version = line.split()[1] |
| 1675 | + |
| 1676 | + assert (installed_version != "") |
| 1677 | + |
| 1678 | + (rc, report) = cmd(["/usr/bin/dpkg", "--compare-versions", installed_version, check, version]) |
| 1679 | + assert (rc == 0 or rc == 1) |
| 1680 | + if rc == 0: |
| 1681 | + return True |
| 1682 | + return False |
| 1683 | + |
| 1684 | +def prepare_source(source, builder, cached_src, build_src, patch_system): |
| 1685 | + '''Download and unpack source package, installing necessary build depends, |
| 1686 | + adjusting the permissions for the 'builder' user, and returning the |
| 1687 | + directory of the unpacked source. Patch system can be one of: |
| 1688 | + - cdbs |
| 1689 | + - dpatch |
| 1690 | + - quilt |
| 1691 | + - quiltv3 |
| 1692 | + - None (not the string) |
| 1693 | + |
| 1694 | + This is normally used like this: |
| 1695 | + |
| 1696 | + def setUp(self): |
| 1697 | + ... |
| 1698 | + self.topdir = os.getcwd() |
| 1699 | + self.cached_src = os.path.join(os.getcwd(), "source") |
| 1700 | + self.tmpdir = tempfile.mkdtemp(prefix='testlib', dir='/tmp') |
| 1701 | + self.builder = testlib.TestUser() |
| 1702 | + testlib.cmd(['chgrp', self.builder.login, self.tmpdir]) |
| 1703 | + os.chmod(self.tmpdir, 0775) |
| 1704 | + |
| 1705 | + def tearDown(self): |
| 1706 | + ... |
| 1707 | + self.builder = None |
| 1708 | + self.topdir = os.getcwd() |
| 1709 | + if os.path.exists(self.tmpdir): |
| 1710 | + testlib.recursive_rm(self.tmpdir) |
| 1711 | + |
| 1712 | + def test_suite_build(self): |
| 1713 | + ... |
| 1714 | + build_dir = testlib.prepare_source('foo', \ |
| 1715 | + self.builder, \ |
| 1716 | + self.cached_src, \ |
| 1717 | + os.path.join(self.tmpdir, \ |
| 1718 | + os.path.basename(self.cached_src)), |
| 1719 | + "quilt") |
| 1720 | + os.chdir(build_dir) |
| 1721 | + |
| 1722 | + # Example for typical build, adjust as necessary |
| 1723 | + print "" |
| 1724 | + print " make clean" |
| 1725 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'clean']) |
| 1726 | + |
| 1727 | + print " configure" |
| 1728 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, './configure', '--prefix=%s' % self.tmpdir, '--enable-debug']) |
| 1729 | + |
| 1730 | + print " make (will take a while)" |
| 1731 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make']) |
| 1732 | + |
| 1733 | + print " make check (will take a while)", |
| 1734 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'check']) |
| 1735 | + expected = 0 |
| 1736 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1737 | + self.assertEquals(expected, rc, result + report) |
| 1738 | + |
| 1739 | + def test_suite_cleanup(self): |
| 1740 | + ... |
| 1741 | + if os.path.exists(self.cached_src): |
| 1742 | + testlib.recursive_rm(self.cached_src) |
| 1743 | + |
| 1744 | + It is up to the caller to clean up cached_src and build_src (as in the |
| 1745 | + above example, often the build_src is in a tmpdir that is cleaned in |
| 1746 | + tearDown() and the cached_src is cleaned in a one time clean-up |
| 1747 | + operation (eg 'test_suite_cleanup()) which must be run after the build |
| 1748 | + suite test (obviously). |
| 1749 | + ''' |
| 1750 | + |
| 1751 | + # Make sure we have a clean slate |
| 1752 | + assert (os.path.exists(os.path.dirname(build_src))) |
| 1753 | + assert (not os.path.exists(build_src)) |
| 1754 | + |
| 1755 | + cdir = os.getcwd() |
| 1756 | + if os.path.exists(cached_src): |
| 1757 | + shutil.copytree(cached_src, build_src) |
| 1758 | + os.chdir(build_src) |
| 1759 | + else: |
| 1760 | + # Only install the build dependencies on the initial setup |
| 1761 | + rc, report = cmd(['apt-get','-y','--force-yes','build-dep',source]) |
| 1762 | + assert (rc == 0) |
| 1763 | + |
| 1764 | + os.makedirs(build_src) |
| 1765 | + os.chdir(build_src) |
| 1766 | + |
| 1767 | + # These are always needed |
| 1768 | + pkgs = ['build-essential', 'dpkg-dev', 'fakeroot'] |
| 1769 | + rc, report = cmd(['apt-get','-y','--force-yes','install'] + pkgs) |
| 1770 | + assert (rc == 0) |
| 1771 | + |
| 1772 | + rc, report = cmd(['apt-get','source',source]) |
| 1773 | + assert (rc == 0) |
| 1774 | + shutil.copytree(build_src, cached_src) |
| 1775 | + |
| 1776 | + unpacked_dir = os.path.join(build_src, glob.glob('%s-*' % source)[0]) |
| 1777 | + |
| 1778 | + # Now apply the patches. Do it here so that we don't mess up our cached |
| 1779 | + # sources. |
| 1780 | + os.chdir(unpacked_dir) |
| 1781 | + assert (patch_system in ['cdbs', 'dpatch', 'quilt', 'quiltv3', None]) |
| 1782 | + if patch_system != None and patch_system != "quiltv3": |
| 1783 | + if patch_system == "quilt": |
| 1784 | + os.environ.setdefault('QUILT_PATCHES','debian/patches') |
| 1785 | + rc, report = cmd(['quilt', 'push', '-a']) |
| 1786 | + assert (rc == 0) |
| 1787 | + elif patch_system == "cdbs": |
| 1788 | + rc, report = cmd(['./debian/rules', 'apply-patches']) |
| 1789 | + assert (rc == 0) |
| 1790 | + elif patch_system == "dpatch": |
| 1791 | + rc, report = cmd(['dpatch', 'apply-all']) |
| 1792 | + assert (rc == 0) |
| 1793 | + |
| 1794 | + cmd(['chown', '-R', '%s:%s' % (builder.uid, builder.gid), build_src]) |
| 1795 | + os.chdir(cdir) |
| 1796 | + |
| 1797 | + return unpacked_dir |
| 1798 | + |
| 1799 | +def _aa_status(): |
| 1800 | + '''Get aa-status output''' |
| 1801 | + exe = "/usr/sbin/aa-status" |
| 1802 | + assert (os.path.exists(exe)) |
| 1803 | + if os.geteuid() == 0: |
| 1804 | + return cmd([exe]) |
| 1805 | + return cmd(['sudo', exe]) |
| 1806 | + |
| 1807 | +def is_apparmor_loaded(path): |
| 1808 | + '''Check if profile is loaded''' |
| 1809 | + rc, report = _aa_status() |
| 1810 | + if rc != 0: |
| 1811 | + return False |
| 1812 | + |
| 1813 | + for line in report.splitlines(): |
| 1814 | + if line.endswith(path): |
| 1815 | + return True |
| 1816 | + return False |
| 1817 | + |
| 1818 | +def is_apparmor_confined(path): |
| 1819 | + '''Check if application is confined''' |
| 1820 | + rc, report = _aa_status() |
| 1821 | + if rc != 0: |
| 1822 | + return False |
| 1823 | + |
| 1824 | + for line in report.splitlines(): |
| 1825 | + if re.search('%s \(' % path, line): |
| 1826 | + return True |
| 1827 | + return False |
| 1828 | + |
| 1829 | +def check_apparmor(path, first_ubuntu_release, is_running=True): |
| 1830 | + '''Check if path is loaded and confined for everything higher than the |
| 1831 | + first Ubuntu release specified. |
| 1832 | + |
| 1833 | + Usage: |
| 1834 | + rc, report = testlib.check_apparmor('/usr/sbin/foo', 8.04, is_running=True) |
| 1835 | + if rc < 0: |
| 1836 | + return self._skipped(report) |
| 1837 | + |
| 1838 | + expected = 0 |
| 1839 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1840 | + self.assertEquals(expected, rc, result + report) |
| 1841 | + ''' |
| 1842 | + global manager |
| 1843 | + rc = -1 |
| 1844 | + |
| 1845 | + if manager.lsb_release["Release"] < first_ubuntu_release: |
| 1846 | + return (rc, "Skipped apparmor check") |
| 1847 | + |
| 1848 | + if not os.path.exists('/sbin/apparmor_parser'): |
| 1849 | + return (rc, "Skipped (couldn't find apparmor_parser)") |
| 1850 | + |
| 1851 | + rc = 0 |
| 1852 | + msg = "" |
| 1853 | + if not is_apparmor_loaded(path): |
| 1854 | + rc = 1 |
| 1855 | + msg = "Profile not loaded for '%s'" % path |
| 1856 | + |
| 1857 | + # this check only makes sense it the 'path' is currently executing |
| 1858 | + if is_running and rc == 0 and not is_apparmor_confined(path): |
| 1859 | + rc = 1 |
| 1860 | + msg = "'%s' is not running in enforce mode" % path |
| 1861 | + |
| 1862 | + return (rc, msg) |
| 1863 | + |
| 1864 | +def get_gcc_version(gcc, full=True): |
| 1865 | + gcc_version = 'none' |
| 1866 | + if not gcc.startswith('/'): |
| 1867 | + gcc = '/usr/bin/%s' % (gcc) |
| 1868 | + if os.path.exists(gcc): |
| 1869 | + gcc_version = 'unknown' |
| 1870 | + lines = cmd([gcc,'-v'])[1].strip().splitlines() |
| 1871 | + version_lines = [x for x in lines if x.startswith('gcc version')] |
| 1872 | + if len(version_lines) == 1: |
| 1873 | + gcc_version = " ".join(version_lines[0].split()[2:]) |
| 1874 | + if not full: |
| 1875 | + return gcc_version.split()[0] |
| 1876 | + return gcc_version |
| 1877 | + |
| 1878 | +def is_kdeinit_running(): |
| 1879 | + '''Test if kdeinit is running''' |
| 1880 | + # applications that use kdeinit will spawn it if it isn't running in the |
| 1881 | + # test. This is a problem because it does not exit. This is a helper to |
| 1882 | + # check for it. |
| 1883 | + rc, report = cmd(['ps', 'x']) |
| 1884 | + if 'kdeinit4 Running' not in report: |
| 1885 | + print >>sys.stderr, ("kdeinit not running (you may start/stop any KDE application then run this script again)") |
| 1886 | + return False |
| 1887 | + return True |
| 1888 | + |
| 1889 | +def get_pkgconfig_flags(libs=[]): |
| 1890 | + '''Find pkg-config flags for libraries''' |
| 1891 | + assert (len(libs) > 0) |
| 1892 | + rc, pkg_config = cmd(['pkg-config', '--cflags', '--libs'] + libs) |
| 1893 | + expected = 0 |
| 1894 | + if rc != expected: |
| 1895 | + print >>sys.stderr, 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1896 | + assert(rc == expected) |
| 1897 | + return pkg_config.split() |
| 1898 | + |
| 1899 | +class TestDaemon: |
| 1900 | + '''Helper class to manage daemons consistently''' |
| 1901 | + def __init__(self, init): |
| 1902 | + '''Setup daemon attributes''' |
| 1903 | + self.initscript = init |
| 1904 | + |
| 1905 | + def start(self): |
| 1906 | + '''Start daemon''' |
| 1907 | + rc, report = cmd([self.initscript, 'start']) |
| 1908 | + expected = 0 |
| 1909 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1910 | + time.sleep(2) |
| 1911 | + if expected != rc: |
| 1912 | + return (False, result + report) |
| 1913 | + |
| 1914 | + if "fail" in report: |
| 1915 | + return (False, "Found 'fail' in report\n" + report) |
| 1916 | + |
| 1917 | + return (True, "") |
| 1918 | + |
| 1919 | + def stop(self): |
| 1920 | + '''Stop daemon''' |
| 1921 | + rc, report = cmd([self.initscript, 'stop']) |
| 1922 | + expected = 0 |
| 1923 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1924 | + if expected != rc: |
| 1925 | + return (False, result + report) |
| 1926 | + |
| 1927 | + if "fail" in report: |
| 1928 | + return (False, "Found 'fail' in report\n" + report) |
| 1929 | + |
| 1930 | + return (True, "") |
| 1931 | + |
| 1932 | + def reload(self): |
| 1933 | + '''Reload daemon''' |
| 1934 | + rc, report = cmd([self.initscript, 'force-reload']) |
| 1935 | + expected = 0 |
| 1936 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1937 | + if expected != rc: |
| 1938 | + return (False, result + report) |
| 1939 | + |
| 1940 | + if "fail" in report: |
| 1941 | + return (False, "Found 'fail' in report\n" + report) |
| 1942 | + |
| 1943 | + return (True, "") |
| 1944 | + |
| 1945 | + def restart(self): |
| 1946 | + '''Restart daemon''' |
| 1947 | + (res, str) = self.stop() |
| 1948 | + if not res: |
| 1949 | + return (res, str) |
| 1950 | + |
| 1951 | + (res, str) = self.start() |
| 1952 | + if not res: |
| 1953 | + return (res, str) |
| 1954 | + |
| 1955 | + return (True, "") |
| 1956 | + |
| 1957 | + def status(self): |
| 1958 | + '''Check daemon status''' |
| 1959 | + rc, report = cmd([self.initscript, 'status']) |
| 1960 | + expected = 0 |
| 1961 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 1962 | + if expected != rc: |
| 1963 | + return (False, result + report) |
| 1964 | + |
| 1965 | + if "fail" in report: |
| 1966 | + return (False, "Found 'fail' in report\n" + report) |
| 1967 | + |
| 1968 | + return (True, "") |
| 1969 | + |
| 1970 | +class TestlibManager(object): |
| 1971 | + '''Singleton class used to set up per-test-run information''' |
| 1972 | + def __init__(self): |
| 1973 | + # Set glibc aborts to dump to stderr instead of the tty so test output |
| 1974 | + # is more sane. |
| 1975 | + os.environ.setdefault('LIBC_FATAL_STDERR_','1') |
| 1976 | + |
| 1977 | + # check verbosity |
| 1978 | + self.verbosity = False |
| 1979 | + if (len(sys.argv) > 1 and '-v' in sys.argv[1:]): |
| 1980 | + self.verbosity = True |
| 1981 | + |
| 1982 | + # Load LSB release file |
| 1983 | + self.lsb_release = dict() |
| 1984 | + if not os.path.exists('/usr/bin/lsb_release') and not os.path.exists('/bin/lsb_release'): |
| 1985 | + raise OSError, "Please install 'lsb-release'" |
| 1986 | + for line in subprocess.Popen(['lsb_release','-a'],stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[0].splitlines(): |
| 1987 | + field, value = line.split(':',1) |
| 1988 | + value=value.strip() |
| 1989 | + field=field.strip() |
| 1990 | + # Convert numerics |
| 1991 | + try: |
| 1992 | + value = float(value) |
| 1993 | + except: |
| 1994 | + pass |
| 1995 | + self.lsb_release.setdefault(field,value) |
| 1996 | + |
| 1997 | + # FIXME: hack OEM releases into known-Ubuntu versions |
| 1998 | + if self.lsb_release['Distributor ID'] == "HP MIE (Mobile Internet Experience)": |
| 1999 | + if self.lsb_release['Release'] == 1.0: |
| 2000 | + self.lsb_release['Distributor ID'] = "Ubuntu" |
| 2001 | + self.lsb_release['Release'] = 8.04 |
| 2002 | + else: |
| 2003 | + raise OSError, "Unknown version of HP MIE" |
| 2004 | + |
| 2005 | + # FIXME: hack to assume a most-recent release if we're not |
| 2006 | + # running under Ubuntu. |
| 2007 | + if self.lsb_release['Distributor ID'] not in ["Ubuntu","Linaro"]: |
| 2008 | + self.lsb_release['Release'] = 10000 |
| 2009 | + # Adjust Linaro release to pretend to be Ubuntu |
| 2010 | + if self.lsb_release['Distributor ID'] in ["Linaro"]: |
| 2011 | + self.lsb_release['Distributor ID'] = "Ubuntu" |
| 2012 | + self.lsb_release['Release'] -= 0.01 |
| 2013 | + |
| 2014 | + # Load arch |
| 2015 | + if not os.path.exists('/usr/bin/dpkg'): |
| 2016 | + machine = cmd(['uname','-m'])[1].strip() |
| 2017 | + if machine.endswith('86'): |
| 2018 | + self.dpkg_arch = 'i386' |
| 2019 | + elif machine.endswith('_64'): |
| 2020 | + self.dpkg_arch = 'amd64' |
| 2021 | + elif machine.startswith('arm'): |
| 2022 | + self.dpkg_arch = 'armel' |
| 2023 | + else: |
| 2024 | + raise ValueError, "Unknown machine type '%s'" % (machine) |
| 2025 | + else: |
| 2026 | + self.dpkg_arch = cmd(['dpkg','--print-architecture'])[1].strip() |
| 2027 | + |
| 2028 | + # Find kernel version |
| 2029 | + self.kernel_is_ubuntu = False |
| 2030 | + self.kernel_version_signature = None |
| 2031 | + self.kernel_version = cmd(["uname","-r"])[1].strip() |
| 2032 | + versig = '/proc/version_signature' |
| 2033 | + if os.path.exists(versig): |
| 2034 | + self.kernel_is_ubuntu = True |
| 2035 | + self.kernel_version_signature = file(versig).read().strip() |
| 2036 | + self.kernel_version_ubuntu = self.kernel_version |
| 2037 | + elif os.path.exists('/usr/bin/dpkg'): |
| 2038 | + # this can easily be inaccurate but is only an issue for Dapper |
| 2039 | + rc, out = cmd(['dpkg','-l','linux-image-%s' % (self.kernel_version)]) |
| 2040 | + if rc == 0: |
| 2041 | + self.kernel_version_signature = out.strip().split('\n').pop().split()[2] |
| 2042 | + self.kernel_version_ubuntu = self.kernel_version_signature |
| 2043 | + if self.kernel_version_signature == None: |
| 2044 | + # Attempt to fall back to something for non-Debian-based |
| 2045 | + self.kernel_version_signature = self.kernel_version |
| 2046 | + self.kernel_version_ubuntu = self.kernel_version |
| 2047 | + # Build ubuntu version without hardware suffix |
| 2048 | + try: |
| 2049 | + self.kernel_version_ubuntu = "-".join([x for x in self.kernel_version_signature.split(' ')[1].split('-') if re.search('^[0-9]', x)]) |
| 2050 | + except: |
| 2051 | + pass |
| 2052 | + |
| 2053 | + # Find gcc version |
| 2054 | + self.gcc_version = get_gcc_version('gcc') |
| 2055 | + |
| 2056 | + # Find libc |
| 2057 | + self.path_libc = [x.split()[2] for x in cmd(['ldd','/bin/ls'])[1].splitlines() if x.startswith('\tlibc.so.')][0] |
| 2058 | + |
| 2059 | + # Report self |
| 2060 | + if self.verbosity: |
| 2061 | + kernel = self.kernel_version_ubuntu |
| 2062 | + if kernel != self.kernel_version_signature: |
| 2063 | + kernel += " (%s)" % (self.kernel_version_signature) |
| 2064 | + print >>sys.stdout, "Running test: '%s' distro: '%s %.2f' kernel: '%s' arch: '%s' uid: %d/%d SUDO_USER: '%s')" % ( \ |
| 2065 | + sys.argv[0], |
| 2066 | + self.lsb_release['Distributor ID'], |
| 2067 | + self.lsb_release['Release'], |
| 2068 | + kernel, |
| 2069 | + self.dpkg_arch, |
| 2070 | + os.geteuid(), os.getuid(), |
| 2071 | + os.environ.get('SUDO_USER', '')) |
| 2072 | + sys.stdout.flush() |
| 2073 | + |
| 2074 | + # Additional heuristics |
| 2075 | + #if os.environ.get('SUDO_USER', os.environ.get('USER', '')) in ['mdeslaur']: |
| 2076 | + # sys.stdout.write("Replying to Marc Deslauriers in http://launchpad.net/bugs/%d: " % random.randint(600000, 980000)) |
| 2077 | + # sys.stdout.flush() |
| 2078 | + # time.sleep(0.5) |
| 2079 | + # sys.stdout.write("destroyed\n") |
| 2080 | + # time.sleep(0.5) |
| 2081 | + |
| 2082 | + def hello(self, msg): |
| 2083 | + print >>sys.stderr, "Hello from %s" % (msg) |
| 2084 | +# The central instance |
| 2085 | +manager = TestlibManager() |
| 2086 | + |
| 2087 | +class TestlibCase(unittest.TestCase): |
| 2088 | + def __init__(self, *args): |
| 2089 | + '''This is called for each TestCase test instance, which isn't much better |
| 2090 | + than SetUp.''' |
| 2091 | + |
| 2092 | + unittest.TestCase.__init__(self, *args) |
| 2093 | + |
| 2094 | + # Attach to and duplicate dicts from manager singleton |
| 2095 | + self.manager = manager |
| 2096 | + #self.manager.hello(repr(self) + repr(*args)) |
| 2097 | + self.my_verbosity = self.manager.verbosity |
| 2098 | + self.lsb_release = self.manager.lsb_release |
| 2099 | + self.dpkg_arch = self.manager.dpkg_arch |
| 2100 | + self.kernel_version = self.manager.kernel_version |
| 2101 | + self.kernel_version_signature = self.manager.kernel_version_signature |
| 2102 | + self.kernel_version_ubuntu = self.manager.kernel_version_ubuntu |
| 2103 | + self.kernel_is_ubuntu = self.manager.kernel_is_ubuntu |
| 2104 | + self.gcc_version = self.manager.gcc_version |
| 2105 | + self.path_libc = self.manager.path_libc |
| 2106 | + |
| 2107 | + def version_compare(self, one, two): |
| 2108 | + return apt_pkg.VersionCompare(one,two) |
| 2109 | + |
| 2110 | + def assertFileType(self, filename, filetype): |
| 2111 | + '''Checks the file type of the file specified''' |
| 2112 | + |
| 2113 | + (rc, report, out) = self._testlib_shell_cmd(["/usr/bin/file", "-b", filename]) |
| 2114 | + out = out.strip() |
| 2115 | + expected = 0 |
| 2116 | + # Absolutely no idea why this happens on Hardy |
| 2117 | + if self.lsb_release['Release'] == 8.04 and rc == 255 and len(out) > 0: |
| 2118 | + rc = 0 |
| 2119 | + result = 'Got exit code %d, expected %d:\n%s\n' % (rc, expected, report) |
| 2120 | + self.assertEquals(expected, rc, result) |
| 2121 | + |
| 2122 | + filetype = '^%s$' % (filetype) |
| 2123 | + result = 'File type reported by file: [%s], expected regex: [%s]\n' % (out, filetype) |
| 2124 | + self.assertNotEquals(None, re.search(filetype, out), result) |
| 2125 | + |
| 2126 | + def yank_commonname_from_cert(self, certfile): |
| 2127 | + '''Extract the commonName from a given PEM''' |
| 2128 | + rc, out = cmd(['openssl','asn1parse','-in',certfile]) |
| 2129 | + if rc == 0: |
| 2130 | + ready = False |
| 2131 | + for line in out.splitlines(): |
| 2132 | + if ready: |
| 2133 | + return line.split(':')[-1] |
| 2134 | + if ':commonName' in line: |
| 2135 | + ready = True |
| 2136 | + return socket.getfqdn() |
| 2137 | + |
| 2138 | + def announce(self, text): |
| 2139 | + if self.my_verbosity: |
| 2140 | + print >>sys.stdout, "(%s) " % (text), |
| 2141 | + sys.stdout.flush() |
| 2142 | + |
| 2143 | + def make_clean(self): |
| 2144 | + rc, output = self.shell_cmd(['make','clean']) |
| 2145 | + self.assertEquals(rc, 0, output) |
| 2146 | + |
| 2147 | + def get_makefile_compiler(self): |
| 2148 | + # Find potential compiler name |
| 2149 | + compiler = 'gcc' |
| 2150 | + if os.path.exists('Makefile'): |
| 2151 | + for line in open('Makefile'): |
| 2152 | + if line.startswith('CC') and '=' in line: |
| 2153 | + items = [x.strip() for x in line.split('=')] |
| 2154 | + if items[0] == 'CC': |
| 2155 | + compiler = items[1] |
| 2156 | + break |
| 2157 | + return compiler |
| 2158 | + |
| 2159 | + def make_target(self, target, expected=0): |
| 2160 | + '''Compile a target and report output''' |
| 2161 | + |
| 2162 | + compiler = self.get_makefile_compiler() |
| 2163 | + rc, output = self.shell_cmd(['make',target]) |
| 2164 | + self.assertEquals(rc, expected, 'rc(%d)!=%d:\n' % (rc, expected) + output) |
| 2165 | + self.assertTrue('%s ' % (compiler) in output, 'Expected "%s":' % (compiler) + output) |
| 2166 | + return output |
| 2167 | + |
| 2168 | + # call as return testlib.skipped() |
| 2169 | + def _skipped(self, reason=""): |
| 2170 | + '''Provide a visible way to indicate that a test was skipped''' |
| 2171 | + if reason != "": |
| 2172 | + reason = ': %s' % (reason) |
| 2173 | + self.announce("skipped%s" % (reason)) |
| 2174 | + return False |
| 2175 | + |
| 2176 | + def _testlib_shell_cmd(self,args,stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT): |
| 2177 | + argstr = "'" + "', '".join(args).strip() + "'" |
| 2178 | + rc, out = cmd(args,stdin=stdin,stdout=stdout,stderr=stderr) |
| 2179 | + report = 'Command: ' + argstr + '\nOutput:\n' + out |
| 2180 | + return rc, report, out |
| 2181 | + |
| 2182 | + def shell_cmd(self, args, stdin=None): |
| 2183 | + return cmd(args,stdin=stdin) |
| 2184 | + |
| 2185 | + def assertShellExitEquals(self, expected, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): |
| 2186 | + '''Test a shell command matches a specific exit code''' |
| 2187 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 2188 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2189 | + self.assertEquals(expected, rc, msg + result + report) |
| 2190 | + |
| 2191 | + def assertShellExitNotEquals(self, unwanted, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): |
| 2192 | + '''Test a shell command doesn't match a specific exit code''' |
| 2193 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 2194 | + result = 'Got (unwanted) exit code %d\n' % rc |
| 2195 | + self.assertNotEquals(unwanted, rc, msg + result + report) |
| 2196 | + |
| 2197 | + def assertShellOutputContains(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False): |
| 2198 | + '''Test a shell command contains a specific output''' |
| 2199 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 2200 | + result = 'Got exit code %d. Looking for text "%s"\n' % (rc, text) |
| 2201 | + if not invert: |
| 2202 | + self.assertTrue(text in out, msg + result + report) |
| 2203 | + else: |
| 2204 | + self.assertFalse(text in out, msg + result + report) |
| 2205 | + |
| 2206 | + def assertShellOutputEquals(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False, expected=None): |
| 2207 | + '''Test a shell command matches a specific output''' |
| 2208 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 2209 | + result = 'Got exit code %d. Looking for exact text "%s" (%s)\n' % (rc, text, " ".join(args)) |
| 2210 | + if not invert: |
| 2211 | + self.assertEquals(text, out, msg + result + report) |
| 2212 | + else: |
| 2213 | + self.assertNotEquals(text, out, msg + result + report) |
| 2214 | + if expected != None: |
| 2215 | + result = 'Got exit code %d. Expected %d (%s)\n' % (rc, expected, " ".join(args)) |
| 2216 | + self.assertEquals(rc, expected, msg + result + report) |
| 2217 | + |
| 2218 | + def _word_find(self, report, content, invert=False): |
| 2219 | + '''Check for a specific string''' |
| 2220 | + if invert: |
| 2221 | + warning = 'Found "%s"\n' % content |
| 2222 | + self.assertTrue(content not in report, warning + report) |
| 2223 | + else: |
| 2224 | + warning = 'Could not find "%s"\n' % content |
| 2225 | + self.assertTrue(content in report, warning + report) |
| 2226 | + |
| 2227 | + def _test_sysctl_value(self, path, expected, msg=None, exists=True): |
| 2228 | + sysctl = '/proc/sys/%s' % (path) |
| 2229 | + self.assertEquals(exists, os.path.exists(sysctl), sysctl) |
| 2230 | + value = None |
| 2231 | + if exists: |
| 2232 | + value = int(file(sysctl).read()) |
| 2233 | + report = "%s is not %d: %d" % (sysctl, expected, value) |
| 2234 | + if msg: |
| 2235 | + report += " (%s)" % (msg) |
| 2236 | + self.assertEquals(value, expected, report) |
| 2237 | + return value |
| 2238 | + |
| 2239 | + def set_sysctl_value(self, path, desired): |
| 2240 | + sysctl = '/proc/sys/%s' % (path) |
| 2241 | + self.assertTrue(os.path.exists(sysctl),"%s does not exist" % (sysctl)) |
| 2242 | + file(sysctl,'w').write(str(desired)) |
| 2243 | + self._test_sysctl_value(path, desired) |
| 2244 | + |
| 2245 | + def kernel_at_least(self, introduced): |
| 2246 | + return self.version_compare(self.kernel_version_ubuntu, |
| 2247 | + introduced) >= 0 |
| 2248 | + |
| 2249 | + def kernel_claims_cve_fixed(self, cve): |
| 2250 | + changelog = "/usr/share/doc/linux-image-%s/changelog.Debian.gz" % (self.kernel_version) |
| 2251 | + if os.path.exists(changelog): |
| 2252 | + for line in gzip.open(changelog): |
| 2253 | + if cve in line and not "revert" in line and not "Revert" in line: |
| 2254 | + return True |
| 2255 | + return False |
| 2256 | + |
| 2257 | +class TestGroup: |
| 2258 | + '''Create a temporary test group and remove it again in the dtor.''' |
| 2259 | + |
| 2260 | + def __init__(self, group=None, lower=False): |
| 2261 | + '''Create a new group''' |
| 2262 | + |
| 2263 | + self.group = None |
| 2264 | + if group: |
| 2265 | + if group_exists(group): |
| 2266 | + raise ValueError, 'group name already exists' |
| 2267 | + else: |
| 2268 | + while(True): |
| 2269 | + group = random_string(7,lower=lower) |
| 2270 | + if not group_exists(group): |
| 2271 | + break |
| 2272 | + |
| 2273 | + assert subprocess.call(['groupadd',group]) == 0 |
| 2274 | + self.group = group |
| 2275 | + g = grp.getgrnam(self.group) |
| 2276 | + self.gid = g[2] |
| 2277 | + |
| 2278 | + def __del__(self): |
| 2279 | + '''Remove the created group.''' |
| 2280 | + |
| 2281 | + if self.group: |
| 2282 | + rc, report = cmd(['groupdel', self.group]) |
| 2283 | + assert rc == 0 |
| 2284 | + |
| 2285 | +class TestUser: |
| 2286 | + '''Create a temporary test user and remove it again in the dtor.''' |
| 2287 | + |
| 2288 | + def __init__(self, login=None, home=True, group=None, uidmin=None, lower=False, shell=None): |
| 2289 | + '''Create a new user account with a random password. |
| 2290 | + |
| 2291 | + By default, the login name is random, too, but can be explicitly |
| 2292 | + specified with 'login'. By default, a home directory is created, this |
| 2293 | + can be suppressed with 'home=False'.''' |
| 2294 | + |
| 2295 | + self.login = None |
| 2296 | + |
| 2297 | + if os.geteuid() != 0: |
| 2298 | + raise ValueError, "You must be root to run this test" |
| 2299 | + |
| 2300 | + if login: |
| 2301 | + if login_exists(login): |
| 2302 | + raise ValueError, 'login name already exists' |
| 2303 | + else: |
| 2304 | + while(True): |
| 2305 | + login = 't' + random_string(7,lower=lower) |
| 2306 | + if not login_exists(login): |
| 2307 | + break |
| 2308 | + |
| 2309 | + self.salt = random_string(2) |
| 2310 | + self.password = random_string(8,lower=lower) |
| 2311 | + self.crypted = crypt.crypt(self.password, self.salt) |
| 2312 | + |
| 2313 | + creation = ['useradd', '-p', self.crypted] |
| 2314 | + if home: |
| 2315 | + creation += ['-m'] |
| 2316 | + if group: |
| 2317 | + creation += ['-G',group] |
| 2318 | + if uidmin: |
| 2319 | + creation += ['-K','UID_MIN=%d'%uidmin] |
| 2320 | + if shell: |
| 2321 | + creation += ['-s',shell] |
| 2322 | + creation += [login] |
| 2323 | + assert subprocess.call(creation) == 0 |
| 2324 | + # Set GECOS |
| 2325 | + assert subprocess.call(['usermod','-c','Buddy %s' % (login),login]) == 0 |
| 2326 | + |
| 2327 | + self.login = login |
| 2328 | + p = pwd.getpwnam(self.login) |
| 2329 | + self.uid = p[2] |
| 2330 | + self.gid = p[3] |
| 2331 | + self.gecos = p[4] |
| 2332 | + self.home = p[5] |
| 2333 | + self.shell = p[6] |
| 2334 | + |
| 2335 | + def __del__(self): |
| 2336 | + '''Remove the created user account.''' |
| 2337 | + |
| 2338 | + if self.login: |
| 2339 | + # sanity check the login name so we don't accidentally wipe too much |
| 2340 | + if len(self.login)>3 and not '/' in self.login: |
| 2341 | + subprocess.call(['rm','-rf', '/home/'+self.login, '/var/mail/'+self.login]) |
| 2342 | + rc, report = cmd(['userdel', '-f', self.login]) |
| 2343 | + assert rc == 0 |
| 2344 | + |
| 2345 | + def add_to_group(self, group): |
| 2346 | + '''Add user to the specified group name''' |
| 2347 | + rc, report = cmd(['usermod', '-G', group, self.login]) |
| 2348 | + if rc != 0: |
| 2349 | + print report |
| 2350 | + assert rc == 0 |
| 2351 | + |
| 2352 | +# Timeout handler using alarm() from John P. Speno's Pythonic Avocado |
| 2353 | +class TimeoutFunctionException(Exception): |
| 2354 | + """Exception to raise on a timeout""" |
| 2355 | + pass |
| 2356 | +class TimeoutFunction: |
| 2357 | + def __init__(self, function, timeout): |
| 2358 | + self.timeout = timeout |
| 2359 | + self.function = function |
| 2360 | + |
| 2361 | + def handle_timeout(self, signum, frame): |
| 2362 | + raise TimeoutFunctionException() |
| 2363 | + |
| 2364 | + def __call__(self, *args, **kwargs): |
| 2365 | + old = signal.signal(signal.SIGALRM, self.handle_timeout) |
| 2366 | + signal.alarm(self.timeout) |
| 2367 | + try: |
| 2368 | + result = self.function(*args, **kwargs) |
| 2369 | + finally: |
| 2370 | + signal.signal(signal.SIGALRM, old) |
| 2371 | + signal.alarm(0) |
| 2372 | + return result |
| 2373 | + |
| 2374 | +def main(): |
| 2375 | + print "hi" |
| 2376 | + unittest.main() |
| 2377 | diff --git a/debian/tests/testlib_httpd.py b/debian/tests/testlib_httpd.py |
| 2378 | new file mode 100644 |
| 2379 | index 0000000..1468398 |
| 2380 | --- /dev/null |
| 2381 | +++ b/debian/tests/testlib_httpd.py |
| 2382 | @@ -0,0 +1,352 @@ |
| 2383 | +#!/usr/bin/python |
| 2384 | +# |
| 2385 | +# testlib_httpd.py quality assurance test script |
| 2386 | +# Copyright (C) 2008-2013 Canonical Ltd. |
| 2387 | +# Author: Jamie Strandboge <jamie@canonical.com> |
| 2388 | +# Author: Marc Deslauriers <marc.deslauriers@canonical.com> |
| 2389 | +# |
| 2390 | +# This program is free software: you can redistribute it and/or modify |
| 2391 | +# it under the terms of the GNU General Public License version 3, |
| 2392 | +# as published by the Free Software Foundation. |
| 2393 | +# |
| 2394 | +# This program is distributed in the hope that it will be useful, |
| 2395 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2396 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2397 | +# GNU General Public License for more details. |
| 2398 | +# |
| 2399 | +# You should have received a copy of the GNU General Public License |
| 2400 | +# along with this program. If not, see <httpd://www.gnu.org/licenses/>. |
| 2401 | +# |
| 2402 | + |
| 2403 | +import unittest, subprocess |
| 2404 | +import os |
| 2405 | +import sys |
| 2406 | +import tempfile |
| 2407 | +import testlib |
| 2408 | +import time |
| 2409 | +import socket |
| 2410 | +import shutil |
| 2411 | +import cookielib |
| 2412 | +import urllib2 |
| 2413 | +import re |
| 2414 | +import base64 |
| 2415 | + |
| 2416 | +class HttpdCommon(testlib.TestlibCase): |
| 2417 | + '''Common functions''' |
| 2418 | + def _setUp(self, clearlogs = False): |
| 2419 | + '''Setup''' |
| 2420 | + self.release = self.lsb_release['Codename'] |
| 2421 | + self.html_page = "/var/www/test.html" |
| 2422 | + self.php_page = "/var/www/test.php" |
| 2423 | + self.cgi_page = "/usr/lib/cgi-bin/test-cgi.pl" |
| 2424 | + self.apache2_default = "/etc/default/apache2" |
| 2425 | + self.ssl_key = "/etc/ssl/private/server.key" |
| 2426 | + self.ssl_crt = "/etc/ssl/certs/server.crt" |
| 2427 | + self.ssl_site = "/etc/apache2/sites-enabled/999-testlib" |
| 2428 | + self.ports_file = "/etc/apache2/ports.conf" |
| 2429 | + self.access_log = "/var/log/apache2/access.log" |
| 2430 | + self.error_log = "/var/log/apache2/error.log" |
| 2431 | + if not hasattr(self, 'initscript'): |
| 2432 | + self._set_initscript("apache2") |
| 2433 | + |
| 2434 | + # Dapper's apache2 is disabled by default |
| 2435 | + if self.lsb_release['Release'] == 6.06: |
| 2436 | + testlib.config_replace(self.apache2_default, "", append=True) |
| 2437 | + subprocess.call(['sed', '-i', 's/NO_START=1/NO_START=0/', self.apache2_default]) |
| 2438 | + |
| 2439 | + self._stop() |
| 2440 | + if clearlogs == True: |
| 2441 | + self._clearlogs() |
| 2442 | + self._start() |
| 2443 | + |
| 2444 | + def _set_initscript(self, initscript): |
| 2445 | + self.initscript = initscript |
| 2446 | + |
| 2447 | + def _tearDown(self): |
| 2448 | + '''Clean up after each test_* function''' |
| 2449 | + self._stop() |
| 2450 | + time.sleep(2) |
| 2451 | + if os.path.exists(self.html_page): |
| 2452 | + os.unlink(self.html_page) |
| 2453 | + if os.path.exists(self.php_page): |
| 2454 | + os.unlink(self.php_page) |
| 2455 | + if os.path.exists(self.cgi_page): |
| 2456 | + os.unlink(self.cgi_page) |
| 2457 | + if os.path.exists(self.ssl_key): |
| 2458 | + os.unlink(self.ssl_key) |
| 2459 | + if os.path.exists(self.ssl_crt): |
| 2460 | + os.unlink(self.ssl_crt) |
| 2461 | + if os.path.exists(self.ssl_site): |
| 2462 | + os.unlink(self.ssl_site) |
| 2463 | + self._disable_mod("ssl") |
| 2464 | + testlib.config_restore(self.ports_file) |
| 2465 | + testlib.config_restore(self.apache2_default) |
| 2466 | + |
| 2467 | + def _start(self): |
| 2468 | + '''Start process''' |
| 2469 | + rc, report = testlib.cmd(['service', self.initscript, 'start']) |
| 2470 | + expected = 0 |
| 2471 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2472 | + self.assertEquals(expected, rc, result + report) |
| 2473 | + time.sleep(2) |
| 2474 | + |
| 2475 | + def _stop(self): |
| 2476 | + '''Stop process''' |
| 2477 | + rc, report = testlib.cmd(['service', self.initscript, 'stop']) |
| 2478 | + expected = 0 |
| 2479 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2480 | + self.assertEquals(expected, rc, result + report) |
| 2481 | + |
| 2482 | + def _clearlogs(self): |
| 2483 | + '''Clear httpd logs''' |
| 2484 | + if os.path.exists(self.access_log): |
| 2485 | + os.unlink(self.access_log) |
| 2486 | + if os.path.exists(self.error_log): |
| 2487 | + os.unlink(self.error_log) |
| 2488 | + |
| 2489 | + def __disable_mod(self, mod): |
| 2490 | + if not os.path.exists(os.path.join("/etc/apache2/mods-available", mod + \ |
| 2491 | + ".load")): |
| 2492 | + return |
| 2493 | + if not os.path.exists("/usr/sbin/a2dismod"): |
| 2494 | + return |
| 2495 | + rc, report = testlib.cmd(['a2dismod', mod]) |
| 2496 | + expected = 0 |
| 2497 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2498 | + self.assertEquals(expected, rc, result + report) |
| 2499 | + |
| 2500 | + def _disable_mod(self, mod): |
| 2501 | + self.__disable_mod(mod) |
| 2502 | + self._restart() |
| 2503 | + time.sleep(2) |
| 2504 | + |
| 2505 | + def _disable_mods(self, mods): |
| 2506 | + '''take a list of modules to disable''' |
| 2507 | + for mod in mods: |
| 2508 | + self.__disable_mod(mod) |
| 2509 | + self._restart() |
| 2510 | + time.sleep(2) |
| 2511 | + |
| 2512 | + def __enable_mod(self, mod): |
| 2513 | + rc, report = testlib.cmd(['a2enmod', mod]) |
| 2514 | + expected = 0 |
| 2515 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2516 | + self.assertEquals(expected, rc, result + report) |
| 2517 | + |
| 2518 | + def _enable_mod(self, mod): |
| 2519 | + self.__enable_mod(mod) |
| 2520 | + # for some reason, force-reload doesn't work |
| 2521 | + # if self.lsb_release['Release'] >= 8.04: |
| 2522 | + # self._reload() |
| 2523 | + # else: |
| 2524 | + self._restart() |
| 2525 | + time.sleep(2) |
| 2526 | + |
| 2527 | + def _enable_mods(self, mods): |
| 2528 | + '''take a list of modules to enable''' |
| 2529 | + for mod in mods: |
| 2530 | + self.__enable_mod(mod) |
| 2531 | + # for some reason, force-reload doesn't work |
| 2532 | + # if self.lsb_release['Release'] >= 8.04: |
| 2533 | + # self._reload() |
| 2534 | + # else: |
| 2535 | + self._restart() |
| 2536 | + time.sleep(2) |
| 2537 | + |
| 2538 | + def _disable_site(self, sitename): |
| 2539 | + rc, report = testlib.cmd(['a2dissite', sitename]) |
| 2540 | + expected = 0 |
| 2541 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2542 | + self.assertEquals(expected, rc, result + report) |
| 2543 | + self._restart() |
| 2544 | + time.sleep(2) |
| 2545 | + |
| 2546 | + def _enable_site(self, sitename): |
| 2547 | + rc, report = testlib.cmd(['a2ensite', sitename]) |
| 2548 | + expected = 0 |
| 2549 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2550 | + self.assertEquals(expected, rc, result + report) |
| 2551 | + # for some reason, force-reload doesn't work |
| 2552 | + # if self.lsb_release['Release'] >= 8.04: |
| 2553 | + # self._reload() |
| 2554 | + #else: |
| 2555 | + self._restart() |
| 2556 | + time.sleep(2) |
| 2557 | + |
| 2558 | + def _reload(self): |
| 2559 | + '''Reload httpd''' |
| 2560 | + rc, report = testlib.cmd([self.initscript, 'force-reload']) |
| 2561 | + expected = 0 |
| 2562 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2563 | + self.assertEquals(expected, rc, result + report) |
| 2564 | + |
| 2565 | + def _restart(self): |
| 2566 | + '''Restart httpd''' |
| 2567 | + self._stop() |
| 2568 | + self._start() |
| 2569 | + |
| 2570 | + def _prepare_ssl(self, srvkey, srvcert): |
| 2571 | + '''Prepare Apache for ssl connections''' |
| 2572 | + self._enable_mod("ssl") |
| 2573 | + |
| 2574 | + # copy instead of rename so we don't get invalid cross-device link errors |
| 2575 | + shutil.copy(srvkey, self.ssl_key) |
| 2576 | + shutil.copy(srvcert, self.ssl_crt) |
| 2577 | + |
| 2578 | + if self.lsb_release['Release'] <= 7.04: |
| 2579 | + testlib.config_replace(self.ports_file, "Listen 443", True) |
| 2580 | + |
| 2581 | + # create the conffile entry |
| 2582 | + site_contents = ''' |
| 2583 | +NameVirtualHost *:443 |
| 2584 | +<VirtualHost *:443> |
| 2585 | + SSLEngine on |
| 2586 | + SSLOptions +StrictRequire |
| 2587 | + SSLCertificateFile /etc/ssl/certs/server.crt |
| 2588 | + SSLCertificateKeyFile /etc/ssl/private/server.key |
| 2589 | + |
| 2590 | + ServerAdmin webmaster@localhost |
| 2591 | + |
| 2592 | + DocumentRoot /var/www/ |
| 2593 | + ErrorLog /var/log/apache2/error.log |
| 2594 | + |
| 2595 | + # Possible values include: debug, info, notice, warn, error, crit, |
| 2596 | + # alert, emerg. |
| 2597 | + LogLevel warn |
| 2598 | + |
| 2599 | + CustomLog /var/log/apache2/access.log combined |
| 2600 | + ServerSignature On |
| 2601 | +</VirtualHost> |
| 2602 | +''' |
| 2603 | + testlib.create_fill(self.ssl_site, site_contents) |
| 2604 | + self._reload() |
| 2605 | + |
| 2606 | + def _test_url_proxy(self, url="http://localhost/", content="", proxy="localhost:3128"): |
| 2607 | + '''Test the given url''' |
| 2608 | + rc, report = testlib.cmd(['elinks', '-verbose', '2', '-no-home', '1', '-eval', 'set protocol.ftp.proxy.host = "%s"' %(proxy), '-eval', |
| 2609 | + 'set protocol.http.proxy.host = "%s"' %(proxy), '-eval', 'set protocol.https.proxy.host = "%s"' %(proxy), '-dump', url]) |
| 2610 | + expected = 0 |
| 2611 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2612 | + self.assertEquals(expected, rc, result + report) |
| 2613 | + |
| 2614 | + if content != "": |
| 2615 | + self._word_find(report, content) |
| 2616 | + |
| 2617 | + def _test_url(self, url="http://localhost/", content="", invert=False, source=False): |
| 2618 | + '''Test the given url''' |
| 2619 | + if source: |
| 2620 | + report = self._get_page_source(url) |
| 2621 | + else: |
| 2622 | + report = self._get_page(url) |
| 2623 | + |
| 2624 | + if content != "": |
| 2625 | + self._word_find(report, content, invert) |
| 2626 | + |
| 2627 | + def _get_page_source(self, url="http://localhost/", data='', headers=None): |
| 2628 | + '''Fetch html source''' |
| 2629 | + cookies = "/tmp/cookies.lwp" |
| 2630 | + testlib.create_fill(cookies, "#LWP-Cookies-2.0") |
| 2631 | + |
| 2632 | + if headers == None: |
| 2633 | + headers = {'User-agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'} |
| 2634 | + |
| 2635 | + clean_url = url |
| 2636 | + if re.search(r'http(|s)://.*:.*@[a-z].*', url): |
| 2637 | + tmp = re.sub(r'^http(|s)://', '', url) |
| 2638 | + username = tmp.split('@')[0].split(':')[0] |
| 2639 | + password = tmp.split('@')[0].split(':')[1] |
| 2640 | + base64_str = base64.encodestring('%s:%s' % (username, password))[:-1] |
| 2641 | + headers['Authorization'] = "Basic %s" % (base64_str) |
| 2642 | + # strip out the username and password from the url |
| 2643 | + clean_url = re.sub(r'%s:%s@' % (username, password), '', url) |
| 2644 | + |
| 2645 | + cj = cookielib.LWPCookieJar(filename=cookies) |
| 2646 | + cj.load() |
| 2647 | + |
| 2648 | + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) |
| 2649 | + urllib2.install_opener(opener) |
| 2650 | + |
| 2651 | + try: |
| 2652 | + if data != '': |
| 2653 | + req = urllib2.Request(clean_url, data, headers) |
| 2654 | + else: |
| 2655 | + req = urllib2.Request(clean_url, headers=headers) |
| 2656 | + except: |
| 2657 | + raise |
| 2658 | + |
| 2659 | + tries = 0 |
| 2660 | + failed = True |
| 2661 | + while tries < 3: |
| 2662 | + try: |
| 2663 | + handle = urllib2.urlopen(req) |
| 2664 | + failed = False |
| 2665 | + break |
| 2666 | + except urllib2.HTTPError, e: |
| 2667 | + raise |
| 2668 | + if e.code != 503: |
| 2669 | + # for debugging |
| 2670 | + #print >>sys.stderr, 'Error retrieving page "url=%s", "data=%s"' % (url, data) |
| 2671 | + raise |
| 2672 | + tries += 1 |
| 2673 | + time.sleep(2) |
| 2674 | + |
| 2675 | + self.assertFalse(failed, 'Could not retrieve page "url=%s", "data=%s"' % (url, data)) |
| 2676 | + html = handle.read() |
| 2677 | + cj.save() |
| 2678 | + |
| 2679 | + return html |
| 2680 | + |
| 2681 | + def _get_page(self, url="http://localhost/"): |
| 2682 | + '''Get contents of given url''' |
| 2683 | + rc, report = testlib.cmd(['elinks', '-verbose', '2', '-no-home', '1', '-dump', url]) |
| 2684 | + expected = 0 |
| 2685 | + |
| 2686 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 2687 | + self.assertEquals(expected, rc, result + report) |
| 2688 | + |
| 2689 | + return report |
| 2690 | + |
| 2691 | + def _test_raw(self, request="", content="", host="localhost", port=80, invert = False, limit=1024): |
| 2692 | + '''Test the given url with a raw socket to include headers''' |
| 2693 | + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 2694 | + s.connect((host, port)) |
| 2695 | + s.send(request) |
| 2696 | + data = s.recv(limit) |
| 2697 | + s.close() |
| 2698 | + |
| 2699 | + if content != "": |
| 2700 | + self._word_find(data, content, invert = invert) |
| 2701 | + |
| 2702 | +def create_php_page(page, php_content=None): |
| 2703 | + '''Create a basic php page''' |
| 2704 | + |
| 2705 | + # complexity here is due to maintaining interface compatability when |
| 2706 | + # php_content is not provided |
| 2707 | + if not php_content: |
| 2708 | + str = "php works" |
| 2709 | + php_content = "echo '" + str + "'; " |
| 2710 | + else: |
| 2711 | + str = php_content |
| 2712 | + script = '''<?php |
| 2713 | +%s |
| 2714 | +?>''' %(php_content) |
| 2715 | + testlib.create_fill(page, script) |
| 2716 | + return str |
| 2717 | + |
| 2718 | +def create_perl_script(page): |
| 2719 | + '''Create a basic perl script''' |
| 2720 | + str = "perl works" |
| 2721 | + script = '''#!/usr/bin/perl |
| 2722 | +print "Content-Type: text/plain\\n\\n"; |
| 2723 | +print "''' + str + '''\\n"; |
| 2724 | + |
| 2725 | +''' |
| 2726 | + testlib.create_fill(page, script, 0755) |
| 2727 | + |
| 2728 | + return str |
| 2729 | + |
| 2730 | +def create_html_page(page): |
| 2731 | + '''Create html page''' |
| 2732 | + str = "html works" |
| 2733 | + testlib.create_fill(page, "<html><body>" + str + "</body></html>") |
| 2734 | + return str |
| 2735 | diff --git a/debian/tests/upstream-test-suite b/debian/tests/upstream-test-suite |
| 2736 | index 4f6b332..ec3e370 100644 |
| 2737 | --- a/debian/tests/upstream-test-suite |
| 2738 | +++ b/debian/tests/upstream-test-suite |
| 2739 | @@ -2,7 +2,7 @@ |
| 2740 | set -e |
| 2741 | |
| 2742 | dpkg-source --before-build `pwd` |
| 2743 | -sed -i -e 's/\$(top_builddir)\/src\/squid/\/usr\/sbin\/squid/' test-suite/Makefile.am |
| 2744 | +sed -i -e 's/\$(top_builddir)\/src\/squid\ /\/usr\/sbin\/squid\ /' test-suite/Makefile.am |
| 2745 | dpkg-buildpackage -rfakeroot --target=pre-build |
| 2746 | dpkg-buildpackage -rfakeroot --target=common-configure-arch 2>/dev/null |
| 2747 | make -C src/base libbase.la |
| 2748 | diff --git a/debian/usr.sbin.squid b/debian/usr.sbin.squid |
| 2749 | new file mode 100644 |
| 2750 | index 0000000..2a400e9 |
| 2751 | --- /dev/null |
| 2752 | +++ b/debian/usr.sbin.squid |
| 2753 | @@ -0,0 +1,75 @@ |
| 2754 | +# Author: Simon Deziel |
| 2755 | +# Jamie Strandboge |
| 2756 | +# vim:syntax=apparmor |
| 2757 | +#include <tunables/global> |
| 2758 | + |
| 2759 | +/usr/sbin/squid { |
| 2760 | + #include <abstractions/base> |
| 2761 | + #include <abstractions/kerberosclient> |
| 2762 | + #include <abstractions/nameservice> |
| 2763 | + |
| 2764 | + capability net_raw, |
| 2765 | + capability setuid, |
| 2766 | + capability setgid, |
| 2767 | + capability sys_chroot, |
| 2768 | + |
| 2769 | + # allow child processes to run execvp(argv[0], [kidname, ...]) |
| 2770 | + /usr/sbin/squid ix, |
| 2771 | + |
| 2772 | + # pinger |
| 2773 | + network inet raw, |
| 2774 | + network inet6 raw, |
| 2775 | + |
| 2776 | + /etc/mtab r, |
| 2777 | + @{PROC}/[0-9]*/mounts r, |
| 2778 | + @{PROC}/mounts r, |
| 2779 | + |
| 2780 | + # squid3 configuration |
| 2781 | + /etc/squid/** r, |
| 2782 | + /{,var/}run/squid.pid rwk, |
| 2783 | + /var/spool/squid/ r, |
| 2784 | + /var/spool/squid/** rwk, |
| 2785 | + /usr/lib/squid{,3}/* rmix, |
| 2786 | + /usr/share/squid/** r, |
| 2787 | + /var/log/squid/* rw, |
| 2788 | + |
| 2789 | + # squid-langpack |
| 2790 | + /usr/share/squid-langpack/** r, |
| 2791 | + |
| 2792 | + # maas-proxy |
| 2793 | + /var/lib/maas/maas-proxy.conf r, |
| 2794 | + /var/log/maas/proxy/** rw, |
| 2795 | + /var/spool/maas-proxy/ r, |
| 2796 | + /var/spool/maas-proxy/** rwk, |
| 2797 | + |
| 2798 | + # squid-deb-proxy |
| 2799 | + /etc/squid-deb-proxy/** r, |
| 2800 | + /{,var/}run/squid-deb-proxy.pid rwk, |
| 2801 | + /var/cache/squid-deb-proxy/ r, |
| 2802 | + /var/cache/squid-deb-proxy/** rwk, |
| 2803 | + /var/log/squid-deb-proxy/* rw, |
| 2804 | + owner /dev/shm/** rmw, |
| 2805 | + |
| 2806 | + # squidguard |
| 2807 | + /usr/bin/squidGuard Cx -> squidguard, |
| 2808 | + profile squidguard { |
| 2809 | + #include <abstractions/base> |
| 2810 | + |
| 2811 | + /etc/squid/squidGuard.conf r, |
| 2812 | + /var/log/squid{,3}/squidGuard.log w, |
| 2813 | + /var/lib/squidguard/** rw, |
| 2814 | + |
| 2815 | + # squidguard by default uses /var/log/squid as its logdir, however, we |
| 2816 | + # don't want it to access squid's logs, only its own. Explicitly deny |
| 2817 | + # access to squid's files but allow all others since the user may specify |
| 2818 | + # anything for the squidGurad 'log' directive. |
| 2819 | + /var/log/squid{,3}/* rw, |
| 2820 | + audit deny /var/log/squid{,3}/{access,cache,store}.log* rw, |
| 2821 | + |
| 2822 | + # Site-specific additions and overrides. See local/README for details. |
| 2823 | + #include <local/usr.sbin.squid> |
| 2824 | + } |
| 2825 | + |
| 2826 | + # Site-specific additions and overrides. See local/README for details. |
| 2827 | + #include <local/usr.sbin.squid> |
| 2828 | +} |


Hi Robie, branches/ tags no build/test was part of it.
I reviewed your changes today - just review of commits/
First of all thanks for cleaning up so much old Delta!
Other than the few nit picks I'll mention below I already agree.
There are a few things which made me wonder, but turned out to be ok later on when going through the merge and changelogs - never the less listing them just in case my thought would make you reconsider anything:
OK - bbe7f75 "disabled by default AppArmor profile" "init-system- helpers (>> 1.22ubuntu5) to ensure" ... 8d83b6a9c00e782 f45aaabd26 which does that so you effectively did what I wanted to ask
- Only trusty would be below that - do we plan for backports here?
- Otherwise this might be simplified
OK -> I found 162c407859e9fc7
OK - did not find "5a9b76095e325b 5018fd865d3ad6a 1f5dfb20954" in the changelog
OK -> I found it dropped as "/var/spool/squid3 upgrade path handling"
3.5.12-1 to 3.5.23-1 checking Diff and impacts:
OK - nothing found we would have to adapt for to other than dropping delta
####
Now the remaining bits where I couldn't find the answer myself in changelog / commits:
Lines starting with an "?" should be clarified IMHO.
- There is a new ubuntu 9 with CVEs in Yakkety
ok - I checked, both patches are in the new upstream
ok - I wondered if we would need to "drop" that in the changelog, but found a generic "Drop security fixes: all included in 3.5.23 upstream."
? - But we might want/need the 3.5.12-1ubuntu9 in the merged version history right?
- Why are you "Robie BAsak @ horsea" in some commits (upper case A and @horsea)
? - Do you want/need to rewrite that?
- 5a9b760 "Include upgrade migration handling" does this no more change the cache format (dropped from news)
ok -> ok, dropped anyway so old text is valid now
ok -> well later comes "Note historical migration in d/NEWS.debian" 96d065d
? -> with that the text is in place again - I wonder if that is a mistake (to no more mention the format incompatibility)
? -> the changelog of this only says "Correct attribution in d/NEWS.debian." but you also change content, need to adapt?