Commit Graph

349 Commits

Author SHA1 Message Date
Zuul b6edfda344 Merge "Drop all remaining logics for certificate resources" 2024-03-08 16:18:59 +00:00
Zuul 33d188e0af Merge "Prohibit certificate order resource" 2024-03-08 16:18:58 +00:00
Takashi Kajinami 9833751613 Drop all remaining logics for certificate resources
Since we removed certificate order, we no longer have to maintain
these logics.

This also removes the release note for deprecation of symantec
certificate plugin, which was added during this cycle, because
the plugin is also being removed by this change.

Change-Id: I8e901024677e889d05ad8653389fb46487bc7745
2024-02-27 23:33:47 +09:00
Takashi Kajinami 901cf2cc39 Prohibit certificate order resource
It was announced that this resource will be removed in Pike release.
Multiple cycles have passed since then, so we may be really ready to
remove it.

Note that this is the first step and removes only API layer logic.
Further logic removal will be done in the subsequent change.

Change-Id: Ib0eb3b11815b40237d42735097076b7c89cf9516
2024-02-22 13:16:49 +09:00
Takashi Kajinami d9b1b5ad8e Bump hacking
hacking 3.0.x is too old.

Change-Id: I21778b05eea73ac3c6b5a83727e8636d0bf4752e
2024-01-27 22:30:46 +09:00
Zuul 8830b38b46 Merge "Vault: enable RSA from ordered container functional test" 2023-10-02 11:00:56 +00:00
Stephen Finucane f1e03aadae tests: Enable warnings
Add the warnings fixture so we can catch deprecation warnings earlier.

Change-Id: I37a349237470beb60240d0b6c208aa75f2a075ac
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 09:57:19 +01:00
Mark Goddard 1a6c038ddb Vault: enable RSA from ordered container functional test
This functional test was being skipped, but seems to pass. Others
currently being skipped still do not pass.

Change-Id: If20fc134ff55494915b58872122888823edf31b3
2023-03-01 12:56:02 +00:00
Zuul ca6c205e87 Merge "Remove six" 2022-11-29 12:49:48 +00:00
Takashi Kajinami 6d34865522 Remove six
Python 2 is no longer supported, thus usage of six can be removed.

Also, This removes B314 test from documentation because its actual
implementation was already removed[1].

[1] 9dbeefb55e

Change-Id: Ib01714e6462470dd5c3f6f06b52a3afeff573696
2022-10-28 14:02:00 +02:00
Hervé Beraud b73046ff74 Remove unnecessary unicode prefixes
Change-Id: I87ee686a86be738ee96edf647a33fc3ce0510853
2022-05-09 19:49:40 +00:00
Zuul ffea7f79c9 Merge "Allow secret delete by users with "creator" role" 2022-02-14 15:42:14 +00:00
Douglas Mendizábal 9601593328 Fix container consumers rbac policy
This patch modifies the Consumer controller to enable the use of
ownership information in policy checks. e.g. policies that use a target
container:

   project_id:%(target.container.project_id)

Story: 2009664
Task: 43872

Depends-On: I8698fc7a9ac849b8c24adfe824ca44dd3e42b999
Change-Id: I1724152839f0f5850f8d32d40b36d1670c0ad996
2022-02-07 16:21:38 -06:00
Douglas Mendizábal 2620d14c5f Allow secret delete by users with "creator" role
Users with the "creator" role on a project can now delete secrets owned
by the project even if the user is different than the user that
originally created the secret.  Previous to this fix a user with the
"creator" role was only allowed to delete a secret owned by the project
if they were also the same user that originally created, which was
inconsistent with the way that deletes are handled by other OpenStack
projects that integrate with Barbican.

This change does not affect the policy for delting private secrets
(i.e. secrets with the "project-access" flag set to "false").

Story: 2009791
Task: 44324
Change-Id: Ie3e3adc1ee02d770de050f5cfa8110774bb1f661
2022-01-31 14:21:58 -06:00
Douglas Mendizábal b9daa100d0 Fix Castellan Secret Store inconsistent encoding
This patch fixes the Castellan secret store use of SecretDTO objects,
which require that the "secret" member be base64 encoded. [1]

Prior to this fix all secrets that were generated were stored in
plaintext, but secrets coming in through the API were base64 encoded
before being stored in the backend.

On secret retreival the Castellan plugin wrongly assumed everything in
the backend was encoded, so attempts to retrieve generated keys failed.

This patch fixes this inconsistency by always storing data un-encoded in
the backend.

A helper method was added to sort out the inconsistent data stored prior
to this fix.

A "version" property was added to the Castellan plugin metadata that is
stored in barbican to help differentiate secrets stored prior to this
fix vs secrets stored after this fix.

Story: 2008335
Task: 41236

[1]
https://opendev.org/openstack/barbican/src/tag/12.0.0/barbican/plugin/interface/secret_store.py#L356

Change-Id: I46fe77a471bf7927a24ca4d64dfccb385cd6402e
2021-09-15 08:42:25 -05:00
Douglas Mendizábal c59f2a6bbb Raise maximum allowed secret size
The default maximum allowed size is too small for some certificates.
This patch doubles the allowed size from 10Kb to 20Kb, and raises the
maximum request size by the same amount.

Change-Id: I59d11c5c9c32128ab9d71eaecdf46dd2d789a8d1
2021-04-27 15:49:39 -05:00
Ade Lee 060ca2ee36 Implement secure RBAC for secretstore API
Add new system scope specific RBAC rules for the secretstore API.
    The new rules allow all roles to list and get secret stores.

Change-Id: Ibb19e9854e8bafd2a454c0792503c6f4360e7cf7
2021-03-11 11:30:28 -05:00
Andreas Jaeger 9dbeefb55e Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found by updated hacking version.

Update local hacking checks for new flake8, remove
test B314 since that tests difference between Python 2 and 3,
there's no need to advise using six anymore.
Use oslotest.base directly, this fixes the hacking tests.

Remove ddt usage in testsuite, it does not work with current hacking
version anymore.

Change-Id: Iee4584c6fde08728c017468d9de1db73f2c79d8d
2020-10-12 21:20:06 +02:00
Douglas Mendizábal b8266ef402 Use Zuulv3 devstack jobs
This patch updates the gate jobs to stop using legacy
jobs and use the new Zuul v3 jobs instead.

The tempest tests will be re-enabled in a future patch.

Depends-On: I5d2bda5e653ee5d7c17cb7697247802916bdc5f7
Change-Id: Id91f44e8053cf4f40224959021d43736d5525107
2020-04-27 16:41:20 -05:00
Moises Guimaraes de Medeiros 21ea22b7cb Add Secret Consumer Controllers and their tests
This patch is part of a series to implement the Secret Consumers spec:
https://specs.openstack.org/openstack/barbican-specs/specs/train/secret-consumers.html

Fix _do_extra_dict_fields() in models.Secret to returns consumers.

Change-Id: I3637cd174ee3d7b31b148c3b86f7c8e0ab4472c9
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2019-09-30 14:51:02 +02:00
pengyuesheng bf95c37b84 Fix the bug of pep8 and building api-guide
`sphinx-build` command is not found in test-env.

To fix pep8, also blacklist the new bandit warning B105, this will
be fixed in a followup.

Change-Id: Ic1b8c3a4bfd67fff082297b881df66ffb9ca2c50
2019-08-05 16:36:02 +02:00
zhulingjie 1984fb4136 Update json module to jsonutils
1. oslo project provide jsonutils, and barbican use it in many place[1],
this PS to update the remained json moudule to oslo jsonutils for
consistency.
2. update the primary jsonutils to use alias json

[1]: https://github.com/openstack/barbican/search?utf8=%E2%9C%93&q=jsonutils&type=

Change-Id: I958a711db17bb1aa86fc4cd23c00cec185b84ab2
2019-03-07 07:02:48 +00:00
Douglas Mendizábal f725e6d97b Fix multiple backend test
This patch fixes the secret tests for multiple backends.  The tests
were assuming that there would be at least two configured backends
when multiple backends is enabled.   All these test fail when
testing a deployment that has multiple backends = True but only
one configured backend.

Change-Id: I177096155592e14bfe617dd4b79b1e052de3e8c5
2019-02-01 09:26:31 -06:00
Douglas Mendizábal 8eeff8d03e Fix secret-stores functional tests
This patch fixes some broken tests that were incorrectly
looking for a "secret-stores" key in API responses.  The
correct key is "secret_stores".

Change-Id: Ia42d14a1163f53d220e243ae0ecd5138e278db14
2019-01-31 17:03:09 -06:00
Douglas Mendizábal 6dc5259012 Remove hardcoded 'localhost' references
This patch fixes two tests that fail if the barbican service
under test is not listening on localhost.

Change-Id: I541ee6a44bd86fbd963930dd2423fb9af833eec1
2019-01-31 16:41:35 -06:00
Tim Burke 5a294dd94a functionaltests: Add response headers to logging info
Notably, these should include X-Openstack-Request-Id which will help
correlate server logs with test failures.

Change-Id: I7471afb30afceb9e44b30e6749a022ef3d005a36
2019-01-15 06:17:41 +00:00
Tim Burke 5ca3ca0240 Workaround for failing gates
Work with 389-ds-base-1.4.0.20.  Following
https://pagure.io/389-ds-base/c/4fd73c5 `dscreate fromfile`
got renamed to `dscreate from-file`.

Save dogtag server files for future debug.

Removed pip install of dogtag-pki which installed old Dogtag client code.

Temporarily skipping paging tests and making grenade non-voting.

Change-Id: I4bbc3d39c8d4a3591374e5c4a733a987f001a896
2019-01-14 17:55:36 -06:00
Ade Lee df8c62aab3 Refactor PKCS#11 to allow configurable mechanisms
Allow for setting the PKCS#11 encryption and hmac algorithms
in the config file.

This patch also implements CKM_AES_CBC encryption and
decryption.

Change-Id: I847b4b17df51bc4846c37a1e19e6adec76f46b38
Co-Authored-By: Ade Lee <alee@redhat.com>
2018-08-10 22:24:34 -05:00
Lingxian Kong 809ae5c5d0 Skip some tests for vault plugin
Vault secretstore plugin doesn't support asymmetric key generation for
now, so disable the related functional tests.

With this patch, the following functional tests sould be skipped:

api.v1.functional.test_orders.OrdersTestCase.test_encryption_using_generated_key
api.v1.functional.test_rsa.RSATestCase.test_rsa_order_certificate_from_ordered_container
api.v1.functional.test_rsa.RSATestCase.test_rsa_order_certificate_from_ordered_container_with_pass
api.v1.functional.test_rsa.RSATestCase.test_rsa_order_container
api.v1.functional.test_rsa.RSATestCase.test_rsa_order_container_with_passphrase

Change-Id: If416f38cb87bdb279a05263b99b5f2af916c1229
2018-07-27 22:01:11 +12:00
Vu Cong Tuan 1f8a317ace Switch to stestr
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: Iee69eae0043a401eb355a1fcb957879904882e85
2018-07-17 09:48:31 +07:00
Ade Lee fda4948efb Fix broken gate due to breaking dependency changes
PyKMIP changes:

The CredentialType is no longer imported into the credentials
module.  Fixed the reference.  Skipping the accept header tests
till the webob fix is available.

WebOb 1.8.1 changes:

This patch updates the Accept header logic that was broken
by the update in the WebOb dependency.

In the interest of time I had to comment out four functional tests
that will require further work in the content negotiation logic so
we can get the gate working again.

Also shame on the WebOb folks for not bumping the major version
on this breaking change.

Change-Id: Ie4d0df0cca2c79686830931e96b11bbc97a41c5b
Story: 2002122
2018-06-01 17:33:51 -05:00
Nam Nguyen Hoai af4637bcf2 Updating time for functional tests
Currenlty, some gates is being failed with logs like this

"""
b'Response: {"description": "Provided object does not match schema
\'Secret\': \'expiration\' is before current time.
Invalid property: \'expiration\'", "title": "Bad Request", "code": 400}'
"""

So it is necessary to update the time to create secrets successfully.

Change-Id: I59707cdf21f6843dbd7db30978e21cff72756e67
2018-03-08 13:38:23 +07:00
Zuul 3d3ea33e8b Merge "Remove Certificate Orders and CAs from API" 2018-01-23 04:43:05 +00:00
Zuul a74f898752 Merge "Use assertRegex instead of assertRegexpMatches" 2017-12-15 22:06:54 +00:00
Fernando Diaz 8561bc339f Remove Certificate Orders and CAs from API
Removes Certificate Orders and CAs from the Barbican
API Controller. This patch also removes any tests associated
with those controllers.

Co-Authored-By: Nam Nguyen Hoai <namnh@vn.fujitsu.com>
Change-Id: Iead0336a19ce58b8b2bb1f9af5e6dd3688fe91fc
2017-12-13 10:40:28 +07:00
Ade Lee 0861657fc1 Fix Dogtag mode on key generation
Dogtag doesn't actually need the mode parameter to be
stored in metadata.  We remove it from the generation case
because passing back a None value for the metadata breaks
metadata validation.

Added a functional test for no value passed in for the mode
in the order request.

Change-Id: I216f887875b1306604dd370301ac463cccbb2fa9
2017-11-29 14:14:09 -05:00
Vu Cong Tuan 66ed951a77 Use assertRegex instead of assertRegexpMatches
In Python3, assertRegexpMatches & assertNotRegexpMatches
are deprecated in favor of assertRegex and assertNotRegex

Change-Id: I5966bf52b86e3b7ce7fb0f75c662af15a50c122e
2017-11-07 13:28:00 +07:00
Jenkins d2ab56c61c Merge "Revert "Revert "Use devstack functions for deploying barbican-svc""" 2017-10-07 19:10:33 +00:00
Jenkins 1d20294b99 Merge "Add extra time in functional test that fails intermittently" 2017-09-14 00:18:49 +00:00
Jenkins 6b78a702b6 Merge "Removed unnecessary setUp() calls in tests" 2017-09-13 02:56:35 +00:00
Jenkins 584caafadb Merge "Stop using deprecated 'message' attribute in Exception" 2017-09-12 20:41:57 +00:00
Dave McCowan 4211114c4b Add extra time in functional test that fails intermittently
The functional test that checks secret expiration fails
intermittently because sometimes, when the gate is slow,
the secret expires too quickly for the test.

This patch adds an extra 10 seconds so the test will pass
more consistently, while still maintaining the integrity
of the test.

Change-Id: I2f0df9b42dd2bf9dd600948164532fd31bb2a0d3
Closes-Bug: #1499673
2017-09-12 10:08:44 -06:00
lingyongxu bc9581caac Fix some reST field lists in docstrings
Probably the most common format for documenting arguments is reST field
lists [1]. This change updates some docstrings to comply with the field
lists syntax.

Change-Id: I7ab0f078796c2f0078d437e5b8c9450a30c16f62
2017-09-05 15:01:28 +08:00
Jeremy Liu bed85c63e1 Revert "Revert "Use devstack functions for deploying barbican-svc""
This reverts commit 3c6df48cbc.

Change-Id: If31494ccbce3aeddff0de6a28651a70a3e33dc65
Depends-On: Id7230198583355a83b1ee4acef3da7cde7118794
2017-09-04 08:42:19 +00:00
Kaitlin Farr 3c6df48cbc Revert "Use devstack functions for deploying barbican-svc"
Castellan unintentionally can't handle a barbican URL that has a path in
addition to the hostname, such as http://ip-address/key-manager, unless
it is followed by a forward slash (http://ip-address/key-manager/ ).  We
should either revert this change before rc1 or merge
https://review.openstack.org/#/c/491942/, make a new release of
Castellan, and beg for a change in upper-constraints for castellan to
handle the new release.

This reverts commit 508a34e23c.

Change-Id: Iceb3a5fa890d64468cd6e7f5dec297d11a274d20
2017-08-08 22:39:11 +00:00
Gábor Antal 657d47bfad Removed unnecessary setUp() calls in tests
TrivialFix

Change-Id: I16e440f7fe7cb57e0d05e30c8c75ead064b5b449
2017-08-02 11:25:52 +02:00
Matthew Treinish 508a34e23c Use devstack functions for deploying barbican-svc
This commit switches barbican to use the devstack common functions for
deploying a wsgi app under uwsgi and apache. This will make the barbican
deployment consistent with the other services.

Change-Id: I8429e9a8f0db98c5f5a345190be71cae862af845
2017-08-01 17:02:55 +00:00
Kiran_totad 854087dff2 Stop using deprecated 'message' attribute in Exception
The 'message' attribute has been deprecated and removed
from Python3.
For more details, please check:
https://www.python.org/dev/peps/pep-0352/

Change-Id: I84053cacdd5101a4293c3491ade5296cea51439a
2017-07-26 05:30:17 +00:00
Jenkins 75e865e956 Merge "Replaces uuid.uuid4 with uuidutils.generate_uuid()" 2017-07-14 19:23:36 +00:00
M V P Nitesh 3e2f35f88e Replaces uuid.uuid4 with uuidutils.generate_uuid()
Change-Id: I9a83e63622c352ea39bf43f7ae181cf8a696a999
Closes-Bug: #1082248
2017-06-19 18:01:52 +05:30