Commit graph

13292 commits

Author SHA1 Message Date
Zuul
1fb5bba81e Merge "Control port updates with update_pxe_enabled flag" into stable/2024.2 2025-06-06 19:08:50 +00:00
haseeb
a13ed324b1 Control port updates with update_pxe_enabled flag
The [inspector]update_pxe_enabled configuration option controls
whether the pxe_enabled field of a Port is updated during node
inspection. This patch adds logic to honor that setting.

Change-Id: I3e28e439b386c9f73e377b62513346bcadbd56b2
(cherry picked from commit 5a9efa070c)
(cherry picked from commit b476c1bc27)
2025-06-03 20:46:31 +00:00
Julia Kreger
ebb5b1f1ac Fix agent get_XXX_steps retries from being treated as not fresh agents
It is possible that an agent is booting in an environment with firewalls
doing evil things like not closing sockets, or where a FIN-ACK never makes
it to the conductor, or whatever.

This can result in the client hanging and eventually timing out.

Ironic's agent client code automatically retries. Which is cool.

The agent records it got a command from the first attempt, and then again
from the retry. Everything goes swimmingly until Ironic goes to assess
if the agent is a "freshly booted" agent, or not. At which point, the
check logic would see the multiple "get_xxx_steps" calls in the agent
logs, and declare the agent not to be freshly booted due to the retry
attempts.

So instead, we now explicitly evaluate the results of the command in
whole to account for retires. This commit also adds additional tests
as the helper was previously only really being exercised with empty
lists in unit tests.

Closes-Bug: 2110698
Change-Id: I460751b761462dbb630368e474e207fed90f289a
(cherry picked from commit 91b28bc43b)
2025-05-19 13:27:20 +00:00
Julia Kreger
d1c117502a CI: Fix anaconda job post OSSA-2025-001
Turns out some of the standalone jobs, anaconda in particular,
can reference some artifacts on disk in such a way which causes
the security logic to block the request. This is an easy fix.

Change-Id: I79204117cdbffab1f619981767471475870b4571
(cherry picked from commit 42be33b52b)
2025-05-16 17:09:48 +00:00
Jay Faulkner
e18bbe3af0 OSSA-2025-001: Disallow unsafe image file:// paths
Before this change, Ironic did not filter file:// paths when used as an
image source except to ensure they were a file (and not, e.g. a
character device). This is problematic from a security perspective
because you could end up with config files from well-known paths being
written to disk on a node.

The allowlist default list is huge, but it includes all known usages of
file:// URLs across Bifrost, Ironic, Metal3, and OpenShift in both CI
and default configuration.

For the backportable version of this patch for stable branches, we have
omitted the unconditional block of system paths in order to permit
operators using those branches to fully disable the new security
functionality.

Generated-by: Jetbrains Junie
Closes-bug: 2107847
Change-Id: I2fa995439ee500f9dd82ec8ccfa1a25ee8e1179c
2025-05-10 12:32:32 +00:00
Jay Faulkner
6b8e252342 [stable-only] Fix errors building docs
We duplicated these disk_utils options in the security fix; disabling
use of them during doc runs.

Change-Id: I1a1eaf6f089c4fa52b030ce2fa82493cdc53f07a
2025-05-08 11:06:13 -07:00
Zuul
76ed064072 Merge "Make floppy images more floppy" into stable/2024.2 2025-03-19 18:36:34 +00:00
Doug Goldstein
651d775370 fix glance metadata layout
The code here builds a dictionary from a glance v2 image object that
roughly resembles the glance v2 image object. The current behavior
nests the 'properties' set on the image under it's own 'properties' key
resulting in the image properties never being seen by the Ironic code.
The breakage results from the change from glanceclient to the SDK which
changed the shape of the returned object. The glanceclient object shape
was that of FakeImage while the SDK returns a Resource based object
which includes attributes for all possible fields which are defined at
the top-level of the object. Since the tests run against a different
value they did not cature the failure. Just changing to the SDK object
results in us copying all these new values to the properties dict which
is definitely not the intention. For maximum compatibility to backport
this filters any value not set from being set into properties and sets
the rest. The broken path is any user of get_image_properties()
(both copies from common/images and deploy_utils) checking for user
supplied properties.

Closes-Bug: 2099953
Change-Id: I1842e2651fd2bd8455646db9a3a80c3b9ece5c97
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
(cherry picked from commit 05734cfc95)
2025-03-14 01:26:37 +00:00
Dr. Jens Harbott
bc565cf543 Make floppy images more floppy
Some vendors insist that floppy images need to be exactly 1440 KiB in
size and have a suffix of ".img". Let's adapt to this and assume that
this doesn't break other vendors.

Closes-Bug: 2100276
Change-Id: I5be6380e8c8c3eac5bea1c189b205b05a9fae625
(cherry picked from commit 56dbf38ed8)
2025-03-05 14:26:28 +00:00
cid
5aa51d6985 Pass agent token to get command results
Change-Id: Iad0d8086e1e79b59da3f9940b83128a3b34d4787
(cherry picked from commit 279392966b)
2025-02-14 21:06:35 +00:00
Zuul
6d0030471b Merge "Expand detected strings in check_cipher_suite_errors" into stable/2024.2 2025-02-10 11:41:17 +00:00
Zuul
62308fcd8c Merge "Fix hold/wait step logic in step validation" into stable/2024.2 2025-02-07 21:44:17 +00:00
Pavlo Shchelokovskyy
3fec72442b Expand detected strings in check_cipher_suite_errors
we see some slightly different errors returned in the wild
for some HW.

Change-Id: Ic822c8283600b658ba5ff7bc007cb95352d82a86
Related-Bug: #2085137
(cherry picked from commit 80540bb52d)
2025-02-07 11:17:23 +00:00
Zuul
c48115b965 Merge "Fix agent from being locked out with complex steps" into stable/2024.2 2025-02-05 02:11:47 +00:00
Julia Kreger
0911ecae40 Fix agent from being locked out with complex steps
When mixing in-band out-of-band steps, the out-of-band status polling
flag was not being cleared, and was being left to remain in the node
driver_internal_info field, thus preventing future heartbeat operations
from the baremetal node from being processed to check the actual
completion status of a step.

We now always clear the field based upon the workflow in-progress
before starting a new step and should asynchronous steps also
be recorded as a result of any step's actions such as if a reboot
is required.

Special thanks goes to keekz for promptly providing upstream with
the information necessary for us to identify the root cause.

Closes-Bug: 2096938
Change-Id: I5198d9169cff8474c7a990332639b2d0758e6e1a
(cherry picked from commit 5db194c503)
2025-02-04 23:33:25 +00:00
Dr. Jens Harbott
60248a0b85 Fix redfish session cache on missing password
The redfish_password option is optional, make sure that the SessionCache
does not throw an error when it is not set.

Closes-Bug: 2097019

Change-Id: Idf792c982a883a4c07ae1dad72e3c54bc73b96a1
(cherry picked from commit 91b656d31c)
2025-02-04 23:32:29 +00:00
Julia Kreger
3c27ebcc11 Fix hold/wait step logic in step validation
Somehow... the hold and wait steps were dropped or were lost in
from when hold/wait step logic was developed. This fixes it and
adds them to a test which exercises the validation logic.

Also takes into account the unhold verb call from Dmitry's change
in https://review.opendev.org/c/openstack/ironic/+/913707 and
adds a test accordingly.

Change-Id: I8c23db46b4a5772d907f6c73ed5b975fdaaf80c8
(cherry picked from commit b6275912c2)
2025-02-04 19:34:39 +00:00
Dr. Jens Harbott
187337bc44 stable-only: Drop ironic-tox-codespell job
codespell get updated from time to time and finds "new" spelling issues,
but we don't want to keep amending stable branches for that, so drop
this job here.

Change-Id: Idc7a812cf11d4750cf123b2273be35a7fdb66326
2025-02-04 16:52:21 +01:00
Steve Baker
d1872d7fcf Calculate missing checksum for file:// based images
The fix for CVE-2024-47211 results in image checksum being required in
all cases. However there is no requirement for checksums in
file:// based images.

This change checks for this situation. When checksum is missing for
file:// based image_source it is now calculated on-the-fly.

Change-Id: Ib2fd5ddcbee9a9d1c7e32770ec3d9b6cb20a2e2a
(cherry picked from commit b827c7bf72)
2025-01-08 10:12:36 +13:00
Iury Gregory Melo Ferreira
684dd6107e Update Node Cache after Successful Clean/Service
This commits makes sure we call update_node_cache
after we finish a successful cleaning/servicing.

Change-Id: I62403120c758caac38a4d2b3912a9c43f65161cc
(cherry picked from commit f6904d9783)
2024-12-05 10:32:29 +00:00
Jay Faulkner
38d94ca3a0 Use specific fix-commit from dnsmasq
I have requested a new release from dnsmasq here:
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2024q4/017828.html
but until they perform one, we should at least checkout and build
a version of dnsmasq with this fix, instead of downgrading to one that
is slightly less broken.

Related-Bug: 2026757
Change-Id: I8abac5fa729035341c90d7881cb35aff751da101
(cherry picked from commit 360e21124c)
2024-11-25 22:04:01 +00:00
Zuul
17914538df Merge "Fix policy checks added with runbooks" into stable/2024.2 2024-11-19 11:55:47 +00:00
Zuul
00a34ec7c1 Merge "Actually ignore [inspector]power_off with fast track" into stable/2024.2 2024-11-19 11:31:42 +00:00
Zuul
567888d8bf Merge "Gracefully handle bad request exception" into stable/2024.2 2024-11-19 03:10:03 +00:00
Julia Kreger
1ed8b772b3 Fix policy checks added with runbooks
In the runbooks change, I43555ef72cb882adcada2ed875fda40eed0dd034,
new policies were added for a user sending a list of service steps
or clean steps to the API.

This was done with the generic check_policy helper, however the helper
does not understand how to populate the ``node`` mapping data to enable
RBAC rule value matching. Doing so requires a special node policy
checker method.

As such, the policy checker was changed, and additional tests were added.

One final note, strucutrally the new policies were being checked *after*
we stated to do state verification of the request. RBAC checks should be
performed upfront... which also eases the burden of testing the RBAC
model. Accordingly, the policy checks were moved together
in the provision state logic.

Closes-Bug: 2086823
Change-Id: I18c56cb4becf9e6181689ddc0f1c7433327a3aa6
(cherry picked from commit bf644e8274)
2024-11-18 21:13:35 +00:00
Jay Faulkner
94a72b7a7e [stable-only] [ci] Remove metal3 job
Metal3 doesn't do stable branches, and we don't gate on it for stable
branches.

Change-Id: I7844748077ed0713f64f865fb118daa988deb069
2024-11-18 09:49:30 -08:00
Dmitry Tantsur
2a29676eaf Actually ignore [inspector]power_off with fast track
The option's help says that the option is ignored when fast track is on,
but in reality it only happens with the legacy inspection.

The clean-up logic diverges between the two inspection implementation,
so change the new implementation to reuse the old clean-up code.

Add a few missing unit tests.

Change-Id: I2e84aa285b5673bcc911d35439ba80a739460f59
(cherry picked from commit 4f40ddef26)
2024-11-08 12:59:13 +00:00
Doug Goldstein
577971afd4 add qemu-img to necessary dependency list
The unittests want qemu-img available now so add that as a dependency
that users need to install before running the tests.

Change-Id: I2169988c653088115c7b388113b5e76e721e2429
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
(cherry picked from commit 2cb56f8b99)
2024-11-07 16:08:03 +00:00
cid
f5ba0c8ae1 Gracefully handle bad request exception
Closes-Bug: #1619235
Change-Id: I156ba389e437c49ae75411cfbf0e29bcd54733bc
2024-10-22 17:18:01 +00:00
Zuul
ffeadb2282 Merge "Fix actual size calculation for storage fallback logic" into stable/2024.2 2024-10-08 17:30:23 +00:00
Zuul
2127cc4c93 Merge "Checksum files before raw conversion" into stable/2024.2 2024-10-03 19:11:26 +00:00
Julia Kreger
e3437d7c9f Fix actual size calculation for storage fallback logic
When we were fixing the qemu-img related CVE, in our rush we didn't
realize that the logic for storage sizing, which only falls back to
actual size didn't match the prior interface exactly. Instead of
disk_size, we have actual_size on the format inspector.

This was not discovered because all of the code handling that side
of the unit tests were mocked.

Anyhow, easy fix.

Closes-Bug: 2083520
Change-Id: Ic4390d578f564f245d7fb4013f2ba5531aee9ea9
2024-10-03 13:59:08 +00:00
Julia Kreger
afe4f48090 Checksum files before raw conversion
While working another issue, we discovered that support added to
the ironic-conductor process combined the image_download_source
option of "local" with the "force_raw" option resulted in a case
where Ironic had no concept to checksum the files *before* the
conductor process triggered an image format conversion and
then records new checksum values.

In essence, this opened the user requested image file to be
suspetible to a theoretical man-in-the-middle attack OR
the remote server replacing the content with an unknown file,
such as a new major version.

The is at odds with Ironic's security model where we do want to
ensure the end user of ironic is asserting a known checksum for
the image artifact they are deploying, so they are aware of the
present state. Due to the risk, we chose to raise this as a CVE,
as infrastructure operators should likely apply this patch.

As a note, if your *not* forcing all images to be raw format
through the conductor, then this issue is likely not a major
issue for you, but you should still apply the patch.

This is being tracked as CVE-2024-47211.

Closes-Bug: 2076289
Change-Id: Id6185b317aa6e4f4363ee49f77e688701995323a
Signed-off-by: Julia Kreger <juliaashleykreger@gmail.com>
2024-09-25 10:41:48 -07:00
Dmitry Tantsur
3f7f75f47d Fix double transition to INSPECTFAIL on aborting in-band inspection
Both the driver and the conductor code try to transition the node to
INSPECTFAIL, with the 2nd attempt failing. Rework the driver code to
only do implementation-specific clean-up. Also safeguard the conductor
code against this case.

Change-Id: Ie1c64b4807ecf29fa0da54501798d363675977c8
(cherry picked from commit 8a6b5eb8c3)
2024-09-25 14:28:02 +00:00
OpenStack Release Bot
4f90f42340 Update TOX_CONSTRAINTS_FILE for stable/2024.2
Update the URL to the upper-constraints file to point to the redirect
rule on releases.openstack.org so that anyone working on this branch
will switch to the correct upper-constraints list automatically when
the requirements repository branches.

Until the requirements repository has as stable/2024.2 branch, tests will
continue to use the upper-constraints list on master.

Change-Id: Ic23671eda898679b54a36e79029fb276856f09da
2024-09-20 13:53:33 +00:00
OpenStack Release Bot
5989e389a6 Update .gitreview for stable/2024.2
Change-Id: If82a92cdff7b5fc684d84b77cef5eeac16c6af14
2024-09-20 13:53:29 +00:00
Julia Kreger
5857ca0cd5 Update release mappings
Change-Id: I34ebd75faa4129732b5018af9801721ed992c16d
2024-09-18 11:45:04 -07:00
Zuul
5e7143c052 Merge "Drop SQLALCHEMY_WARN_20" 2024-09-18 16:59:22 +00:00
Zuul
4ca6a3b573 Merge "Add microversion headers to root ('/') endpoint" 2024-09-18 16:59:19 +00:00
Julia Kreger
f082c24d2a Add Prelude for end of cycle release
Change-Id: Ia32cfc52eef5c2693c307d2eec6289e41af6b278
2024-09-16 21:49:22 +00:00
Zuul
17b162e14e Merge "Bring back the metal3-integration job" 2024-09-16 16:37:23 +00:00
Zuul
3028de6ba0 Merge "Remove skip check for Python 3.6" 2024-09-16 16:11:15 +00:00
Zuul
c6523c521c Merge "CI: Remove scope enforced ci jobs" 2024-09-16 16:11:11 +00:00
Zuul
513198819a Merge "Make sure qemu-img command is available in debian/suse" 2024-09-16 16:09:21 +00:00
Zuul
67c9b5e554 Merge "Remove default override for RBAC config options" 2024-09-16 15:24:14 +00:00
Takashi Kajinami
eb27c6e219 Drop SQLALCHEMY_WARN_20
This environment was used by SQLAlchemy 1.4 and is no longer necessary
since SQLAlchemy was bumped to 2.0 .

Change-Id: I0e01f61529b633251f99d5a1a3e00ffca6c8837f
2024-09-16 06:25:25 +00:00
Zuul
7cddefd609 Merge "Drop description for ZeroMQ" 2024-09-13 14:33:31 +00:00
Dmitry Tantsur
a8c3beaca6
Bring back the metal3-integration job
Change-Id: I77516938a1322ba5016e478266a5e6292e4c7daa
2024-09-13 16:00:22 +02:00
cid
b19507d647 Add microversion headers to root ('/') endpoint
Adds microversion headers to the root endpoint so the '/' and '/v1'
endpoints consistently include microversion headers.

Closes-Bug: #2079023
Change-Id: Iea78b33e04e256c1139dd46a25f6d6a2be8e1ccc
2024-09-13 14:36:35 +01:00
Takashi Kajinami
1c201f0947 Make sure qemu-img command is available in debian/suse
The qemu-img command is required not only in Red Hat family but in
the other families such as Ubuntu, Debian or OpenSUSE.

Ensure the command is installed by bindep.

Change-Id: I94960fc644e2b8524d14633960a88a71437f0618
2024-09-13 22:11:27 +09:00