404 Commits

Author SHA1 Message Date
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
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
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
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
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
Frode Nordahl
0a02c30fe5
Replace use of admin_token with Keystone bootstrap
Stop the use of the admin_token and use the bootstrap process
to initialize Keystone instead.  Fortunately the implementation
of the bootstrap process is both idempotent when it needs to be
and it can be safely called on an existing deployment.

Subsequently we can migrate by just removing the admin_token
from the configuration and create new credentials for use by
the charm with a call to ``keystone-manage bootstrap``.

Remove configuration templates for versions prior to Mitaka, by
doing this we need to move any configuration initially defined
prior to Miataka forward to the ``templates/mitaka`` folder.

A side effect of this migration is that newly bootstrapped
deployments will get their ``default`` domain created with a
literal ID of ``default``.  Prior to this change third party
software making assumptions about that being the case may have
had issues.

Closes-Bug: #1859844
Closes-Bug: #1837113
Related-Bug: #1774733
Closes-Bug: #1648719
Closes-Bug: #1578678
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/191
Change-Id: I23940720c24527ee34149f035c3bdf9ff54812c9
2020-03-13 09:52:10 +01:00
Frode Nordahl
3765c0b123
Unpin flake8 and fix lint
Change-Id: Iacae0fc791003d7f1730363f10f509434b0e671f
2020-03-10 13:39:41 +01:00
James Page
dc2f5e5259 Provide admin user ID and project ID
For keystone v3 deployments, provide the admin user and project ID
over identity-service relations.

This may be used by consuming services to build trust between the
service account and the cloud admin account.

Change-Id: I6166793a497a283e743210d067eb44c14071e61e
2020-03-05 15:40:04 +00:00
James Page
f984c4ec9b endpoint notification: provide full endpoint
When a remote service requests notification about changes to
endpoints, provide the full detail on each endpoint rather than
just a checksum of the internal/admin/public URL's.

This allows consuming services which require explicit configuration
of service endpoint URL's to configure everything via their
relation to keystone rather than directly relating to all required
services.

Change-Id: I39b6e3df17e44c801f5f6bb122407623cbf1c937
2020-03-05 11:21:40 +00:00
James Page
6ca8e9b508 Add Trilio workloadmgr service definition
Add support for registration of the Trilio Workload Manager
service into the keystone service catalog.

Change-Id: If46e007700bfa95585c65364a80710b25d42c562
2020-03-05 10:52:15 +00:00
Zuul
2b6b708fab Merge "Implement Security Compiance option for password" 2020-02-19 14:50:17 +00:00
Liam Young
068444f466 Send notification on identity-service relation.
Services can optionally request notifications of other services endpoint
changes. They do this by sending a space seperated list of service names
that they wish to be notified of down the identity-service relation e.g

    subscribe_ep_change="placement neutron"

If the endpoints change for any service in the list then a notification is
sent back with a nonce. e.g. if the neutron ep changes the charm will
recieve a json encoded dict of changes:

    'ep_changed': '{"neutron": "1c261658"}'

This removes the need for charms to have two relations for ep notification
changes and allows applications to specify which endpoints they are
interested in.

Closes-Bug: #1862974

Change-Id: I03667af35022c352ea1cf817d97a6a50c2fb5c5d
2020-02-17 10:59:22 +00:00
Alex Kavanagh
e83cb05bf8 Implement Security Compiance option for password
This feature adds a "password-security-compliance" option to the
charm to enable setting of keys in the "[security_compliance]" section
of the keystone.conf file.  This section was added in the Newton
release, and so this feature supports this from the Newton release.

It also protects the service accounts from two of the PCI-DSS options
but setting the user options 'ignore_password_expiry' and
'ignore_change_password_upon_first_use' to True to prevent the cloud
from being broken.

Change-Id: If7c54fae73188284bd9b03a53626cdf52158b994
Closes-Bug: #1776688
2020-02-05 18:10:12 +00:00
tpsilva
92e75b5aad Disable Apache port 80
Currently, Apache ports.conf file is not being configured by this
charm. This patch changes the ports.conf default file with another one
that does not open port 80 on SSL environments.

Change-Id: I35ba6bb31af6d795d02d90d0d127ac5c6c129d0f
Closes-bug: #1845665
2020-01-29 18:22:27 +00:00
Liam Young
fca036ba24 Use get_managed_services_and_ports from ch
Switch to using get_managed_services_and_ports from charmhelpers.

Charmhelper sync included to bring in required
get_managed_services_and_ports method.

Change-Id: Ib2b1f3dead1dbb613591bdf3903ed56e8c14f45c
2020-01-29 08:02:13 +00:00
Liam Young
9192e48568 When resuming exclude haproxy
When resuming services exclude those managed by hacluster, in
this case haproxy. If pacemaker lacks quorum it may shut haproxy
down which will cause this charm to error.

Change-Id: I9ac10807e853f2e83ea9ea9b780f83a79c17be10
2020-01-22 10:23:39 +00:00
Zuul
ea8e38d09f Merge "Adds watcher api support service catalog" 2019-12-20 09:52:23 +00:00
Felipe Reyes
0b7ca2624b Notify changes when service key is missing
Services that expose multiple endpoints use a prefix in their keys, this
patch refactors that code to put it in their own function to be reused
by the notifications functionality and make it notificate for changes in
those endpoints (e.g. neutron-api and nova-cloud-controller).

Change-Id: Ieecfc4ef7c85c7f716ceef0c2938ae0c7787953d
Closes-Bug: #1856419
2019-12-19 23:22:27 -03:00
Stamatis Katsaounis
0ae98efa32 Adds watcher api support service catalog
Watcher needs to be added to the keystone service catalog for
functionality of the upcoming watcher charms.

Change-Id: Ie800c9030c94ff92f38b3502113e8875a4dcba11
Signed-off-by: Stamatis Katsaounis <skatsaounis@admin.grnet.gr>
2019-12-14 21:03:34 +02:00
Seyeong Kim
1362b99533 Remove subdirectories when deleting unused key
Change os.remove to shutil.rmtree to delete unused key directory
even it has subdirectories somehow

Change-Id: I4743b2e9650721966df40a7dd542f85833c4f4c6
Closes-Bug: #1840756
2019-09-05 19:18:13 +09:00
David Ames
a103c15e40 Use AuthMethod context
Rather than use hard coded auth methods, use the protocal named passed
over the keystone-fid-service-provider relation.

Also, when using federation do not allow the "external" method as they
are mutually exclusive.

Change-Id: I08f0632630d7f0e8d2d7ddb057e02f9febf9ad6f
Closes-Bug: #1828015
Closes-Bug: #1828018
2019-05-16 21:49:01 +00:00
Liam Young
1f5a09b55e Check Apache ssl dir when determining restart map
If the certificates that Apache is using change then Apache needs to
be restarted. This change adds the SSL directory to the restart map
to ensure any certificate changes trigger a restart.

Change-Id: I1fd46865350e6a9cb35f4209fcf8dd201e6f1441
Closes-Bug: 1828530
2019-05-10 09:12:36 +00:00
David Coronel
f01c34d7c8 Added status_set and logs to upgrade-charm hook
When running an upgrade of the keystone charm in a large environment,
the upgrade process can take more than 30 minutes.

Prior to this change, the user would only see 'Installing apt packages'
during most of the process.

This change adds status_set and log messages to the upgrade charm hook
so that end users can see what is the status of the upgrade.

Change-Id: I1eade73fad551310ceec0bb8dcbccb777737faeb
Closes-Bug: #1782004
2019-04-25 10:52:00 -04:00
Alex Kavanagh
023dd35a5a Ensure that the manager.py re-connects if it gets a 500 error
This patch works around a bug during upgrades where (it is believed)
that the manager.py script can hold a 'stale' connection to the apache2
hosted keystone, which then returns a 500 HTTP error when next used.

Change-Id: Id9c9b967742467f30270f52c2a8b6634f6480324
Related-Bug: #1823743
2019-04-16 21:04:13 +01:00
Alex Kavanagh
78f0191aa8 Ensure that manager.py is stopped when keystone restarted
This patch ensures that any running manager.py script is stopped if the
keystone service (either standalone, or run via apache2) is restarted.
The ManagerServer will automatically (re)start the manager.py script
when it is needed.

Change-Id: I4e3dff340cce73b2de7d697f3685d602defb5179
Related-Bug: #1823743
2019-04-09 16:12:48 +01:00
Alex Kavanagh
627ab761dd Fix manager.py launch python version to match installed payload
The manager.py helper is launched with either py2 or py3 depending on
the version of the payload.  However, it was using openstack-origin
rather than actually picking up the actual version of the installed
software.  This patch ensures that the manager.py is run with the
python version of the installed payload, which resolves a bug when
upgrading to rocky (which is the py2 to py3 transition of the payload).

Also fixes an os.execl() bug which changed behaviour from python2 to
python3.

Change-Id: I17255b84ca067886f866a5f8311dcab57fba6f14
Closes-bug: #1818988
2019-03-07 14:11:31 +00:00
Liam Young
296a10b5f7 Add domain id information to identity-credentials
Some projects, like masakari, require the project and user domain
id when authenticating with keystone. This change adds the domain
information to the relation information.

Given the user and projects can be in different domains expose
the domain names and ids as individual config options.

Change-Id: I228ddfbef23ab77885b093c8d5f359eec13d210c
2019-02-26 11:19:33 +00:00
Andrew McLeod
308bddf00d Adds masakari api support service catalog
Masakari for instance HA needs to be added to the keystone service
catalog for functionality of the upcoming masakari charms

Change-Id: Ic48767df7dc0408679c7dd9a6d7547b744778894
2019-02-13 16:12:50 +01:00
Aymen Frikha
c272d2c707 Add support for Middleware
This patch creates a new middleware context to retrieve data
from subordinate charm and update the kesytone configuration file.
It also allows integration with keystone-middleware interface:
https://github.com/openstack-charmers/interface-keystone-middleware
This patch uses the subordinate configuration approach
to retrieve data from the subordinate charm.

Every changes required for paste.ini file will be handled by
the subordinate charm. The latter should deal with keystone upgrades.

Closes-Bug: #1808597

Change-Id: I4897011fbc791abc97e34e75826579820e80a4f1
2019-01-07 18:52:05 +00:00
James Page
2851aefeb5 Deal with py2-py3 migration during charm upgrade
On charm upgrade the charm may switch to py3 packages. If so, ensure
the old py2 packages are purged after any new packages have been
installed.  If packages where removed during the upgrade, then
restart all services to pickup any py2->py3 switches.

Change-Id: I8a17f679e85448680ab0b1f5ae362ef7a65b035c
Closes-Bug: 1803451
2018-11-15 12:25:16 +00:00