Commit Graph

1790 Commits

Author SHA1 Message Date
Takashi Kajinami ca57ef5436 Use explicit default instead of implicit fallback
[p11_crypto_plugin] mkek_length has no default but the logic uses
implicit default value (32) internally.

Change-Id: I8743457aab9f0ce4982fcb9255dc86050b791308
2024-03-29 14:03:50 +00:00
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
Zuul 4c87c7caf5 Merge "Bump hacking" 2024-02-14 11:17:22 +00:00
Takashi Kajinami d9b1b5ad8e Bump hacking
hacking 3.0.x is too old.

Change-Id: I21778b05eea73ac3c6b5a83727e8636d0bf4752e
2024-01-27 22:30:46 +09:00
Takashi Kajinami 73de2e8c35 Get rid of unused periodic_task
Currently Barbican is not using the periodic_task framework implemented
in oslo_service but implements its own mechanism based on the lower-
level thread group.

Change-Id: Idc69d61e07826923f3227aad6249252c3f739362
2023-12-16 01:35:44 +09:00
Takashi Kajinami 6acb4f8d24 Remove unused wsgi/ssl options from oslo.service
Barbican does not provide wsgi server based on oslo.service library,
thus these options are not used.

Change-Id: I74c67b61796bcc7e5418144b10134e6171b1777f
2023-12-16 01:34:27 +09:00
Zuul 04f91f01d3 Merge "pkcs11: Remove deprecated token_label option" 2023-12-15 16:09:01 +00:00
Zuul 15bb4e180b Merge "Fix python shebang" 2023-12-15 16:08:59 +00:00
Zuul 7decf74ae5 Merge "Enable Secure RBAC by default" 2023-12-15 16:08:57 +00:00
Zuul a3c0df0435 Merge "Use consistent [database] options" 2023-12-15 16:03:09 +00:00
Takashi Kajinami 20b4b34299 pkcs11: Remove deprecated token_label option
It was deprecated in favor of the token_labels option some cycles
ago[1].

[1] 1ca03610d7

Change-Id: I20b15e23f06af8df86d888e86081058b8c96a77a
2023-12-15 16:54:45 +09:00
Stephen Finucane 4fb8df1e8e Replace deprecated pyOpenSSL API
This was removed [1] recently and is preventing us bumping the upper
constraint.

[1] 0035c11382

Change-Id: I77debbfa35a8eeeb30ce83a32954da21d9c9ba62
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-14 10:06:32 +00:00
Takashi Kajinami 12aa8a9339 Use consistent [database] options
Currently Barbican is not using oslo.db to set up database connection
but it's own implementation directly using sqlalchemy. Because of this
the database parameters were not updated and these are based on
the names in quite old oslo.db library.

This change updates the database options so that the name of these
parameters become consistent with oslo.db.

This would help us replace current own implementation by oslo.db in
the future.

Change-Id: I36926e62842780068f7e66564233c121c37565d0
2023-11-27 10:15:56 +09:00
Takashi Kajinami f1b68658d4 Deprecate Symantec certificate plugin
This plugin has never been updated for 7 years. This plugin requires
the symantecssl library but the library can't be found in the Internet
and is not generally available. We have never tested it in upstream
CI because of lack of that dependent library.

Change-Id: I26493c2b0130f3cb86d866bd08fa5bbacbcc4725
2023-11-11 08:10:09 +00:00
Takashi Kajinami 90437d9a6c Fix python shebang
The current shebang requires /usr/bin/python which is not available in
Ubuntu Jammy by default.

Change-Id: Id64d6bba35e3dcecac7772964b81aea51661b6cb
2023-10-17 16:04:36 +00:00
Zuul fa8e52ccb7 Merge "Update secret:delete policy to allow admin to delete secret" 2023-10-02 12:17:09 +00:00
Douglas Mendizábal 6dcb00f8b9 Enable Secure RBAC by default
This patch sets both `enforce_new_defaults` and `enforce_scope` to the
default value of `True` as the next step in the implementation of Secure
RBAC [1].

[1] https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html

Change-Id: I935cb34877c8edf62f33f1ba1fe31c942780b3a0
2023-08-31 13:52:27 -05:00
Zuul c8e3dc14e6 Merge "db: Replace use of backref" 2023-08-28 08:06:46 +00:00
Zuul 9f5b1e6bf6 Merge "db: Update 'select()' calls" 2023-08-25 21:05:28 +00:00
Zuul e8f9d4b5ff Merge "db: Replace use of reverse cascades" 2023-08-25 20:59:51 +00:00
Zuul c40cb35195 Merge "tests: Enable SQLAlchemy 2.0 deprecation warnings" 2023-08-25 20:59:49 +00:00
Zuul 962466f71c Merge "Resolve misc deprecation warnings" 2023-08-25 19:25:38 +00:00
Zuul a70fb634dc Merge "tests: Enable warnings" 2023-08-25 17:43:52 +00:00
Zuul 413a5d8aaf Merge "tests: Disable policy deprecation warnings" 2023-08-23 19:44:21 +00:00
OpenStack Proposal Bot fb9e98577f Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: Ibe0cfb66cc7199c9024abd780ae56282282a25a8
2023-07-22 03:20:11 +00:00
Stephen Finucane c2060d9fb5 db: Replace use of backref
Per the SQLAlchemy docs [1]:

  The relationship.backref keyword should be considered legacy, and use
  of relationship.back_populates with explicit relationship() constructs
  should be preferred.

A blog post is available to explain what's going on here [2] and might
be worth a read. The learnings from that blog post do have the benefit
of allowing us to simplify some existing relationships that had
unnecessary arguments defined.

[1] https://docs.sqlalchemy.org/en/14/orm/backref.html
[2] https://that.guru/blog/sqlalchemy-relationships-without-foreign-keys/

Change-Id: I882e9a918ab1a44b205fc86bbcbb6fef5209ab76
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 10:02:11 +01:00
Stephen Finucane 493b20e875 db: Update 'select()' calls
Resolve the following RemovedIn20Warning warning:

  The legacy calling style of select() is deprecated and will be removed
  in SQLAlchemy 2.0.  Please use the new calling style described at
  select().

For more information, refer to http://sqlalche.me/e/b8d9.

Change-Id: I59e694358dfb3e6e6d0412a5519a412404260937
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 10:00:33 +01:00
Stephen Finucane bb84f2b706 db: Replace use of reverse cascades
Resolve the following RemovedIn20Warning warning:

  "SecretStoreMetadatum" object is being merged into a Session along the
  backref cascade path for relationship "Secret.secret_store_metadata";
  in SQLAlchemy 2.0, this reverse cascade will not take place.  Set
  cascade_backrefs to False in either the relationship() or backref()
  function for the 2.0 behavior; or to set globally for the whole
  Session, set the future=True flag

In effect, this means if you have a model that refers to another model,
creating/saving the former will no longer create/save the latter. We
have only one instance of this error - the error message above - and in
our case we are explicitly saving the 'Secret' instance before saving
the 'SecretStoreMetadatum' instance. As such, we can opt-in to the 2.0
behavior with no further changes. We do this for all relationships to be
safe.

More information on this issue can be found at [1].

[1] https://groups.google.com/g/sqlalchemy/c/VoY-qEiJA3U?pli=1

Change-Id: I4b4fa4c224113863643e16153478183447796146
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 09:59:45 +01:00
Stephen Finucane 059eaaa7b3 tests: Enable SQLAlchemy 2.0 deprecation warnings
Well, sort of. We enable them but immediately filter out the ones we're
actually seeing, the rationale being that we can address these in a
piecemeal fashion without the risk of introducing new issues.

There's a bit more to be done here. However, the work done in oslo.db
and other projects [1] should provide a guide for how to resolve the
outstanding issues.

[1] https://review.opendev.org/q/topic:sqlalchemy-20

Change-Id: I36a79377016a6913f2c63cac4c820ad8342ffbf6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 09:58:57 +01:00
Stephen Finucane 61927304d4 Resolve misc deprecation warnings
These were highlighted by the new 'WarningsFixture'.

Change-Id: I07beae9c9e518eeaae66d8d6accfdd16753de152
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 09:58:09 +01: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
Stephen Finucane 92fb44ce72 tests: Disable policy deprecation warnings
Change-Id: I8d2710ac7275916bedf186131e5b0f88743c37c1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-13 09:56:31 +01:00
Zuul d929cd84e4 Merge "Add support for Vault Namespaces" 2023-07-04 12:44:09 +00:00
Andre Aranha 57d7ff378a Update secret:delete policy to allow admin to delete secret
Currently a secret can be orphan, if the project that owns it
is deleted by an user that doesn`t have permission on the
project.[1]
The orphan secret cannot be deleted because the current rule
enforces a scoped token on that project to delete it (that
doesn't exist anymore).
To solve this issue, it's necessary to override the secret:delete
policy rule to allow the cloud admin to delete it.
The secret:get policy rule also needed to be changed because the
Python Barbican client gets the secret to check if it has
consumers before actually deleting it. This patch is making these
updates by default

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1932705

Co-author: Mauricio Harley <mharley@redhat.com>
Change-Id: Id755a9efd896b900d31eca93c0136398ed1925b8
2023-06-07 13:21:15 +02:00
Douglas Mendizábal 116a9045eb Remove System scope from policy
As specified in Phase 1 of the Consistent and Secure Default RBAC
goal [1] policies have been updated to remove "system" scope and
only use "project" scope in all policies.

APIs with policies that previously required "system" scope have been
updated to accept "project" scoped tokens with the "admin" role instead.

[1] https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html#phase-1

Change-Id: I3b781112fc6ced7b73196f973cefd6a30ef99dd3
2023-06-05 15:03:06 -04:00
Zuul d86be5560d Merge "Mock logging during unit tests" 2023-03-14 07:09:28 +00:00
Tobias Urdin 115a8282f6 Use new get_rpc_client API from oslo.messaging
Use the new API that is consistent with
the existing API instead of instantiating the client
class directly.

This was introduced in release 14.1.0 here [1] and
added into oslo.messaging here [2]

[1] https://review.opendev.org/c/openstack/requirements/+/869340
[2] https://review.opendev.org/c/openstack/oslo.messaging/+/862419

Change-Id: I515004d742ebb85034468a2901a3a887cd2b0480
2023-01-19 20:39:02 +00:00
Grzegorz Grasza f848fa9b4a Add content_types to the response dict
This change adds content_types to the consumers responses
returning a secret.

Change-Id: I7d0cd4d00244a3dc791b35f112e3689c2b6dd790
2023-01-12 12:04:49 +01:00
Pavlo Shchelokovskyy 2a23260a34 Add support for Vault Namespaces
Change https://review.opendev.org/c/openstack/castellan/+/810124
added support for Vault namespaces to castellan.

In order to be able to use that functionality in Barbican, we need
to register and pass a corresponding config option in Barbican as well.

Change-Id: I4abb46dba51a00628c58eeb516074e1a149b8f35
2022-12-20 09:42:09 +00:00
Zuul aba0bd074e Merge "Microversions documentation" 2022-12-12 14:36:26 +00:00
Grzegorz Grasza 651c2a8f80 Microversions documentation
This adds contributor as well as user documentation, mostly based
on documentation from Nova.

Change-Id: Iead4f2971f0ef518f03b7cdfe8157fe9053e543a
2022-12-09 10:26:35 +01:00
Zuul ca6c205e87 Merge "Remove six" 2022-11-29 12:49:48 +00:00
melanie witt 455057c941 Fix typo in check_str for system_admin policy rule
Story: #2010435
Task: #46851
Depends-On: https://review.opendev.org/c/openstack/requirements/+/865276
Change-Id: I4896f1508e34785864c260e64484ae0138100ef4
2022-11-22 15:09:55 +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
Zuul 5aa1538586 Merge "Remove unnecessary unicode prefixes" 2022-10-28 11:07:19 +00:00
Grzegorz Grasza 564c1e50d3 Fix unit test error after cryptography update
After migrating from cryptography===36.0.2 to 38.0.2, the function
generating a not signed CSR fails during the serialization process.

This fix returns a pre-generated CSR from cryptography===36.0.2

Change-Id: Ib538184bf224fd76a892509752fdb2000c205f38
2022-10-17 11:32:53 +02:00
Douglas Mendizábal 6112c30237 Fix Story 2010258 (CVE-2022-3100)
This patch fixes a security vunlerability where the contents of a
request query string were mistakenly being used in the RBAC policy
engine.

Change-Id: I5797988e4c63c75fccf85277c52815d9bf684cff
2022-09-29 09:26:14 -04:00