404 Commits

Author SHA1 Message Date
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
James Page
1db0949c25 Add OpenStack Queens support
Keystone@Queens removes support for the v2 API; switch default
to v3 API from Queens onwards and ensure that charm users can
only provide 3 as via the preferred-api-version for >= Queens.

Change-Id: I58fcbaa7fc385bef77544be349c7d461e3e5559b
2017-12-18 10:23:53 +00:00
Liam Young
4b00281bb4 Add memcache backend
Install and configure memcached on the keystone units and configure
keystone to use the cache. This should speed up token access for
existing tokens.

Change-Id: I26af0a97660e5bbe293a32e6b9e3d209338f905a
Closes-Bug: #1722541
2017-10-17 11:10:48 +00:00
Zuul
effe368622 Merge "Add domain info to relation data" 2017-10-17 08:27:37 +00:00
Edward Hope-Morley
68a0c87235 Do relation consistency sweep on leader change
The current charm design is to perform a sweep of all units
related on the identity-service interface to ensure that
they have all the correct setting values applied. If the
leader unit is deleted and a new one is elected this will
not happen until some event e.g. config-changed occurs. This
can result in remote units malfunctioning since they think they
are not configured. We resolve this by always doing a sweep when
the leader-elected hook fires.

Also fixes infinite loop edge case when ssl-cert-master switches
as a result of leader switch.

Change-Id: Icd68cc70d81d7d518c918e831056f686dbc7db1e
Closes-Bug: 1721269
2017-10-05 18:11:54 +01:00
David Ames
8da85834c2 Snap install OpenStack in Charms
Install OpenStack using snaps. By setting openstack-origin to
snap:track/channel or snap:track the charm will use snaps to
install rather than debs. If channel is left off it defaults to
stable. For example: snap:ocata/edge will install the edge version of
Ocata and snap:pike will install the stable version of Pike.

Charm helpers sync for snap related helpers.

Change-Id: I6e3540e4ffe081540404f91061e5c9b7039b3eac
2017-09-28 17:34:11 +00:00
Xav Paice
cc54352d7a Add domain info to relation data
When using Keystone v3, the relation data set by
add_credentials_to_keystone now includes a 'domain'.

Change-Id: I2a4ff4d7c20d4f274479dfe0615dd00940e64d8b
Closes-Bug: 1719751
2017-09-27 12:30:12 +13:00
James Page
7fb7ff9063 Ensure os_release is reset during upgrades
Reset the os_release cache during the OpenStack upgrade process,
ensuring that any post dist-upgrade operations are made in the
context of the new OpenStack release, not the old one.

Change-Id: I3d3584dd8e97f85e16c38e1143f627b03fa63bd0
Closes-Bug: 1715624
2017-09-07 17:10:15 +01:00
Jenkins
b1527da9ee Merge "Dual Stack VIPs" 2017-08-11 23:47:42 +00:00
David Ames
1328ce5880 Dual Stack VIPs
Enable dual stack IPv4 and IPv6 VIPs on the same interface.
HAProxy always listens on both IPv4 and IPv6 allowing connectivity
on either protocol.

Update edge cases for is_ssl_cert_master for Bug #1709356.

Update amulet tests for keystoneauth1 tests.

charm-helpers sync for HAProxy template changes.

Closes-Bug: #1709356

Change-Id: I401071fcdd66252f389475d45e8136fc68c474f1
2017-08-10 18:41:53 -07:00
Dmitrii Shcherbakov
e3fd7b2087 Add panko service to the supported services
Add Panko service to the supported services to support Panko charm
deployment.

Change-Id: Ief1829768bfd9db20923d5684ce621095832e3db
2017-08-01 19:32:20 +03:00
James Page
1b395d09b2 Add gnocchi service to supported types
Add gnocchi service to catalog of supported service types
to support gnocchi charm deployment.

Change-Id: I9946374ed42eeb3b580d4b66fc00d16b72da12eb
2017-07-06 11:11:00 +01:00
James Page
d36af55484 Updates for pike b1
Resync charmhelpers for pike version support.

Add pike tests but leave disabled until all charms support pike.

Add support for volumev3 service type for Cinder.

Skip execution of PKI setup for >= pike as its been dropped from
keystone.

Change-Id: I9a4e452cc7b1b90126d1885c37f5a64b8241479d
2017-05-12 07:42:58 +02:00
Alex Kavanagh
b8b5acd44d Fix alphanumeric comparisons for openstack and ubuntu releases
- sync charmhelpers with fix-alpha helpers
- fix up code where the alpha comparisons are done
- fix tests which assumed mocks would just work on os_release()

Change-Id: I9f4a3b15e53c757c2ae5ffb2eb45b6cdaecf4c8e
Related-Bug: #1659575
2017-04-27 10:02:28 +01:00
Dmitrii Shcherbakov
e674c9f129 keystone: Add Contrail endpoints to keystone_utils.py
This is needed for Contrail 3.2

Change-Id: Id27d3b21a31a03d285d33986e8653fbd772d1e39
2017-04-13 20:34:15 +03:00
Edward Hope-Morley
b0b273c675 Fix premature identity-relation poll breakage
It is possible for the keystone charm to poll identity-relation
before their remote unit has set values. This patch fixes a
corner cases that cause a hook exception under this
circumstance.

Change-Id: I3339870b87adcd712a341ae5074b4af1e924f64a
Closes-Bug: 1674786
2017-03-22 15:33:37 +00:00
David Ames
3cfc297f44 Cleanup unused apache site configurations
When the keystone charm is upgraded the apache mod_wisgi
configuration file name has changed. With duplicate configuration
files apache fails to start up. Generalize the function
disable_unused_apache_sites to handle any sites we may need cleaned
up now or in the future.

Change-Id: I13111bf9788ba3bfbef3efedb7b027323c84a6b8
Closes-bug: #1665044
2017-02-15 14:07:25 -08:00
Corey Bryant
6ae00abe26 Add nova-placement to valid services
Change-Id: I9f4952e222138bcb5f23c0c40cfce5deb07bf61a
2017-02-08 22:47:41 +00:00
Dmitrii Shcherbakov
920796050d keytone_utils: add zaqar to valid_services
The lack of zaqar in the valid_services dict leads to an error if
it tries to establish a relationship with keystone.

Change-Id: I8dcf14c103bf4d8a70d2f580e7743f3374f4327b
2017-02-01 14:18:07 +03:00
James Page
795ebdeb19 Enable domain specific drivers
Enable support for domain specific drivers, managed via
configuration files (instead of directly using the API and
database).

Using multiple domains means that calls to users.list must
be scoped to a specific domain; ensure that v3 calls to this
method are appropriately scoped.

Change-Id: I7ed84b7210597ab1633eba343a0c68741a5a8578
Partial-Bug: 1645803
2017-01-30 09:53:37 +00:00
zhangyanxian
1ae8143502 Fix typo in keystone_utils.py
TrivialFix

Change-Id: I377cf8f07e5acf9247182924519f9e3b16aa33d7
2017-01-20 06:02:21 +00:00
Corey Bryant
b4ccea72a0 Use common WSGI code from charm-helpers
The WSGI template and context code has been moved to charm-helpers.
This change updates the charm to use the common code from charm-helpers.

Change-Id: I6a3efdb0811c8d50c657f6f8b923b076e3de6716
2017-01-18 14:33:38 -05:00
Jenkins
f59fb19eab Merge "Update identity-admin relation to support v3" 2017-01-17 15:55:37 +00:00
Liam Young
9fd19ae2c3 Update identity-admin relation to support v3
Update the identity admin relation to support passing api-version
keystone is using and the extra credential information needed for
authenticating a v3 client

Change-Id: Ied2d8641096fa5ccf90878d8d7fca81835d844c3
2017-01-16 14:11:26 +00:00