59 Commits

Author SHA1 Message Date
Iryoung Jeong
de4d23c2a5 Adapt Swift for WebOb 1.2
Based on PatchSet 3 of https://review.openstack.org/#/c/7569/ , make them to pass all funcional tests with both webob 1.x and 1.2.

The additional following compatibility issues were addressed:
 - Until patch for range header issue is merged into official webob release, testRangedGetsWithLWSinHeader() should skip test against webob 1.2
(49c175aec2)

 - common.constraints.check_utf8() can accept both utf8 str and unicode.

 - To convert unicode to utf-8 str if necessary.

 - Making proxy_logging can handle invalid utf-8 str

bug 888371
bug 959881

blueprint webob-support

Change-Id: I00e5fd04cd1653259606a4ffdd4926db3c84c496
2012-07-15 00:03:01 +09:00
Vincent Untz
cc1907eef5 Validate devices and partitions to avoid directory traversals
swift.common.utils.validate_device_partition is a new function to check
that a device and a partition are valid. This means that they don't
contain '/' and are not '.' or '..'.

We use this new function every time we get devices and partitions from a
request.

Fix bug 1005908

Change-Id: Ia545ba8f877e85b4b576d6d7d09d890877ea6d34
2012-07-05 13:35:30 +02:00
Ionuț Arțăriși
9af3df9ee8 fix object replication on older rsync versions when using ipv4
Fixes bug 987388

Change-Id: I6eb5c45fe1f5844ad853a4ff9bc8fd23cc9abd5d
2012-06-06 10:07:56 +02:00
Darrell Bishop
3d3ed34f44 Adding StatsD logging to Swift.
Documentation, including a list of metrics reported and their semantics,
is in the Admin Guide in a new section, "Reporting Metrics to StatsD".
An optional "metric prefix" may be configured which will be prepended to
every metric name sent to StatsD.

Here is the rationale for doing a deep integration like this versus only
sending metrics to StatsD in middleware.  It's the only way to report
some internal activities of Swift in a real-time manner. So to have one
way of reporting to StatsD and one place/style of configuration, even
some things (like, say, timing of PUT requests into the proxy-server)
which could be logged via middleware are consistently logged the same
way (deep integration via the logger delegate methods).

When log_statsd_host is configured, get_logger() injects a
swift.common.utils.StatsdClient object into the logger as
logger.statsd_client.  Then a set of delegate methods on LogAdapter
either pass through to the StatsdClient object or become no-ops. This
allows StatsD logging to look like:
    self.logger.increment('some.metric.here')
and do the right thing in all cases and with no messy conditional logic.

I wanted to use the pystatsd module for the StatsD client, but the
version on PyPi is lagging the git repo (and is missing both the prefix
functionality and timing_since() method).  So I wrote my
swift.common.utils.StatsdClient.  The interface is the same as
pystatsd.Client, but the code was written from scratch.  It's pretty
simple, and the tests I added cover it.  This also frees Swift from an
optional dependency on the pystatsd module, making this feature easier
to enable.

There's test coverage for the new code and all existing tests continue
to pass.

Refactored out _one_audit_pass() method in swift/account/auditor.py and
swift/container/auditor.py.

Fixed some misc. PEP8 violations.

Misc test cleanups and refactorings (particularly the way "fake logging"
is handled).

Change-Id: Ie968a9ae8771f59ee7591e2ae11999c44bfe33b2
2012-05-11 15:25:38 -07:00
Paul McMillan
92fbf44d10 Fixed grammar and improve docs.
Corrected its/it's mistakes, harmonized line wrapping within some docs
and clarified doc wording in several places.

Change-Id: Ib9ac6d5e859f770a702e1fad6de8d4abe0390b47
2012-04-10 12:27:14 -07:00
John Dickinson
1ecf5ebba1 updated copyright date for all files
Change-Id: Ifd909d3561c2647770a7e0caa3cd91acd1b4f298
2012-03-19 13:45:34 -05:00
John Dickinson
e75bb9045b fixed pep8 issue and renamed strcmp_const_time to streq_const_time
Change-Id: Ifc21f0ec08ac2ba120a67795e82082b18e08584e
2012-02-28 21:38:30 -06:00
Russell Bryant
1f0798f4fb Use constant time string comparisons for auth.
Fix bug 942644.

Use constant time string comparisons when doing authentication to help
guard against timing attacks.

Change-Id: I88c4c5cd9edd9e5d60db07b6ae2638b74a2a2e17
2012-02-28 14:57:12 -05:00
Russell Bryant
e90424e88b Call setgroups() before setuid() and setgid().
Fixes bug 989569.

This patch ensures that the list of groups is completely reset when dropping
privileges.

Change-Id: I049f75e66e08a4a6361504b013bc68c4c38ef093
2012-02-07 14:20:42 -05:00
gholt
dd839048f1 Updated TimeoutError and except Exception refs...
Updated eventlet.TimeoutError (deprecated) references to
Timeout and, more importantly, updated many except Exception
clauses to except (Exception, Timeout).

Change-Id: Ib089265551bd20b94c00ea84f11140ccd795d301
2011-11-07 16:26:03 +00:00
gholt
872420efdb Expiring Objects Support
Please see the doc/source/overview_expiring_objects.rst for
more detail.

Change-Id: I4ab49e731248cf62ce10001016e0c819cc531738
2011-11-01 15:49:00 +00:00
David Goetz
bed607b07a adding unit tests 2011-08-30 12:07:32 -07:00
John Dickinson
0504fffb05 added client_ip to all proxy log lines not otherwise containing it 2011-08-11 14:36:02 -05:00
gholt
024df7c0f2 Merged from trunk 2011-06-13 20:51:06 +00:00
gholt
bb48838404 Adding some tests 2011-06-10 15:55:25 +00:00
gholt
81c6ca0b2c Merged from trunk 2011-05-11 02:51:31 +00:00
Clay Gerrard
7c2bf134b1 fixed lockups and lost messages in swift-init and capture_stdio 2011-03-30 15:04:15 -05:00
gholt
b09b5e64e1 Tests; bug fixes 2011-03-24 07:46:02 +00:00
Clay Gerrard
27c559c89a update functional tests configuration 2011-03-03 22:27:16 +00:00
David Goetz
2886655717 peer review edits 2011-02-25 09:09:02 -08:00
Clay Gerrard
bdba519e02 PEP8 2011-02-24 16:21:14 -06:00
Clay Gerrard
92a5414f25 went ahead and spoofed a [func_test] section 2011-02-24 12:28:17 -06:00
David Goetz
7144693bf5 merge to trunk 2011-02-21 10:50:56 -08:00
David Goetz
7728904dda audit zero byte files quickly without true value 2011-02-14 20:25:40 +00:00
Clay Gerrard
6554c16e0a merged trunk 2011-02-12 01:55:57 -06:00
Clay Gerrard
1095f27590 Prepare for trunk merge.
Refactored some of the swift_init classes into a new module in
swift.common, changed some names.  Removed the bin test stuff.  Fixed
some bugs, added some features.
2011-02-11 13:18:19 -06:00
Michael Barton
b2e0b926a4 Changes to support deployment on IPv6 2011-02-11 17:27:05 +00:00
gholt
88ae726f9b Merge from trunk 2011-02-10 14:29:08 -08:00
Clay Gerrard
5d0bc6b9c7 logging refactor to support proxy access logs
New log level "notice" set to python log level 25 maps to syslog priority
LOG_NOTICE.  Used for some messages in the proxy server, but will be available
to all apps using the LogAdapter returned from get_logger.  Cleaned up some
code in get_logger so that console logging works with log_routes and removed
some unneeded bits.  NamedFormatter functionality was split between LogAdapter
(which now inherits from logging.LoggerAdapter) and TxnFormatter (which now is
only responsible for adding the log records txn_id).

The proxy server app now configures a separate logger for access line logging.
By default it will use the same settings as the regular proxy logger.
2011-02-10 14:59:52 -06:00
Clay Gerrard
461bf8df71 added new proxy-server configuration options for access_log_facility and
access_log_name
2011-02-05 15:38:49 -06:00
Clay Gerrard
f9fa63686c Moved proxy server access log messages into their own log level
Added new "access" log level available on swift loggers that will be routed to
the LOG_NOTICE priority in syslog for easy redirection of access log messages
via rsyslog and syslog-ng.
2011-02-03 15:23:07 -06:00
Michael Barton
c2931e157c random newline 2011-02-03 19:53:47 +00:00
Michael Barton
70903a98bb merge trunk 2011-02-03 19:08:59 +00:00
gholt
cb58430321 logging: use routes to separate logging configurations 2011-02-02 13:39:08 -08:00
gholt
fdf20184e4 Fix duplicate logging 2011-02-02 09:38:17 -08:00
Michael Barton
a4b6ae6e57 merge trunk 2011-01-29 03:00:01 +00:00
David Goetz
3ea09dd0e6 merge to trunk 2011-01-26 14:38:13 -08:00
David Goetz
86cb12036b removing blank excepts 2011-01-26 14:31:33 -08:00
David Goetz
189a3584f0 pep8 2011-01-20 17:07:01 -08:00
David Goetz
59f996b552 fixing rate limiting to allow for catch up 2011-01-20 17:05:44 -08:00
Michael Barton
67de0c88f4 ipv6 support 2011-01-16 09:52:08 +00:00
David Goetz
9c0b1c95b1 merging to trunk 2011-01-10 17:11:06 -08:00
Anne Gentle
8823427161 Changed copyright notices on py files and the single rst file with a copyright notice 2011-01-04 17:34:43 -06:00
David Goetz
f811be80ff changes after peer review, pep8 and eventlet.sleep 2010-12-30 12:30:04 -08:00
David Goetz
6c86920ccd merging to trunk 2010-12-28 15:26:42 -08:00
David Goetz
8dee94fd7c adding defaults, docs, and unit tests 2010-12-28 14:54:00 -08:00
Michael Barton
ef4e23ee43 tests fixed 2010-12-20 21:57:19 +00:00
Michael Barton
d7dd3ec065 gettext updates 2010-12-20 21:47:50 +00:00
David Goetz
893fdd0907 adding in rate limiting and unit tests 2010-12-16 16:20:57 -08:00
Clay Gerrard
ab53587796 fixed some calls to get_logger that didn't clean up after themselves 2010-11-19 16:20:17 -06:00