Commit Graph

21 Commits

Author SHA1 Message Date
ricolin 5971243169 Support enables rbac policies new defaults
The Magnum service allow enables policies (RBAC) new defaults and scope by
default. The Default value of config options ``[oslo_policy] enforce_scope``
and ``[oslo_policy] oslo_policy.enforce_new_defaults`` are both to
``False``, but will change to ``True`` in following cycles.

To enable them then modify the below config options value in
``magnum.conf`` file::

  [oslo_policy]
  enforce_new_defaults=True
  enforce_scope=True

reference tc goal for more detail:
https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html

Related blueprint secure-rbac

Change-Id: I249942a355577c4f1ef51b3988f0cc4979959d0b
2023-08-30 00:35:24 +08:00
Erik Olof Gunnar Andersson f27bde7171 Add support for www_authenticate_uri in ContextHook
* Added support for www_authenticate_uri in ContextHook.
* Made code path consistent with keystone.py impl.

Story: 2004271
Task: 28073

Change-Id: I7e3f23964a55be3255e87a4c4af7bae0a1415676
2018-12-06 20:07:23 +00:00
gecong1973 42856b4d05 Fix a typo
TrivialFix

Change-Id: Ic4c244635055be2ef5371307d8cd2ea677e78855
2016-11-18 11:05:55 +08:00
Hieu LE 66430eaa98 Centralize config option: keystone_auth section
Centralize config option of keystone_auth section.
Replace oslo_conf cfg to magnum.conf.

Change-Id: I15eb976eb177b43a09743fcc116fdb05b985f69a
Implements: blueprint centralize-config-magnum
2016-09-22 05:57:53 +00:00
Hongbin Lu 317153a464 Revert "Fix socket descriptor leak"
Several commands take much longer to complete after that commit.
Therefore, we should revert that specific commit first, and
investigate root cause before merging it back.

This reverts commit 873214b6e2.

Closes-Bug: #1540646
Change-Id: I0eb12f76e93fb1675c78bf60367db534061aceb1
2016-02-01 17:10:58 -05:00
Surojit Pathak 873214b6e2 Fix socket descriptor leak
The connection to amqp was not getting cleaned up, even after the
communication to conductor across amqp was complete, for a given
request. Thus, sockets were leaking with each communication and finally
led to a hang situation, where no more fds were available.

Change-Id: I1deabdbce6ba448fe4c25d7694aabe5e5fec7b5a
Closes-Bug: #1510776
2016-01-06 19:48:17 +00:00
Hua Wang a01138ab91 Read auth_uri from config file and remove is_public_api
1.auth_url can not be obtained from request headers, it can only
be read from config file.
2.is_public_api is not used, so let's remove it from context.

Change-Id: Ie7207ef5311e3168b64c47aef4041ed2dd0e39c6
Partially-Implements: blueprint generate-keystone-trust
2015-10-13 21:20:26 +08:00
Jenkins 606a9b0830 Merge "Fix H405 and E131 ignored pep8 rules" 2015-09-24 18:28:56 +00:00
Jenkins 28bf9ef6c9 Merge "Remove coding:utf-8" 2015-09-23 16:26:55 +00:00
Tom Cammann bdf880d8fa Fix H405 and E131 ignored pep8 rules
Updated tox.ini and fixed rules.

Fix H405:
Multi line docstring summary not separated with an empty line
Fix E131:
Continuation line unaligned for hanging indent

Change-Id: I20cf75c75cffc434fbdcb05b8e04bffcd4059cd1
Closes-Bug: #1498870
2015-09-23 12:21:09 +01:00
Hua Wang 86ed292e52 Add roles to context
We use oslo.policy to check the policy. Oslo.policy needs
roles held for the given token scope [1]. So we should add roles
to context.

[1]http://docs.openstack.org/developer/oslo.policy/
   api/oslo_policy.html#generic-checks

Change-Id: I95afbf57f185ca1db9c68781c2fcd78cbafc1e17
Closes-Bug: #1489832
2015-08-24 23:55:20 +08:00
Hua Wang ac72522f45 X-User is deprecated and X-Storage-Token is useless
X-User is deprecated.
X-Storage-Token is supported for swift/cloud files and legacy
Rackspace use in [1], so it is not needed in magnum.

[1] http://docs.openstack.org/developer/keystonemiddleware/
middlewarearchitecture.html#exchanging-user-information

Change-Id: I48913c79b506210448ecd23769a98458f54adbe6
Closes-Bug: #1489801
2015-08-24 05:21:39 +08:00
Hua Wang 73de30eba2 Remove coding:utf-8
Change-Id: I57f1e5febf678297db492acccf34100276b89483
2015-08-03 23:28:22 +08:00
Dane LeBlanc 617b772e55 Modify magnum api context to use user_name and project_name
Problem description:
If DevStack is used to instantiate the magnum plugin, and the
devstack localrc/local.conf has the default values for:
   LOG_COLOR (default value = True)
   SYSLOG (default value = False)
then upon startup (i.e. running DevStack's stack.sh), the magnum devstack
lib calls the DevStack common setup_colorized_logging function, but
without passing the optional 'project_var' and 'user_var' arguments to
this function. As a result, the setup_colorized_logging
function uses its default values of "user_name" and "project_name"
when it defines the logging_context_format_string (which in turn gets
configured in /etc/magnum/magnum.conf). The problem is that "user_name"
and "project_name" are not defined in the API context used by Magnum,
so that whenever the magnum plugin does a logging call, a KeyError
exception for the non-existant key "user_name" is generated.

Fix description:
The fix is to modify the Magnum context to use "user_name" and
"project_name" attributes to be consistent with the default context
format string set up by DevStack.

Change-Id: Ia0c34899609735ff9d8b4597101e004e2684657e
Closes-Bug: #1464376
2015-06-15 18:27:15 -04:00
Davanum Srinivas 17c5711c55 Remove imports from oslo namespaces
Oslo team is recommending everyone to use the direct imports and
not use the Oslo namespaces. So switch all our code to use oslo_*
instead of "from oslo." or "import oslo" or "from oslo"

NOTE: some of the tests still have mocks referring to oslo.utils
@mock.patch('oslo.utils.timeutils.utcnow')
as the tests break otherwise. We should do this later.

Closes-bug: #1419385
Change-Id: I8e3fbeb833cddc3f55674a0e781ffe69d5033ad4
2015-02-08 02:59:30 +00:00
Davanum Srinivas d43259dbf2 Cleanup code and remove newly ignored hack rules
newer hacking has rules for the following:
  H105  Don't use author tags
  H238  old style class declaration, use new style (inherit from `object`)
  W292 no newline at end of file

So we need to clean them up and stop ignoring them

Change-Id: I12b995cf87d6bc0938298f397b41a4693627bb4b
2015-02-06 22:40:23 -05:00
OTSUKA, Yuanying 2306534079 Don't use deprecated auth header
"X-Tenant-Id" and "X-Tenant" auth header is deprecated in
keystonemiddleware [1]. So this remove these header and replace to
"X-Project-Id".
And this also flesh up around RequestContext.

[1]: https://github.com/openstack/keystonemiddleware/blob/master/keystonemiddleware/auth_token.py#L371

Change-Id: I5f3adcb6eaed4fe75da6ec77c367a2b6c785ae5d
2015-01-30 12:08:50 +09:00
Andrew Melton 5999adfa0d Pull RequestContext Patching Into Test Base
The new patching only ensures that auth_token_info is properly
set up by default. A real RequestContext is returned, and it is
passed through to_dict and from_dict to ensure there are no
assumptions made that will not work through RPC.

If necessary, tests can still return a mock context by setting
a return_value or side_effect on self.mock_make_ctxt.

Change-Id: I6369e0bd89d83a5ea3ddde2b35423233fee18327
2015-01-28 10:37:50 -08:00
Hongbin Lu a162727cc0 Port NoExceptionTracebackHook from Ironic
Change-Id: I160d602bb39a82c2ffb41d18389f793ae9269f87
Partial-Bug: 1411871
2015-01-17 19:58:19 +00:00
OTSUKA, Yuanying a7a4544033 Add hooks to obtain conductor api
To obtain conductor api instance easily, this add rpcapi attribute to
pecan.request.
So now, we can access to conductor api from "pecan.request.rpcapi".

Related-Bug: #1406539
Change-Id: I6edbf031d91e65d70637629c3b57d45322eee9fd
2014-12-30 23:07:05 +09:00
OTSUKA, Yuanying c6c606b277 Split up extracting auth.py file
The auth.py file does a couple of things, It contains keystone authentication
and to set request context. So this split up to two files.
After this commit, request hook should be included in hooks.py.

Related-Bug: #1406539
Change-Id: I1754da40383976e48f6fd4ca23911717f918f9bb
2014-12-30 23:02:29 +09:00