Commit Graph

21 Commits

Author SHA1 Message Date
Dmitry Tantsur 3ebfdf05e1 Support listening on a Unix socket
When using nginx to terminate TLS (like it's done in Bifrost), it's more
secure to use a Unix socket for communication, so that local users
cannot access plain text communication.

Change-Id: I37b762cca035b5855deb92635c29e8eb97a87c20
2022-02-01 10:30:11 +01:00
douyali 96096144bb Add ibmc_address to ipmi_address_fields
Use ibmc driver to inspect, need edit ironic-inspector config file
to add ibmc_address.

Change-Id: Ie1c665b80b10b6a4d5a3fce1ea4849a8c996cf69
2021-03-22 21:24:37 +01:00
wes hayutin b4f008f08e Revert "Power off before inspection"
This reverts commit 34b264ef08.

Parial-Bug: #1897505
Change-Id: Ia0623e9183cd5c774397bf233b87dcc4d33c2566
2020-09-29 00:24:14 +00:00
Julia Kreger 34b264ef08 Power off before inspection
Power off nodes before inspection as failed previous
inspection attempts may cause re-inspection attempts
to fail.

Change-Id: I7405420ad441428dc82360d84b75e03921031482
Story: 2008107
Task: 40820
2020-09-04 13:32:00 -07:00
Julia Kreger bbc5cd7da5 Fix URL parsing to enable redfish_address matching
Fixes the ironic utilities logic to parse URLs in driver_info
properly.

Also adds ``redfish_address`` to the default list of fields to
evaluate for host matching.

Previously an operator could add the field to the list, but the
matching logic would not match the URL as it did not know to
decompose the url and identify the hostname portion of the url.

Resolves: rhbz#1670336
Story: 2008010
Task: 40660
Change-Id: Ice86e9ab3efb98b649141bdf7e1e2febdc9203a8
2020-08-13 18:05:17 +00:00
Dmitry Tantsur 6a8d46b33b Listen on :: by default
On most target systems it will make it available on both V4 and V6.

Change-Id: Ie918bc8572ff7f0ce2712cbb248e8ee9bf4c3d20
2020-08-07 12:17:57 +02:00
Dmitry Tantsur 0d20064f44 Add leader election for periodic sync with ironic
Periodically elect a leader to do the cleanup sync with
Ironic (to avoid unnecessary calls to  Ironic in a
multi-inspector setup).
Add config option 'leader_election_interval' to control
the period in which the leaders is elected.

Co-authored-by: Arne Wiebalck <arne.wiebalck@cern.ch>

Story: #2007801
Change-Id: I6f60aea41865f09f9e53e5d91b1e887f0b39efbd
2020-07-02 12:17:28 +02:00
Zuul a78df4b827 Merge "Allow operators to disable clean_up sync" 2020-06-30 12:42:03 +00:00
Julia Kreger 2f828aed46 Allow operators to disable clean_up sync
Some operators simply don't need the periodic clean up sync
task as part of their ironic deployment with ironic-inspector
as they are not using the PXE filtering to manage access for
machines as part of discovery.

In these "standalone" use cases, there is typically no neutron,
and everything is managed externally from ironic-inspector.

Change-Id: I0036b2cdb7d562e90855ccabd108392f2f97c6f9
2020-06-29 16:53:28 -07:00
Julia Kreger 463cc07e85 Remove cimc_address from address field list
The cimc driver was removed from ironic some time ago
and as such it does not make sense to continue to include
the reference in ironic-inspector.

Change-Id: I4f226b79e66ae19402a2700160b2f0cd8f783470
2020-06-16 22:57:05 +00:00
Steve Baker 196c019771 Enable Basic HTTP authentication middleware.
When the config option ``auth_strategy`` is set to ``http_basic`` then
non-public API calls require a valid HTTP Basic authentication header to be
set. The config option ``http_basic_auth_user_file`` defaults to
``/etc/ironic-inspector/htpasswd`` and points to a file which supports the
Apache htpasswd syntax[1]. This file is read for every request, so no
service restart is required when changes are made.

The only password digest supported is bcrypt, and the ``bcrypt``
python library is used for password checks since it supports ``$2y$``
prefixed bcrypt passwords as generated by the Apache htpasswd utility.

To try basic authentication, the following can be done:

* Set ``/etc/ironic-inspector/inspector.conf`` ``DEFAULT`` ``auth_strategy``
  to ``http_basic``
* Populate the htpasswd file with entries, for example:
  ``htpasswd -nbB myName myPassword >> /etc/ironic-inspector/htpasswd``
* Make basic authenticated HTTP requests, for example:
  ``curl --user myName:myPassword http://localhost:6385/v1/introspection``

[1] https://httpd.apache.org/docs/current/misc/password_encryptions.html

Change-Id: If50dfbfc18445ad9fe27e17cb0ee1b317ff25a0b
Depends-On: https://review.opendev.org/729070
Story: 2007656
Task: 39826
2020-06-05 01:28:40 +12:00
Dmitry Tantsur 3d1bf55b35 Avoid using introspection start delays with non-managed boot
When boot is managed by the ironic side, a node is powered on
right after starting introspection. Inspector's own delays play
no role and may actually prevent introspectin from happening if
a node boots faster than it's whitelisted in the PXE filter.

This changes moves the delay handling later in the process and
only does it when manage_boot is True.

Change-Id: If7de8b66ea42eff2966c62a9a0529ab9a5c06f26
Story: #2007658
Task: #39745
2020-05-12 12:17:45 +02:00
Kaifeng Wang 1bed475409 Adds tooz locking driver
Adds tooz requirements, configuration options and locking support.

Story: 2001842
Task: 30376

Change-Id: I78ffdeeb502cbed0550152b19efbb224f47c65af
2019-08-02 09:58:10 +08:00
Dmitry Tantsur 258d7388a4 Expose baremetal-introspection endpoint via mdns
This change adds an option to publish the endpoint via mDNS on start
up and clean it up on tear down.

Story: #2005393
Task: #30384
Change-Id: Ia9407cb065979aac6761d3e4122d3884e45b559d
2019-05-22 13:58:55 +02:00
Kaifeng Wang 6e7b62a6eb Remove deprecated ssl options
[DEFAULT]ssl_cert_path and [DEFAULT]ssl_key_path were removed in this
patch.

Change-Id: I9358a4c8d540c4d6b3f4b5c36e357d9e9174af50
2019-04-09 13:22:57 +08:00
Dmitry Tantsur ab4a3bd867 Prevent abnormal timeout values from breaking sync with ironic
I had a case when an operator set the timeout too a abnormally large
value, which caused OverflowError in the timeout clean_up task, which,
in turn, prevented ironic-inspector from ever running node list sync
with ironic.

This change makes two corrections:
* The timeout configuration is limited to 10 years (0 can still be used
  to disable the timeout completely).
* Errors in the clean_up task do not prevent the node list sync from
  running.

Change-Id: Ie3ad29a4abb9ac58c41b776042f80dff6a9c72d2
Story: #2004807
Task: #28963
2019-01-17 16:46:03 +01:00
Kaifeng Wang edd6810c3d Wrap Flask into oslo.service
This patch is part of inspector HA work, which wraps inspector api into
oslo service.

oslo.service has also provided support to signal processing like SIGHUP or
SIGTERM, so these code were removed in this patch.

Deprecated current SSL cert/key options used by ironic-inspector, code
manually creates ssl context were removed. These options will be fed
from [ssl] section.

Change-Id: Ia5e16fcb9104556d62c90f5507f17b41f73a5208
Story: #2001842
Task: #12609
2018-10-23 09:20:16 +08:00
Kaifeng Wang a228912827 Wrap rpc server into oslo.service
This patch is part of work splitting inspector api and worker.
The rpc server is wrapped into oslo.service, and launched from
api process.

Now api and worker belongs to separate thread, functional tests
use the fake messaging driver, while devstack jobs use rabbitmq.

Change-Id: Ie03d16f9d115c3561723463dea6a57d2a763bcc6
Story: #2001842
Task: #23109
2018-10-23 09:17:42 +08:00
Kaifeng Wang 0c7a52b624 Remove deprecated option node_status_keep_time
[DEFAULT]node_status_keep_time is deprecated long ago [1], this
patch removes it so that inspector will not automatically remove
node status in regards to configuration option.

This also make sense when we use other store backends in the
future.

Change-Id: I8261ce115fdb03ffcfe3a1cc4ca7c8ec747be832
Related-Bug: #1695858
2018-08-10 09:37:23 +08:00
Dmitry Tantsur e7c3218f71 Add manage_boot parameter to introspection API
Adds a new node field "manage_boot" to store this value. When it is set
to False, neither boot device nor power state are touched for this node.
Instead, we expect a 3rd party to handle them.

We still manage the PXE filter because the node may need DHCP.

Change-Id: Id3585bd32138a069dfcfc0ab04ee4f5f10f0a5ea
Story: #1528920
Task: #11338
2018-06-25 12:09:17 +02:00
Pavlo Shchelokovskyy 71a2bef7d9 Centralize config options
Consolidate all config options under ``conf`` directory.

New config modules should give a better picture of the configuration
options provided by the inspector.

Change-Id: I501ed0787ff4e1d91462f936e1a54de2c7abb35c
Related-Bug: #1561100
Co-Authored-By: Anton Arefiev <aarefiev@mirantis.com>
2018-01-04 20:43:58 -08:00