Commit Graph

19 Commits

Author SHA1 Message Date
Tim Burke cd693e519e encryption: Expose decrypted metadata via CORS
Normally, the proxy object controller would be adding these, but when
encrypted, there won't be any headers in the x-object-meta-* namespace.

Closes-Bug: #1868045
Change-Id: I8e708a60ee63f679056300fc9d68227e46d605e8
2023-02-24 21:24:16 +00:00
Tim Burke 52a4fe37aa Various doc formatting cleanups
* Get rid of a bunch of accidental blockquote formatting
* Always declare a lexer to use for ``.. code::`` blocks

Change-Id: I8940e75b094843e542e815dde6b6be4740751813
2022-08-02 14:28:36 -07:00
Clay Gerrard 996aa4547f Consolidate Container-Update-Override headers
Related-Change-Id: I179ea6180d31146bb947061c69b1807c59529ac8
Related-Change-Id: I056edc68aee8c0db2a2c4a5b9e3d242a895975b3

Change-Id: I84bd29ae48ff1b0826794a8fdf9aa87670ad4aa4
2019-08-09 10:35:26 -05:00
Tim Burke 5573354655 Move calls to self.app outside of error handling
On py3, if/when you hit an error, you can get very noisy tracebacks like

  <traceback coming out of split_path()>

  During handling of the above exception, another exception occurred:

  <meaningful traceback>

In general, I like this, but when we've used exception handling for
flow-control, it gets difficult to separate the wheat from the chaff.

Change-Id: I5f3bc6416207cab2c7e3a77ee6689360b55990e7
2019-06-17 13:43:48 -07:00
Tim Burke 582f0585e8 py3: encryption follow-up
Change-Id: Ic680a11fa3133b3d6f3fa6fa007ccfbeb540899a
2018-11-20 14:27:19 -08:00
Tim Burke 37b814657e py3: port encryption
This got away from me a bit with the functional tests masquerading as
unit tests.

Change-Id: I1237c02eff96e53fff8f9661a2d85c4695b73371
2018-11-20 01:30:04 -06:00
Tim Burke b39d2efdab Allow multiple keymasters
This allows the migration from one key provider to another.

Note that secret_id values must remain unique across all keymasters
in a given pipeline. If they are not unique, the right-most keymaster
will take precedence.

When looking for the active root secret, only the right-most keymaster
is used.

Change-Id: I6b5c812a54624f56c55164556385e3e475fb2470
2018-10-16 21:26:26 +00:00
Tim Burke 00f7732193 Simplify the decryption of container listings
Following https://github.com/openstack/swift/commit/4806434 there
is only one handler that might be used.

Following https://github.com/openstack/swift/commit/2722e49 all
EncryptionException errors should be caught and handled in
decrypt_obj_dict.

Change-Id: Ib4e9db400a58853daa903ae0a625dfde47747552
2018-10-16 20:11:10 +00:00
Tim Burke 0d774861cb Unify handle_get/handle_head in decrypter
Change-Id: I7058e3b5cd7a7fe7f2f0c3304e4e8b3d97dfec4a
2018-10-16 20:11:10 +00:00
Alistair Coles 2722e49a8c Add support for multiple root encryption secrets
For some use cases operators would like to periodically introduce a
new encryption root secret that would be used when new object data is
written. However, existing encrypted data does not need to be
re-encrypted with keys derived from the new root secret. Older root
secret(s) would still be used as necessary to decrypt older object
data.

This patch modifies the KeyMaster class to support multiple root
secrets indexed via unique secret_id's, and to store the id of the
root secret used for an encryption operation in the crypto meta. The
decrypter is modified to fetch appropriate keys based on the secret id
in retrieved crypto meta.

The changes are backwards compatible with previous crypto middleware
configurations and existing encrypted object data.

Change-Id: I40307acf39b6c1cc9921f711a8da55d03924d232
2018-08-17 17:54:30 +00:00
Robert Francis 99b89aea10 Symlink implementation.
Add a symbolic link ("symlink") object support to Swift. This
object will reference another object. GET and HEAD
requests for a symlink object will operate on the referenced object.
DELETE and PUT requests for a symlink object will operate on the
symlink object, not the referenced object, and will delete or
overwrite it, respectively.
POST requests are *not* forwarded to the referenced object and should
be sent directly. POST requests sent to a symlink object will
result in a 307 Error.

Historical information on symlink design can be found here:
https://github.com/openstack/swift-specs/blob/master/specs/in_progress/symlinks.rst.
https://etherpad.openstack.org/p/swift_symlinks

Co-Authored-By: Thiago da Silva <thiago@redhat.com>
Co-Authored-By: Janie Richling <jrichli@us.ibm.com>
Co-Authored-By: Kazuhiro MIYAHARA <miyahara.kazuhiro@lab.ntt.co.jp>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>

Change-Id: I838ed71bacb3e33916db8dd42c7880d5bb9f8e18
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2017-12-13 21:26:12 +00:00
Tim Burke 4806434cb0 Move listing formatting out to proxy middleware
Make some json -> (text, xml) stuff in a common module, reference that in
account/container servers so we don't break existing clients (including
out-of-date proxies), but have the proxy controllers always force a json
listing.

This simplifies operations on listings (such as the ones already happening in
decrypter, or the ones planned for symlink and sharding) by only needing to
consider a single response type.

There is a downside of larger backend requests for text/plain listings, but
it seems like a net win?

Change-Id: Id3ce37aa0402e2d8dd5784ce329d7cb4fbaf700d
2017-09-15 06:38:26 +00:00
Alistair Coles 88ca232e52 Trivial fix for decrypter docstrings
Fix wrong param descriptions in decrypter.py
Fix missing param in base.py

Change-Id: I07fdfe2e7193afa4ee6b88a10f4ba58495b509b3
2017-05-03 11:41:14 +01:00
Ngo Quoc Cuong 172c4de31d Trivial fix warnings in docstring
Single quoted docstring
Params and docstring are inconsistent

Change-Id: Ie41bd2960280491f0a5fbd55c6a1aabb328099b8
2017-05-03 18:30:14 +07:00
Thiago da Silva 4d3aa4ea78 refactor some common code from crypto
This patch moves some code from the crypto files
to a more common modules that will be used by symlinks

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>

Change-Id: I1758693c5dd428f9f2157966aac49d97c2c7ab12
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2017-03-09 11:12:29 -05:00
Jenkins 22184eb882 Merge "Fix encryption-delimiter interaction" 2016-08-10 04:04:00 +00:00
Tim Burke fb5fcb189e Fix encryption-delimiter interaction
Previously, if a container listing produced `subdir` elements
the decrypter would raise a KeyError.

Additionally, update the functests so this sort of thing would
have been caught at the gate.

Closes-Bug: 1609904
Change-Id: Idc1907d19f90af7a086f45f8faecee9fbc3c69c2
2016-08-04 17:55:26 +00:00
Tim Burke 3781843cb3 Fix gettext_ calls
Change-Id: I80e7d204f78620c6eaf63bfad18588c4096529b8
2016-07-05 17:39:40 -07:00
Janie Richling 96a0e07753 Enable object body and metadata encryption
Adds encryption middlewares.

All object servers and proxy servers should be upgraded before
introducing encryption middleware.

Encryption middleware should be first introduced with the
encryption middleware disable_encryption option set to True.
Once all proxies have encryption middleware installed this
option may be set to False (the default).

Increases constraints.py:MAX_HEADER_COUNT by 4 to allow for
headers generated by encryption-related middleware.

Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Christian Cachin <cca@zurich.ibm.com>
Co-Authored-By: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Co-Authored-By: Peter Chng <pchng@ca.ibm.com>
Co-Authored-By: Alistair Coles <alistair.coles@hpe.com>
Co-Authored-By: Jonathan Hinson <jlhinson@us.ibm.com>
Co-Authored-By: Hamdi Roumani <roumani@ca.ibm.com>

UpgradeImpact

Change-Id: Ie6db22697ceb1021baaa6bddcf8e41ae3acb5376
2016-06-30 23:31:15 -07:00