Commit Graph

20 Commits

Author SHA1 Message Date
Ondřej Nový 022f688a7c Retire swauth
Change-Id: Ib8e22a1e2e35d22a754943e34501305a0cfdd9b9
Depends-On: https://review.opendev.org/678368
See: http://lists.openstack.org/pipermail/openstack-discuss/2019-August/008416.html
2019-08-24 20:04:50 +02:00
Tim Burke 2a84fe7c69 Stop using client headers for cross-middleware communication
Previously, Swift3 used client-facing HTTP headers to pass the S3 access
key, signature, and normalized request through the WSGI pipeline.
However, swauth did not validate that Swift3 actually set the headers;
as a result, an attacker who has captured a single valid request through
the S3 API may impersonate the user that issued the request indefinitely
through the Swift API.

Now, the S3 authentication information will be taken from a separate,
client-inaccessible namespace in the WSGI environment as defined in the
related change.

UpgradeImpact

This addresses a breaking API change in Swift3. No currently deployed
version of Swift3 will work with this. When upgrading swauth, operators
will need to upgrade Swift3 as well.

Change-Id: Ie5481a316397f46734e9dd0e77a8a87197ceec16
Related-Change: Ia3fbb4938f0daa8845cba4137a01cc43bc1a713c
2017-12-09 15:54:01 +00:00
Pavel Kvasnicka 70af798626 Hash token before storing it in Swift
Swauth uses token value as object name. Object names are logged in proxy
and object servers. Anybody with access to proxy/object server logs can
see token values. Attacker can use this token to access user's data in
Swift store. Instead of token, hashed token (with HASH_PATH_PREFIX and
HASH_PATH_SUFFIX) is used as object name now.

WARNING: In deployments without memcached this patch logs out all users
because tokens became invalid.

CVE-2017-16613

SecurityImpact
Closes-Bug: #1655781
Change-Id: I0d01e8e95400c82ef25f98e2d269532e83233c2c
2017-11-21 12:01:22 +01:00
Prashanth Pai 26cf5aa107 s3: Make s3 support configurable
Amazon S3 compatibility:
Due to security concerns raised, this change makes S3 support tunable
using a config option and is turned off by default.

Change-Id: I077f78946983f5d6b3b725dd6aa3ed178dc5604e
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2016-07-28 23:07:35 +05:30
Prashanth Pai 5d15daaab6 Don't include salt in HMAC computation
Currently, the input to HMAC function is the entire stored credential
in the format '<salt>$<hash>` but it should rather be only the hashed
key/password.

With this change, validate_creds() method is invoked and only the hash
of the password is used in HMAC computation.

Change-Id: I1a9bbcac6f49c23f3256572f148e55249a59f7ed
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2016-06-07 15:12:27 +05:30
Ondřej Nový 5c76099efd More authtypes validation checks
Change-Id: I47e139dc100333e2befc362196ede1b238ee0588
2016-05-31 20:42:16 +02:00
Peter Lisák 07d1c0a3d0 creds validation function
Change-Id: Iae92c06b2f24a6ca80d98513cc54f3ca6910afa8
2016-05-31 17:00:48 +02:00
Ondřej Nový b548d3dcf7 Add support for setting already hashed password
You can use this for restoring dumped users list from swauth-list
command.
Change-Id: Ia77d7a0b91b2f79999286858e383477a80d7db15
2016-05-24 12:08:38 +02:00
Jenkins 19f9beeb9d Merge "Fix changing of auth_type in existing deployments" 2016-03-08 10:26:55 +00:00
Jenkins 64eab78a92 Merge "Allow configuring salt manually" 2016-03-08 09:27:13 +00:00
Prashanth Pai e0b0292a27 Allow configuring salt manually
Older versions of swauth supported manually setting up a salt string in
conf file. This change re-introduces it and makes it a tunable option.

The current behavior of randomly generating salt for every password is
NOT affected with this change.

Change-Id: Ifdf6f806b954e4d41c083eeffa981cd7d0dd50b9
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2016-02-29 11:49:11 +05:30
Prashanth Pai e40938cbb4 Fix changing of auth_type in existing deployments
Problem:
If an existing swauth deployment changes `auth_type` in conf file to a
different one (for example: sha1 to sha512), all attempts to authorize
existing/old users will fail because of change in encoder type.

Fix:
With this change, the credentials match is done using an encoder with
which the password was initially encoded. This allows swauth deployments
to change auth_type and old users will still be able to authorize.

Closes-Bug: 1516980
Change-Id: I8a5c397d0796062f4109c59b6dc61b14d4a97e4b
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2016-02-29 10:30:32 +05:30
Prashanth Pai 2e4c9f954a Don't pass unicode to hmac.new()
This issue can be hit when swift3 middleware is in the pipeline.

Change-Id: If87a6663efcf31febe4a207b3d7f331b5f79b834
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2016-02-26 12:58:20 +05:30
Ondřej Nový f195a5f6ec Fixed E127 and E131 hacking.
E127 continuation line over-indented for visual indent
E131 continuation line unaligned for hanging indent

Change-Id: I19ceb58d8545fb1b585e04b40418271f6ff56a5e
2016-02-14 14:27:33 +01:00
Brian Cline 556aa15697 Use correct content type on JSON responses
Currently, in cases where swauth returns a JSON document as its body,
it does not specify a content type, and swob defaults it to text/html.

This change uses a standard content type of 'application/json' in each
of these instances, and adjusts the tests accordingly.

Closes-Bug: #1545430
APIImpact

Change-Id: I96d343a87f462811bcefb7d402887f8a570fe6bd
2016-02-14 06:41:21 -06:00
zhangguoqing da906b14a3 Do not use __builtin__ in python3
__builtin__ does not exist in Python 3, use
six.moves.builtins instead.

Change-Id: I1256f7df641af1085daca1d1ad2c34cb44cda265
closes-bug: #1290234
2016-01-06 01:55:04 +00:00
Ondřej Nový b7255c2b63 Support for Swift older than Juno dropped
Change-Id: Ia6540884430eba17b62018ba73fbde541bb0566b
2015-12-13 20:59:10 +01:00
Ondřej Nový 9d96d14d83 Unit tests for swift_version
Return False if version can't be compared. It's safer.

Change-Id: I1af9f15712ae7c27979ab4a78f7dd8a6fc43057e
2015-12-13 18:10:17 +01:00
Peter Lisák f5f3d7e72b use standard library json instead of simplejson
Based on https://review.openstack.org/#/c/240596/

Change-Id: I7f5be799ea7dcb49b7d9df830f1f15ee9a02b3ca
2015-11-23 12:13:07 +01:00
Ondřej Nový 3e19273cc1 Change setup.py to OS one
Change-Id: Ia23c12de5f6448793aa3584e3041711d68b92953
2015-11-18 10:54:03 +01:00