Commit Graph

954 Commits

Author SHA1 Message Date
Rodrigo Barbieri 0967f6ec4e Add cache_time for identity
This patch adds a config option to allow
configuring the cache_time for identity elements.

It is also including a complementary fix for
change I49e46e010c543f831959581b2122f59068f2c07b
that missed adjusting the correct template, and
used the wrong comparison "is not None".

Closes-bug: #2054418
Related-bug: #1771114
Change-Id: I57d376eb6c1f0f38cdd028aacf397aaf7f3a1cda
2024-03-19 16:40:19 -03:00
Erlon R. Cruz 86a323abfe Adds service_user_id into relation data
This is necessary to avoid collisions between
same usernames used service users.

Depends-on: I4fbfa8fba84b11c4e30e4db9a0c358db1e8c94f1
Closes-Bug: #2030755
Change-Id: I500fd131cbd6cd5c2b38fdbe81b8b48e50a3e3f7
2023-10-24 16:11:37 -03:00
Edward Hope-Morley 0cb787bb9d Make role-cache-expiration configurable
We use a default expiration_time (dogpile-expiration-time)
of 600s which means that role assignments will take up to
this amount of time before all caches are updated to
reflect changes. This may not be suitable for some clouds
that make frequent changes to role assignments and lowering
the global value is not recommended so this overrides the
[role] cache_time to a more appropriate value and also
makes it configurable. We leave default value as None so
that the global value is still inherited but this at least
allows it to be customised.

Change-Id: I49e46e010c543f831959581b2122f59068f2c07b
Closes-Bug: #1771114
2023-06-09 16:29:59 +01:00
Alex Kavanagh 3ea0c428a2 Restart keystone's apache2 if mysql passwd rotated
When the mysql password is changed via the shared-db relation, the
shared-db hook handler needs to restart keystone's apache2 so that the
password is picked up and used by keystone during the rest of the hook.

Change-Id: I37ed94d5937a9abf46fd12cd6f230ddb5a298b0e
2023-03-27 11:46:52 +01:00
Zuul 0f974bb539 Merge "Add service user password rotation actions" 2023-02-28 18:40:15 +00:00
Alex Kavanagh 2271a961b7 Add service user password rotation actions
This patch adds two actions:

 1. An action to list the service usernames that can be rotated.
 2. An action to rotate a service username that is on the list of
    usernames that can be rotated.

Change-Id: I3a8a6af7ec8b0ea32da04eff34fafd32f43cee0e
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1005
2023-02-24 18:57:02 +00:00
Gabriel Cocenza 04480c4ff4 Add support for HAProxy L7 checks
This change add several configuration options to enable HTTP checks
to the HAProxy configuration, instead of the default TCP connection
checks (which continue to be the default)

Closes-Bug: #1880610
Change-Id: I50a9442ae66da71793a5e9904d23c26d1fbbdf42
2023-02-17 20:45:04 +00:00
Arif Ali b5c4eb2eae
Add auth_ttl into keystone.conf
There is a requirement for some end users where we need to specify
auth_ttl to a higher level. This should help with these users

Change-Id: Ifd515d7c103a6b24c4f5da500442406f04fb372f
2023-01-19 08:09:53 +00:00
Jorge Merlino 55bd702224 Add admin-role parameter value to identity relation
This parameter is added to the relation in order to configure service
tokens on related services. The role of the service user is required for
service token validation.

Closes-Bug: #1992840
Change-Id: Id7e84d38a9f774179808137548307c9174a87f87
2022-10-13 16:26:08 -03:00
Alex Kavanagh 2c33c74c8f Ensure openstack-release package is correct after install hook
The linked bug shows the install of the charm with openstack-origin set
to zed.  This happens because configure_installation_source() causes the
openstack-release package to be installed *before* the zed cloud archive
sources are configured into /etc/apt and an apt update done. This means
that the openstack-release package says "yoga" despite the zed packages
actually being installed.

Then, on the config-changed hook, it sees that the installed version is
showing as yoga and tries to do an upgrade.  This fails, as the charm
hasn't yet bootstrapped, and the charm tries to bootstrap after
upgrading the packages.

There's a few bugs here which are exposed, but the tactical fix is to
force the openstack-release to match the installed packages.

Change-Id: I3f47daf6bda6b62ffe4152ede2709f802f0ab606
Closes-Bug: #1989538
2022-09-14 16:27:57 +01:00
sudeephb 965d292bd4 Validate vip address
Validates if the provided vip address(es) are in the subnet that the unit is in. If not, shows the message with invalid vips along with 'blocked' status.

Closes-Bug: #1958178
Change-Id: I6bb3e21f3934d6d2483564fba9216504a62d15dc
2022-07-13 21:27:03 +05:45
Hemanth Nakkina f5d9b9ed40 New option default_authorization_ttl
Add new option default_authorization_ttl used for
federation to set validity of group memberships
coming from a mapping.

Closes-Bug: #1970388
Change-Id: I4a8dbc501e14d1201ceed27077554924c56e3abd
2022-05-16 12:05:15 +05:30
Edward Hope-Morley 9e8c0c9928 Ensure service name is not None before lookup
We need to ensure value for 'service' provided on
identity relation before doing valid_services lookup.

Change-Id: I42fb9dbb48b3bcf8fd40700db84ec8210b8433a4
Related-Bug: #1965967
2022-04-04 14:39:26 +01:00
Edward Hope-Morley 08960ba9b7 Set service_type on identity relation
Also applies osci.yaml fix for Jammy.

Change-Id: I4cf5d8c0855bb9a3cd6068335fe8100366c0a66d
Related-Bug: #1965967
2022-03-29 14:21:51 +01:00
Pedro Castillo ae178d7471 Add rotate-admin-password action
This action allows the user to easily rotate the admin user's
password by replacing it with a randomly generated one.

Change-Id: I6ce69be15b11b00f804d3143d835ec3ce6515865
Related-Bug: #1927280
Func-Test-PR: https://github.com/openstack-charmers/zaza-openstack-tests/pull/720
2022-03-21 19:55:34 +00:00
Liam Young 6f4894ea13 Related charm specify roles to be granted to admin
A charm joined to keystone via the identity-service relation can
now specify additional roles that can be granted to admin. This
is done by setting the relation data key `add_role_to_admin` the
value is a comma seperated list of roles that should be granted
to admin.

Change-Id: I7ecac3d64eece1845dc963886e09cc2be149ae03
2022-02-25 13:19:40 +00:00
Zuul 4df4ed6da4 Merge "Ensure /etc/keystone/fernet-keys/ before bootstrap" 2021-12-06 22:30:50 +00:00
Zuul 1a3523c7d8 Merge "Spelling fixes found (mostly) by Codespell." 2021-11-24 11:41:42 +00:00
James Troup 817b97871e Spelling fixes found (mostly) by Codespell.
Change-Id: I2803dc7efc8c357ca48a5284a3c95793363e0263
2021-11-23 19:33:04 +00:00
Corey Bryant 1bc4b739db Ensure /etc/keystone/fernet-keys/ before bootstrap
The /etc/keystone/fernet-keys/ directory must exist prior to
keystone-manage bootstrap being called.

Closes-Bug: #1951076
Change-Id: Ifa1ca433a658011365376a38e20b2901202bca21
2021-11-22 15:25:22 +00:00
Chris MacNaughton 9b8b81a0bc Use the application data bag to set id and id_service notifications
When purely using relation-set from a leader, updates after
the leader has changed can lead to old data being persisted
on a relation in addition to newer data being set by the new
leader. When this happens, there can be issues with services
using old data to talk to other related services.

This change introduces the use of the application data bag
to ensure that all units related to keystone get the same
data from the leader, regardless of leadership changes.
While this change enables the application data bag for these
relations, it still sends the per-unit relation data as well
to maintain backwards compatibility. Charms that consume the
identity-service and identity-notification relations will
need an update to use the application data bag to complete
this change.

Partial-Bug: #1902264
Change-Id: Iadd795fec605e7704e5a6673906452279bbecb34
2021-09-01 11:47:47 +00:00
Frode Nordahl 3143cb6638 Revert "Enable health check httpchk options in haproxy."
This reverts commit 579daa6820.

Reason for revert: This change breaks Keystone with TLS enabled

Change-Id: I20d3a476ef6f9ae1ae0bd4a5254e57f27a4d5917
2021-08-16 07:19:31 +00:00
John P Lettman 579daa6820 Enable health check httpchk options in haproxy.
Adds backend options for 'admin-port' and 'public-port' in
HAProxyContext. HAProxy will now expect 200-300 statuses and the string
"stable".

test_haproxy_context_service_enabled updated to reflect expected ctxt.

Closes-Bug: #1933233
Change-Id: I88cef4539f5d7dc70f6fbaacfb2ff768e958d346
2021-08-04 13:46:11 -04:00
Zuul 45c1d2034f Merge "Strip whitespace from admin passwords" 2021-05-20 11:52:43 +00:00
Corey Bryant 152e5b6cfe Support configurable dogpile cache expiration
The [cache]/expiration_time currently caches items for the default
of 600s and is not configurable via the charm. This change adds a
dogpile-cache-expiration config option that will default to 600s
so as not to cause any behavior changes by default.

Closes-Bug: #1899117
Change-Id: I639b2b77d5db69744897b6798613a797d05fe23b
Co-authored-by: Chris MacNaughton <chris.macnaughton@canonical.com>
2021-04-07 09:05:09 +02:00
Billy Olsen 7f0317313f Strip whitespace from admin passwords
While admin passwords are discouraged, they are used by some users
and using a file to import into the config option may include new
line characters. Strip the white space from the admin password to
prevent confusion for users.

Change-Id: I986b10e960153daed9d0d0cbf81d9c9e918a2150
Closes-Bug: #1895004
2021-04-03 09:54:06 -07:00
Frode Nordahl e9fc1de43b
Process subordinate releases packages map
For principal - subordinate plugin type relations where the
principal Python payload imports code from packages managed by a
subordinate, upgrades can be problematic.

This change will allow a subordinate charm that have opted into the
feature to inform its principal about all implemented release -
packages combinations ahead of time. With this information in place
the principal can do the upgrade in one operation without risk of
charm relation RPC type processing at a critical moment.

Also sync c-h.

Closes-Bug: #1806111
Change-Id: I95567d5d047eb64842436e671b74a633e6f509f4
2021-03-24 14:49:31 +01:00
Seyeong Kim 1e6d8e004b Exposing internal url over the relation.
There are scenarios where a keystone's consumer might want to talk to
keystone over the internal url, exposing this information over the
relation would allow services like openstack-dashboard to implement
a configuration option equivalent to `use-internal-endpoint` provided
by nova-cloud-controller.

Closes-bug: #1812361
Change-Id: I129a686ed9d20035894a36500cb64d1798d3f9d2
Co-Authored-By: Felipe Reyes <felipe.reyes@canonical.com>
2021-02-17 13:37:17 -03:00
Marius f5d2880cdd Add Magnum to the list of valid services
Change-Id: Ic56b353d9a9b1d5284c75e0403c77b9ecd455580
2021-02-15 14:50:07 +02:00
Zuul 87b0d0e1fe Merge "Remove unwanted blank line" 2020-12-16 22:46:46 +00:00
Alex Kavanagh c7e34558c4 Make Fernet key distribution more robust
The related bug indicated that the Fernet keys could get out of sync
between the leader and non-leader units.  This patchset assumes that
hooks fail, or that units are off-line when the rotation occurs.  Thus
it tries hard to ensure that the keys are in sync.  It still uses juju
to 'send' the keys from the leader to the subordinate units, so in that
sense, it is not a fix to the related bug, but it does make it more
robust.

Change-Id: Id40a3ccbe565bd742e3fdbd5190deb6b21204a82
Related-Bug: #1849519
2020-11-17 15:24:49 +00:00
Linda Guo 5a7f1cff32 Remove unwanted blank line
This is my first commit to learn gerrit workflow. The fix just simply
removed a blank line between imports.

Change-Id: I2953f501fbacf2909fd33a8b385e501e72b351de
2020-10-22 20:47:29 +11:00
Liam Young 57b9d62aaf Make catalog-cache-expiration configurable
Expose catalog-cache-expiration which can be used to specify how
long catalogue entries will  be cached for. In addiontion inform
charms that receive notifications of endpoint changes what this
setting is.

Change-Id: I3ce72efc5bd96c987748f66a275f92941daa8fe5
2020-09-29 15:59:38 +00:00
Zuul c64776b628 Merge "Do not leak credentials on leader-set failure" 2020-09-14 08:07:36 +00:00
Aurelien Lourot f9aa92c7ce Do not leak credentials on leader-set failure
This will also give us more insights into the leader-set failure
happening in the linked bug.

Also updated project files from latest release-tools templates.

Also blacklisted libjuju 2.8.3 which causes spurious
JujuAPIError's.

Change-Id: I51b890098df6d918c1d84adba272559ef45411bb
Partial-Bug: #1890256
2020-09-11 12:23:12 +02:00
Alex Kavanagh d13e3dd77f Remove forgotten debug comment
Change-Id: I9cc8d5789e97c4ab815de405326bb0a8df4bb3c5
2020-09-09 11:00:05 +01:00
Zuul 4de6a4bf7a Merge "Fix performance issue when updating endpoints" 2020-09-09 09:51:11 +00:00
Alex Kavanagh 13f5ce49fe Fix performance issue when updating endpoints
This patch eliminates almost all the manager.py calls when
updating/checking the endpoints from the relation(s) with other charms.

Change-Id: Ibb7999239ec9927e76052b7e45c4545127b5919a
Closes-Bug: #1890602
2020-09-08 16:31:31 +01:00
Liam Young f72ae6160b Tell clients what roles were created
If a client requests a role then inform them what role was
actually created or already existed.

If a client requests the creation of a role and that role already
exists with a different mix of upper and lower case then the new
role is not created. This is because keystone purports to be case
insensative. However the client may not be case insesative (horizon)
and may assume that the role was created. This change replies to
the client with a new key 'created_roles'. This tells the client
what the case sensative name actually is.

Change-Id: Idc0865a688886a2066dfcdbd15e30118ae5c5bb8
Closes-Bug: #1890437
2020-08-27 13:21:39 +00:00
James Page e02f0590a7 endpoint notification v2 API compatibility
Fallback to v2 API behaviour for processing endpoints for older
OpenStack releases where the v2 API is still the default.

Change-Id: Ieb9afed0a6442fac48f8e1ccc0f5c34626a3be18
Closes-Bug: 1889180
2020-07-28 10:13:55 +01:00
Zuul 819c41acda Merge "notifications: provide complete set of endpoints" 2020-07-23 15:23:54 +00:00
James Page 0a054f17e1 notifications: provide complete set of endpoints
Depending on the order of hook execution its possible for a charm
requesting notification of endpoint changes via the subscribe_ep_change
relation key will only get a partial set of information based on
services which are registered after their service is registered.

If this situation happens and a subscribed to service already exists
in the endpoint catalog add these to the JSON dict of information
passed to the requesting charm.

Change-Id: Ibac7ea6de013674b570c3de205d95c0a9d1cd8ae
Closes-Bug: 1887394
2020-07-17 14:24:56 +01:00
Aurelien Lourot 8b46dfd637 Fix peer readiness detection
Sharing the admin password with peers over the 'cluster' relation
was needed in case the leader would die and the next leader would
then need that information. This was implemented years ago when
the leader DB didn't exist.

This led to a race condition described in the mentioned bug and
can now be safely removed.

Validated by deploying several keystone and glance units, then
removing the keystone leader, then adding a glance unit and
checking that this new unit gets its service credentials.

Also added useful traces, made linter happy and increased fernet
token expiration to avoid spurious test failures.

Closes-Bug: #1818113
Change-Id: I004903e50f51e190467d71691982de26518d7149
2020-07-16 22:56:46 +02:00
Zuul cd722cb6fe Merge "Ensure keystone gates identity-credentials on API readiness" 2020-07-13 17:46:00 +00:00
Chris MacNaughton 71b7eedfc5 Ensure that certificates are correctly managed.
When the certificates relation is ready before the
HA relation is clustered, the VIP symlinks will not
be created pointing at the correct certificates. This
change updates the HA handlers to ensure that the
certificate relation is handled after clustering,
if there are any certificate relations.

Change-Id: Idfbdaf7919569983cdf159e44a6dad26eccfd195
Closes-Bug: #1886077
2020-07-09 12:34:25 +00:00
Chris MacNaughton b89c87b6a7
Ensure keystone gates identity-credentials on API readiness
When Keystone tries to setup identity credentials before the
API is ready, there will be hook errors as the API service
is not available to communicate with. Adding in a gate on
API readiness before handing out credentials makes this safe.

Change-Id: I9f2700a391cfb664572a39e8db5b2d3e370cf170
Closes-Bug: #1886918
2020-07-09 13:46:13 +02:00
Dmitrii Shcherbakov 4eb640ab56 Return an empty string if relation data is missing
None is returned for a relation data value if a key isn't present -
assuming that it's a string is not correct. This change fixes that by
returning an empty string if protocol-name is not present.

Change-Id: I2bab6a69f9f663edee0738ff35b804d81736cb5c
Closes-Bug: #1882084
2020-06-04 20:33:24 +03:00
Corey Bryant 4c316350cc Fix lint errors E741 and E741
hooks/keystone_utils.py:1606:9:
 E741 ambiguous variable name 'l'

actions/security_checklist.py:52:13:
 F523 '...'.format(...) has unused arguments at position(s): 0

Change-Id: I84f33cfd574483a36b8201a0a6b4f970f8cb8175
2020-05-21 13:55:29 -04:00
Liam Young 53bcfd0a06 Check peers before emitting identity data
The checks that keystone was performing before emitting identity
data were applicable to any Openstack api charm so the check
definitions have been moved to charmhelpers so other charms can
use them. The checks as they were are encapsulated in
`check_api_unit_ready` *1

Bug 1818113 was caused by keystone emitting identity data
as soon as the leader was ready but ignoring the state of the
peer units. This is now covered by a new check
`check_api_application_ready` which performs all the local
unit checks and then checks that all peers have reported
as ready too.

In addition `check_api_unit_ready` is now used when
setting the units workload status and `check_api_application_ready`
is used when setting the application workload status.

*1 https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/openstack/utils.py#L2289
*2 https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/openstack/utils.py#L2330

Change-Id: I99830ab2c2482e8beef174424820907ce96fd5d7
Closes-Bug: #1818113
2020-04-24 11:25:55 +00:00
Liam Young 9f8f3abc31 Restart apache when keystone policy changes
Keystone does not reliably pick up policy changes (observed on
Queens) unless apache is restarted. This change triggers a restart
when  policy is changed.

Change-Id: Ia29312baa9c1b8113649fc2826f0464588c3ce11
2020-04-22 12:59:00 +00:00