377 Commits

Author SHA1 Message Date
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
Zuul
bd522d07ea Merge "Improve Apache PID check on service restart" 2018-11-08 17:17:09 +00:00
Liam Young
8bdb5d5f76 Fix call to os.execl
It looks like os.execl does not support an empty second argument
under py3. This change fixes the call for py3.

Change-Id: Iffcd2c68b03013384ad3f1d2b5e8805b84b3972a
Closes-Bug: 1802274
2018-11-08 13:36:05 +00:00
Liam Young
32e4d822c1 Only check for one unit for container scoped rels.
When checking goal state, only look for one unit to be available
when examining container scoped relations as a principle unit only
ever has a relation with a single unit of a given subordinate
application.

Change-Id: I02f34358060c98c0702d3d7b58d52427c2a0445a
Closes-Bug: #1801754
2018-11-05 18:36:06 +00:00
Zuul
d3aa1dc449 Merge "Gate initial update of relations on having reached expected scale" 2018-10-17 06:18:48 +00:00
Andrey Grebennikov
f0ee669279 Improve Apache PID check on service restart
In case there are containers with Apache running on the same
host, the charm will only watch PIDs within the same namespace.

Change-Id: I9cdd7d5b1f53fce748e7fafab538676e4e55dd54
Closes-Bug: #1795918
2018-10-11 12:53:49 -05:00
Corey Bryant
9cb5636eba py3: Switch to using Python 3 for rocky or later
Switch package install to Python 3 for OpenStack Rocky or later.

When upgrading, remove any python-* packages that were explicitly
installated and then autoremove --purge any dependencies that are
no longer required.

Also drop the python2 shebang from hooks/manager.py in favor of
specifying the interpreter on the subprocess call. The python
interpreter version must match the python version of the OpenStack
payload due to the keystoneclient library imports.

Depends-On: I18996e15d2d08b1dacf0533132eae880cbb9aa32
Change-Id: If973ebc2be3b32ee3ff2122b5874dad96cda9fec
2018-10-10 09:20:51 -04:00
Frode Nordahl
1c1c41c7f1
Add `octavia` service
Change-Id: Ia4beebac21aebf88287f92527b091655a1bd05b8
2018-10-08 14:51:19 +02:00
Frode Nordahl
a449a53885
Gate initial update of relations on having reached expected scale
At present the Keystone charm frequently initiates updates to its
relations before it has reached a stable state.

Make use information from ``juju goal-state`` to predict scale and gate
initial update of relations on having reached expected scale.

Depends-On: https://github.com/juju/charm-helpers/pull/226
Change-Id: I96d4aff7c4ec9fb9ea160c7e294581bab3103df8
2018-10-04 10:15:42 +02:00
Wouter van Bommel
78f2e5e049 Assign username from config if none is given
When hooks/keystone_utils.py:get_admin_passwd is called without the user
parameter, the parameter should default to config('admin-user')

Also changed the log, to use the parameter for consistency with facts.

Don't assume 'admin' is always the username for admin, when setting the
admin password.

Added unittests to check the various options, either specifying the
username via function arguments, or use setting from
config('admin-user').

Change-Id: I02726c07ee4ed1e78ea1bfaa93adc2564a1a8236
Closes-Bug: 1794893
2018-10-02 16:02:01 +02:00
Alex Kavanagh
59561fdda0 Convert the charm to Python 3 only
Major changes:

 * decoupling the hooks/manager.py file from the charm.  It is now a
   script that is called from hooks/keystone_utils.py as it has to use
   the same Python version/libraries as the installed keystone payload
   software.  keystone_utils.py and manager.py communicate via a Unix
   Domain Socket using json, encoded to base64.
 * As Python3 requires absolute imports, the charmhelpers symlink has
   been removed from hooks, and the hooks and charmhelpers symlinks have
   been removed from the actions directory.  Instead, the path is
   adjusted so that the modules can be found.

Change-Id: I18996e15d2d08b1dacf0533132eae880cbb9aa32
2018-09-21 09:09:47 +00:00
Abhijeet Patra
4183055aa3 Adding Trilio DataMover service to keystone
Change-Id: Ibc631327bf636b66c6a66c8bd21dcffb37c342a9
2018-09-10 10:01:33 -04:00
Alex Kavanagh
60fd4de2b3 Fix fernet token test/rotate to use UTC only
The test/code was using localtime; this changes it to UTC so that DST
changes don't affect rotations.

Change-Id: I1c8247c08103833a842c422e19b5cd121515c054
2018-08-22 15:20:17 +01:00
Frode Nordahl
93db018485 Do not rotate keys when lead unit is paused
Closes-Bug: #1787719
Change-Id: I0557803e90d8ec52271f01e5e7276d2db8338ce2
2018-08-20 15:15:44 +00:00
Alex Kavanagh
b813360bf6 Keystone Fernet Token implementation
This patchset adds more Fernet token implementation:

1. Adds a cron job to rotate / sync keys to other units.
2. Adds additional tests around gating on config.
3. Adds rotation / syncing with more robust key handling.

Change-Id: Ied021ad83c241f241dbb5f9acdede9045e43a8a3
2018-08-14 08:35:43 +02:00
Frode Nordahl
3f58b2861b
Use leader storage for passwords
There are no relation-level concerns for these values.

Any pre-existing deployments with recent charms (as in released
2015 or later) will have already migrated the peer storage to
leader storage, so this change can build on that work directly.

Ref: https://github.com/juju/charm-helpers/blame/master/charmhelpers/contrib/peerstorage/__init__.py

Change-Id: I85d1746bdf3e9d3e1ff514e6dd2b4c565dee4dfc
Closes-Bug: #1783943
2018-07-27 14:15:26 +02:00
Frode Nordahl
a4c39edc24
Use leader storage for db-initialised flag
There are no relation-level concerns for this flag.

Any pre-existing deployments with recent charms (as in released
2015 or later) will have already migrated the peer storage to
leader storage, so this change can build on that work directly.

Ref: https://github.com/juju/charm-helpers/blame/master/charmhelpers/contrib/peerstorage/__init__.py

Change-Id: Ia7362d257428b102c452d0e91bcf9b3378a1e6e9
Closes-bug: #1783747
2018-07-26 14:42:21 +02:00
Frode Nordahl
1e991dc28b
Add initial support for Fernet tokens
Starting OpenStack Rocky the currently used `uuid` token format
is no longer supported and we need to change to use `fernet` tokens.

This change provides basic functionalty to initialize fernet token
repository and distribute keys to non-leader units.

A configuration option is also added allowing change of token format
in a controlled manner prior to upgrading to OpenStack Rocky.

Further work is required to implement key rotation, actions etc. and
these topics will be addressed in separate commits.

The commit also fixes a instance of missing release check for writing
of `policy.json`, and a few places where writing of `policy.json`
previously was omitted.

Change-Id: I1d0ff22a5f091b02f5700412745572c246103e9e
2018-07-25 15:23:47 +02:00
Frode Nordahl
17b24e7fde
Remove support for PKI tokens and legacy charm managed certificates
These features are disabled by default, a majority of our
users provide certificates through configuration.

At present the cluster relation carries information required
for these features even when they are not enabled. This makes
processing of cluster relation changes unnecessarily heavy
and vulnerable to bugs.

Notice of deprecation and removal in next release was given
as part of the 18.05 release notes.

Change-Id: I8b07c7e0d5c2c623c115c83dc8aff230b554a986
Closes-Bug: #1755897
Related-Bug: #1744990
2018-06-12 17:23:38 +02:00
Dmitrii Shcherbakov
6f3751cc96 add support for Federated IDentity (FID) and WebSSO
* add support for relating with subordinate charms providing Service
Provider functionality via apache2 authentication modules;
* enable additional authentication methods on the keystone side to
accept parsed assertion data provided via apache2 authentication module
variables exported to WSGI environment;
* move https frontend and WSGI API apache config files to keystone
instead of relying on charm-helpers as modifications are needed there to
add IncludeOptional directives. openstack_https_frontend.conf is added
on purpose as ServerName cannot be correctly determined after ProxyPass
which results in TLS errors during SAML exchange process;
* add an additional relation to openstack-dashboard to provide URL
information necessary to trust 'origin' parameter in WebSSO URLs used by
horizon during the authentication process. Also add a context to render
the federation section that is used to render this information in
keystone.conf;

Subordinates can choose to use different apache2 authentication modules.
If those modules support vhost-level variables then multiple
subordinates for the same module can be used. For example,
mod_auth_mellon can be used multiple times in different vhosts to
protect federated token endpoints related to different identity provider
and protocol combinations).

Trusted dashboard relation could be used to provide dashboard origin URL
from a different site via cross-model relations.

NOTE: this functionality will be triggered only on Ocata+ (inclusive)

Change-Id: I1ef623b0b0e2a9f68cec4be550965c5e15e5f561
2018-05-11 21:09:47 +03:00
sfeole
a189c3da80 Don't ensure pki permissions for releases <= Pike
Openstack PKI token support was dropped in the Pike release.
The following update ensures that PKI token validation is
only run if the release is supported when the sync leader
broadcasts any service credentials to its peers.

In this case; if the release is <= pike. then we can sync
token certs and ensure the pki permissions are valid.
Otherwise this action will be skipped.

Closes-Bug: 1759403
Change-Id: I3d8ba6d3cac3a3505a3722a5082c3a6933a9ef67
2018-04-05 08:57:15 -04:00
James Page
bd29991439 Provide service domain id for v3 deployments
The glance swift store configuration requires use of the domain
id for the service domain; update data set for identity-service
relation to include service_domain_id.

Change-Id: Ie6e2733f34de10a4d34b18dbf1fd9ba623af0e18
Closes-Bug: 1752027
2018-02-27 12:46:01 +00:00
Zuul
2ba8a56a59 Merge "Remove deploy from source support" 2018-01-12 14:42:43 +00:00
James Page
e8f1fdd8a1 Remove deploy from source support
Drop support for deployment from Git repositories, as deprecated
in the 17.02 charm release.  This feature is unmaintained and has
no known users.

Change-Id: Ic054e29ef55d8890a3130af16b48f105efcf8f6a
2018-01-12 10:42:25 +00:00
Zuul
1b1134ce1b Merge "Make usernames predictable for multi-endpoints" 2018-01-03 10:37:27 +00:00
Zuul
30f637bc55 Merge "Add OpenStack Queens support" 2018-01-03 10:34:15 +00:00
Liam Young
ee6db34c16 Make usernames predictable for multi-endpoints
Whenm generating a username associated with multiple charm the
username was derived from the keys of an unordered dict making the
username liable to change. This patch sorts the keys and makes the
username stable.

Change-Id: I0f857d7c2d5c4abf4843bc3fe1a9848164048fe2
Closes-Bug: #1739409
2017-12-22 10:05:55 +00:00
James Page
6b5bb0da1e Drop postgresql support
Remove postgresql DB support; This feature is untested as part
of the charms, is not in use and was deprecated as part of
the 1708 charms release.

Change-Id: Ia57a7358fd3567fe0250c45f3e00c07fa83f329c
2017-12-21 12:02:35 +00:00