Commit Graph

42 Commits

Author SHA1 Message Date
Grzegorz Grasza 956cc87cc1 Fix error message when OTP is missing, add logging
* Fix cloud-init error message when OTP is missing
* Add a log message in novajoin-server

Change-Id: Ib299269c564744af6a5fcded9195d27be1c14ce7
Related-Bug: 1836529
2019-08-30 14:57:13 +00:00
Grzegorz Grasza 938a999a02 Sync cloud-init script with tripleo ipaclient*.yaml
* Always use the FQDN supplied in the metadata.
    * Read the metadata from network if hostname could not be determined.

Related: rhbz#1734156
Change-Id: I0aaa32d71569240e5b8ced270f9296782e2e08b8
2019-08-30 14:56:54 +00:00
Grzegorz Grasza 6506855623 Helper scripts for modifying cloud-config-novajoin.json
Adding two helper scripts to unpack cloud-config-novajoin.json to a more
readable form. After editing cloud-config-novajoin.yaml, it still has to
be packed into cloud-config-novajoin.json with tools/cloud-config-pack.py.

Related-Bug: 1836529
Change-Id: I3d6a3e5f97608f7f8a0070f40ddeb8a7113c33b3
2019-08-28 12:23:59 +02:00
Grzegorz Grasza 2c8c868a2c Add mkhomedir option to ipa-client-install
To allow PAM to create a home directory for the user who does not have one,
ipa-client-install needs this option.

Change-Id: I550f48e5a6cb808f0bc68ee1bdbddba9660531c2
Related-bug: #1823727
2019-05-29 15:17:12 +02:00
Ade Lee 5b897ce8de Always use fqdn
There is no reason not to use the fqdn, as we always check for
it.  It is needed in some cases eg. when deploying when the domain
does not match the realm.

Change-Id: Iefefc8d134af64c12d206c75b69ead8d9e94ac39
2019-04-11 11:44:42 -04:00
Michele Baldessari e8b18c4bd4 Fix python3 errors in novajoin-ipa-setup
With python3 we are getting the following error:
Traceback (most recent call last):
  File "/usr/bin/novajoin-ipa-setup", line 103, in <module>
    args['tls_ca_cert'] = cafile.decode('UTF-8')
  AttributeError: 'str' object has no attribute 'decode'

Let's just use the normal assignment in case the .decode() call
fails.

Also apply the same fixes to files/cloud-config-novajoin.json

Tested and we correctly get past this error.

Change-Id: Ia77ebde46ff885c9f929d834f981acb97f26a4ec
Co-Authored-By: Luca Miccini <lmiccini@redhat.com>
Closes-Bug: #1820961
2019-03-21 08:58:42 +01:00
Grzegorz Grasza 462305315c Check policy when handling a HTTP request
* Add default policy for handling the create request.
* Allow it to be accessed only by nova service.
* Remove unused code copied from cinder.

Change-Id: Ieaa407f27c6774d1fd17850a9571de5554360bae
2019-01-18 11:27:09 +01:00
Grzegorz Grasza e4621348ab Fix retrieving metadata from network
If there is a Python exception during parsing of status.json,
$config_drive ends up being empty, which causes
 [ -b $config_drive ] to be interpreted as true. This change
uses [[]] to prevent word splitting of variable values.

Change-Id: Ia2a1404711ce1deb04fed1d7b7624b3c0382b4d4
2018-11-05 12:17:22 +01:00
Harald Jensås b9098eb15c Use config-drive to get metadata if available
Metadata available via the metadata url 169.254.169.254/32, but this
does not work for IPv6 networks (see bug:
  https://bugs.launchpad.net/neutron/+bug/1460177).

Metadata can also be available via the config drive, non-dependent
of IPv4 networking and NAT redirect rules on the metadata server.

This changes the novajoin cloud config generated "setup-ipa-client.sh"
script. The script will initially try to load metadata of the
config-drive, and fall back to loading the metadata from the metadata
service url in case the config-drive method fails.

Related-Bug: #1795722
Change-Id: Idaca9de2f9c50b27475fd27ab8b388cb85849d70
2018-10-06 01:16:32 +02:00
Damien Ciabrini ed5de4f138 Add a retry loop when fetching vendor_data from novajoin
In [1] we added a random sleep in the script called by cloud-init
to fetch vendor_data, to lower chances that many nodes connect to
novajoin concurrently. Still, curl failures still happen from
time to time.

Add a retry loop around the call to curl to further increase the
chances of success, as this seems to give good results in practice
when deploying overclouds with tripleo.

[1] 188f09ef22

Closes-Bug: #1766824

Change-Id: I728c2cb0c8a7433b68dd7de2de242e922974d713
2018-04-27 14:18:01 +02:00
Juan Antonio Osorio Robles 61346df6c8 Use novajoin's kerberos realm for instances
This is useful in cases where the kerberos realm isn't the same as
the domain. It gets the kerberos realm that novajoin is using, and gets
the instance to register using that.

Closes-Bug: #1711312
Change-Id: Ic8a32a0ace69b32e1bb66145ac460175c4508a17
2017-09-07 05:48:14 +00:00
Jenkins 587e8f3a28 Merge "Don't unconditionally set the hostname in cloud-init" 2017-08-28 15:09:08 +00:00
Rob Crittenden c873779708 Don't unconditionally set the hostname in cloud-init
We have seen some bare base images failing when hostnamectl is
being called during cloud-init. nova is setting a proper hostname
value in meta_data.json which cloud-init is using so make the
hostname setting optional if it is already correct.

Change-Id: I6920895532f29211b35f46b47d4160762b51dcd5
2017-08-25 15:25:56 -04:00
Rob Crittenden 4d3c185261 Fix user and path to binaries in systemd scripts
I'm not exactly sure how but the user was nova and the paths were
to /usr/sbin and not /usr/bin.

The RDO package is going to use these rather than carrying local
copies so it is important that they be correct.

Change-Id: I1222edc55c0571b6fa3512a2d9c9ee107ebf4434
2017-08-25 12:02:41 -04:00
Rob Crittenden 3969a46c21 Add sample systemd service files
Change-Id: I7a1bdbdd88b454a79172164199ed49521a97cc88
2017-08-22 15:12:30 -04:00
Juan Antonio Osorio Robles 188f09ef22 Add random sleep to cloud-init before getting nova-metadata
this ensures that the nodes don't try to call nova-metadata at the same
time, and reduces the chances of the call failing. Ideally we should
have a retry for getting the metadata though.

Change-Id: I346415647d7c7f787f2e75580e0a2c41f29df32d
2017-08-04 11:34:35 +03:00
Juan Antonio Osorio Robles 054c186b1e Add auth_token configuration options to config generator
Change-Id: I1dd344a4af11e6946141feadb0cf67696e918209
2017-04-03 16:37:57 +03:00
Rob Crittenden ab784a4029 Require an authentication token for all requests
Change-Id: I537af6ccfd2016eaf0df5cfe205a328dc5ede8f9
2017-03-27 15:05:50 +00:00
Ade Lee 0915572da0 Move cloud-config.json to cloud-config-novajoin.json
Change-Id: I042392b816cc2b82b98162153fb145f5a6399310
2017-01-05 16:06:32 -05:00
Ade Lee c59f0baa3d Make generator actually create join.conf
Also remove now unused join.conf.template.

Change-Id: Id6a83391741329aeed9d76cb5f37acff613fb5fb
2017-01-05 12:02:18 -05:00
Ade Lee 3de6faf389 Add some additional settings
Add api_paste_config to generated config.
Add default settings for keytab and domain.
Add auth_strategy.

Change-Id: Ibb65a700773c0d359cc9a464451bc5f479ae9897
2017-01-05 02:40:39 -05:00
Ade Lee b0c0bf145a Added ability to generate config file
To generate use tox -e genconfig

Change-Id: Ie2065f822991bf308805de7788712cdc7b31d1dc
2017-01-04 12:14:30 -05:00
Rob Crittenden f178718979 Remove deprecated url configuration option
This used to handle IPA connectivity manually by using
python-requests so the URL was necessary. This was replaced
by using the IPA framework instead and the host(s) to
contact are handled by that.

Change-Id: I4009b044ad079fd97591a28d8f47d18621506d6e
2016-12-08 19:25:30 +00:00
Rob Crittenden 54dcbc323d Complete changes to use /etc/nova/join.conf
Fix the remaining places that referenced /etc/join/join.conf to
use /etc/nova/join.conf instead.
2016-11-30 04:36:08 +00:00
Rob Crittenden 91499c11f7 Remove references to deprecated service_name config option 2016-11-10 14:39:41 +00:00
Rob Crittenden 6195105026 Don't configure keystone_authtoken section, drop keystone_auth_uri
The paste configuration doesn't include authentication so there
is no need for keystone_authtoken. This also means that
the option keystone_auth_uri can be removed.

Also drop man page reference to the keystone_identity option.
2016-09-19 17:41:28 -04:00
Rob Crittenden ce00f62248 Change config template to match upstream, drop keystone-identity
I compared join.conf with nova.conf and neutron.conf and made
it conform more closely to those two in configuration in thej
keystone_authtoken and service_credentials sections.
2016-09-15 16:10:25 -04:00
Rob Crittenden 0190e94e40 Fix typo (?) in service_name, service vs services
services worked fine in the rdo factory, I'm not sure
why this is so particularl in Triple-O but given that is
the target I'll change it.
2016-09-07 14:39:40 -04:00
Rob Crittenden 9537b609ac Use python to get otp and hostname out of metadata
I was using a clumsy bash method which would have eventually
done the wrong thing.
2016-08-26 10:58:21 -04:00
Rob Crittenden 60a8e67a8c Use a service user to get Keystone tokens to talk to services
The authentication scheme of the REST API is still a bit up
in the air so switch this to not rely/expect authentication
but instead to use the nova service user to talk to other
services.

Eventually this should use its own service user.

This enables us to get images from glance but also to handle
looking up the information we need when Neutron assigns a
floating IP address. This means we can create the hostname
in IPA DNS in advance so it will be on the public network
and not the private one.
2016-08-25 17:09:55 -04:00
Rob Crittenden cdb6f11205 Add Keystone options to template, installer. Add log location
Remove some unused options in the Keystone configuration and
add options so the installer can automatically configure things
to work without manual changes.

Add a log_dir to the configuration so all logging is saved.
2016-08-18 13:41:59 -04:00
Rob Crittenden 48a72614d0 Don't require authentication
Authentication is still an open issue with this dynamic
metadata as some requests may come in anonymous (those from
an instance). Leave it open for now.
2016-08-18 13:39:46 -04:00
Rob Crittenden 58c7a06bc8 Update cloud-init script to fetch from updated NEWTON location
The latest upstream patch changed the date for NEWTON metadata
so update the cloud-init script to reflect the current value.
2016-07-21 21:13:58 +00:00
Rob Crittenden bee74b53a8 Use auth token passed in to fetch image metadata from glance
The nova team doesn't want to pass in system_metadata which
contained the image metadata because the format/naming may
change over time. They'd prefer the caller fetch the image
metadata.

Added that, using the current authenticated token.

At some point will need to add the ability to generate a
token using some special service user given that some/most/all
requests to metadata will be unauthenticated.
2016-07-18 21:42:46 +00:00
Rob Crittenden d3c72da5a9 Get auth context from request and use it to to get glance image
Add a new middleware to get the Keystone token from the auth
headers.

Add a simple glance client to retrieve image metadata.

Update the default paste configuration to require auth and
make a copy of the token for internal use.
2016-07-14 22:22:34 +00:00
Rob Crittenden 215674d542 Set IPA domain, fix errors caught in integration testing
Set the IPA domain in join.conf so hostnames will get the
IPA domain, instance_name + domain.

Don't blow up if metadata or system_metadata comes in as None.

Add some missing variable definitions caught by pylint.

Read join.conf in the notify server as well.

Re-order the kinit in the installation script to not fail
if the user has no pre-existing ticket.

Don't copy join.conf and api-paste.ini from going into
/usr/share/novajoin.
2016-07-07 19:41:54 +00:00
Rob Crittenden 4cabc343e2 Fix setup and installation to more or less work properly
Some manual work is still required, particularly in the nova
configuration.
2016-07-07 14:14:20 +00:00
Rob Crittenden 1c51140028 Initial commit of REST/notification services
This is based heavily on the WSGI code in cinder.

There are two services: a REST service and a notification
listener.

Currently both log only to stdout.

The configuration file join.conf controls the REST service.

nova configuration should look like this (assuming the REST
service is running on the nova compute host).

vendordata_providers = StaticJSON, DynamicJSON
vendordata_dynamic_targets = 'join@http://127.0.0.1:9999/v1/'
vendordata_driver = nova.api.metadata.vendordata_http.HTTPFileVendorData
vendordata_dynamic_connect_timeout = 5
vendordata_dynamic_read_timeout = 30
vendordata_jsonfile_path = /etc/nova/cloud-config.json

For the notification service like this:

notification_driver = messaging
notification_topic = notifications
notify_on_state_change = vm_state

Authentication is disabled in api-paste.ini for now.
2016-07-05 19:53:11 +00:00
Rob Crittenden 422e5e9ebf Remove hooks-specific implementation
This leaves in place files common to the vendordata
implementation.

More changes will be necessary to make the setup and
installation scripts work.
2016-07-05 17:53:10 +00:00
Rob Crittenden 9e928689fc Install freeipa.json, add it automatically 2016-02-26 19:51:52 +00:00
Rob Crittenden c819475d44 Make IPA VM setup script more robust 2016-02-26 19:51:35 +00:00
Rob Crittenden bf13847e06 Initial commit 2016-02-26 19:47:47 +00:00