2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-28 17:46:42 +00:00
Commit Graph

1162 Commits

Author SHA1 Message Date
Jarrod Johnson 486540d24d Correct checking encryptboot pcrs in firstboot 2026-08-10 14:22:12 -04:00
Jarrod Johnson 730f645dc0 Defer PCR sealing to first boot
If someone wants to seal to a PCR
explicitly to prevent booting rescue, the PCR is likely to
extend differently during install.

Leave the volume sealed to the tpm without any PCRs until first boot.

Then wipe the bindings without PCR specified, and seal according to user preferred values.
2026-08-10 13:59:28 -04:00
Jarrod Johnson 0c18bc1c01 Older ESXi does not support listdetailed, support normal list. 2026-08-10 11:08:32 -04:00
Markus Hilger 461385522c Accept lastchance in every network manager
The retry pass calls apply_configuration with lastchance=True, which only
NetworkManager accepts. It is unreachable today, since only NetworkManager
returns the 1 that fills the retry list, but it springs the moment either of
the others grows a return, or the retry selection is brought in line with the
first pass. Matching the signatures costs nothing.
2026-08-10 14:36:37 +02:00
Markus Hilger 644843b892 Remove unused imports and pointless f-string prefixes (F401, F541, E713)
Entirely mechanical, produced by `ruff check --fix --select F401,F541,E713`
and reviewed rather than taken on faith: deleting an import is only safe if
nothing imports it for its side effects or re-exports it.  None of the 19
removed names is referenced anywhere in its file, none appears in any string
literal, and none of the touched files uses eval, exec, globals() or
__import__, so there is no dynamic lookup that could reach them.
2026-08-10 05:32:00 +02:00
Markus Hilger fcacaca79d Use a raw string for a regex escape (W605)
'\s' is not a recognised string escape.  Python still accepts it today but
warns, and it becomes a syntax error in a future release.
2026-08-10 05:32:00 +02:00
Markus Hilger 5d9e30de7b Stop loop variables from shadowing what they iterate (B020)
Each of these loops rebinds the name that holds the iterable.  They work
today because the iterable is evaluated once before the loop starts, but
the name is then gone, so any later use reads a loop item instead of the
collection.

- nodeinventory: `for arg in args` / `for arg in arg.split(',')`.
- confignet (common and debian copies): iname holds the comma separated
  interface list and is then reused for each interface in it.
- xcc _get_agentless_firmware: adata holds the adapter query response and
  is then reused for each adapter.

No behaviour change, just distinct names for distinct things.
2026-08-10 05:32:00 +02:00
Jarrod Johnson 76aef703ff avoid moving firmware directories if they don't exist 2026-08-07 15:42:10 -04:00
Jarrod Johnson 94c1683663 Add support for specifying tpm2 pcrs in the encryptboot attribute
This allows a user to opt into pcrs if they understand what they are doing.

Some PCRs are sensitive to firmware updates and some are sensitive to boot loader, kernel, boot config, or initramfs.  All of these are an opportunity for an unsuspecting update to remove access to the boot volume.  There are update processes that can be put into place to make this work,
but it is up to the OS update process to address that, and
OS update processes are likely not to address that at this time.
2026-08-06 16:07:19 -04:00
Jarrod Johnson c063cbff3a Change to using systemd-cryptenroll where available 2026-08-06 15:34:20 -04:00
Jarrod Johnson cc898d5661 Diseregard proxy for various confluent interactions
In some environments, http proxy is set for internet, but does not work internally.

Accommodate by suspending the proxy in confluent contexts.
2026-08-06 12:15:44 -04:00
Jarrod Johnson 5dce6f2b21 Fix identity image deployment of suse 15
The default 'cp' is /lbin/cp, but that fails, use full path to the cp that works.

Perform the hmac registration of api key that was missing.

Remove assumption that the ip will be ipv6, wrapping it only if a : is present in address.
2026-08-04 12:45:52 -04:00
Jarrod Johnson e05707da2e Remove -k from curl invocation 2026-08-04 11:15:53 -04:00
Jarrod Johnson d468f3afb6 Add identity image to the SUSE15 install 2026-08-04 09:21:11 -04:00
Markus Hilger 9788d563aa Apply chown before chmod in syncfileclient permission handling
chown() clears the setuid bit of a file on Linux (and its setgid bit, if
the file is group-executable), even when run by root and even when the
owner/group are unchanged. Since the owner/group chown ran after the
permissions chmod, any syncfiles entry combining owner=/group= with a
setuid/setgid permissions= value silently lost the special bits.
2026-08-04 04:33:04 +02:00
Markus Hilger 165d229178 Remove missing old obsolete syncfileclient from consolidation 2026-08-03 15:24:15 +02:00
Markus Hilger c0bc33e494 Report syncfiles failures instead of discarding them
get_syncresult() caught the sync task's exception, logged a repr server
side and returned 200 OK with a null body.  The node then called
.get('options') on that null resulted in:

  c1: 'NoneType' object has no attribute 'get'

and syncfileclient still exited 0 as if syncing had succeeded.

Return the error to the requestor as a 500 with an error payload.  On
the node, unwrap the body that grab_url_with_status raises for a
non-success status, print it once and exit non-zero.  Only a failure the
server deliberately reported for this sync is terminal. Anything else,
such as a dropped connection, is re-raised so the existing retry loop
handles it as before.  The same case now reports

  c1: Error performing syncfiles: Syncing failed due to unreadable files: /etc/dangling.conf
  c1: 'syncfileclient' exited with code 1
2026-08-03 15:17:15 +02:00
Jarrod Johnson e213949bf0 Bring fix in from el8-diskless edition of syncfileclient 2026-08-03 08:49:55 -04:00
Jarrod Johnson c3cf2a402f Remove redundant copies of syncfileclient 2026-08-03 08:48:28 -04:00
Jarrod Johnson 6853fd2833 Move syncfileclient to common
It is largely the samey
2026-08-03 08:47:16 -04:00
Jarrod Johnson d7dcb07a3f Implement deployment.storage
This is an attribute for a node to indicate preferences for storage.

For now, 'm2' policy will hit m.2 and mirroring kits.
2026-07-28 15:02:27 -04:00
Jarrod Johnson 3501f70c37 Merge pull request #247 from Obihoernchen/unsquashfs
Use multi-threaded unsquashfs to extract untethered images
2026-07-28 08:59:38 -04:00
Markus Hilger 67e84f15f8 Keep the root filesystem guard reachable when extraction fails
source_remote imageboot.sh is the last thing the diskless cmdline hook
runs, so returning early on a failed extraction ended the hook and left
dracut to time out. Falling through instead reaches the existing
/sysroot/sbin/init guard, which reports the failure and holds the node so
it stays reachable over ssh, as it did before extraction was checked.
2026-07-28 01:49:38 +02:00
Markus Hilger d9da502fbe Copy LICENSE into confluent_osdeploy before leaving the directory
The copy ran after the cd to the repo root, so it read ../LICENSE from
outside the checkout and never placed the file in confluent_osdeploy/. The
tarball went out without it and the spec's %install, which does
"cp LICENSE" after %setup cds into the unpacked directory, failed.
imgutil/buildrpm already copies before its cd; do the same here.

The aarch64 spec has its LICENSE lines commented out, so only the x86_64
build broke, but the copy was equally wrong in both scripts.
2026-07-27 20:19:39 +02:00
Markus Hilger a9d7b67929 Derive build versions from a tracked VERSION file
Release tags do not live on master: 3.15.2 through 3.15.6 were tagged on branch
3.15, so git describe reaches only 3.15.1 and dev builds were stamped
3.15.2.dev<n>. Besides being confusing, rpm and dpkg both rank the released
3.15.6 above that, so a dev package will not install over a released one.

Add a top-level VERSION file naming the release the branch is working toward
(4.0.0 on master) and a mkversion helper that stamps packages from it, keeping
the tag-derived value as a floor so a forgotten bump cannot go backwards.
mkversion also replaces the block copy-pasted into seven build scripts, and
makesetup no longer writes a per-package VERSION file, so the stale checked-in
confluent_common/VERSION goes with it.
2026-07-27 20:06:22 +02:00
Jarrod Johnson b3b16c6497 Do not fail on inability to do REUSEPORT 2026-07-24 11:52:41 -04:00
Jarrod Johnson 61e0524a56 Some fixup of SELinux contexts for EL10 diskless boot
Unfortunately, the problem of urlmount's selinux context is left open.

urlmount starts before policy load, preventing transition.

However the policy blocks access urlmount needs when loaded.
2026-07-23 15:58:07 -04:00
Jarrod Johnson 5136b95cde Adjust to EL10 grub stub cfg
The syntax changed, make the code more adaptive to a variety of situations.
2026-07-20 17:11:19 -04:00
Jarrod Johnson 9dfb3ea42b Merge pull request #250 from Obihoernchen/stateless-booted-status
Report stateless boot completion via new 'booted' status
2026-07-20 12:55:55 -04:00
Markus Hilger 9101b07d54 Report stateless boot completion via new 'booted' status
Diskless profiles had the updatestatus callback in onboot.sh commented
out because no suitable status existed: 'complete' clears
deployment.pendingprofile, which the PXE responder requires to answer
the next network boot of a diskless node.

Add a 'booted' status that records the pending profile as
deployment.profile while leaving pendingprofile armed and skipping
autolock, and enable the onboot.sh callback in all diskless profiles.
nodedeploy now shows 'pending: <profile> (booted)' for a running
stateless node.
2026-07-20 15:59:30 +02:00
Markus Hilger 73c5b9cebf Comment out the MERGE statement in syncfiles
It's confusing for users to have this enabled by default.
This should be opt-in as everything else.
2026-07-18 03:40:48 +02:00
Jarrod Johnson 12ef3fc529 Merge pull request #245 from Obihoernchen/selinux
SELinux label diskless runtime files on EL
2026-07-16 20:10:43 -04:00
Markus Hilger b6fb58b31f Skip add_local_repositories if no imgutil build --source is set
BUILDSRC is only set if imgutil build is run with --source, otherwise
the build host repos are used. If --source is not used, there is no
distribution symlink and add_local_repositores failed with 404.
Check if BUILDSRC is set and skip add_local_repositories if this is the
case.
2026-07-17 00:06:57 +02:00
Markus Hilger cfc4490fe1 Use multi-threaded unsquashfs to extract untethered images
`unsquashfs` can use multiple CPU cores during image extraction, significantly reducing boot time.
For example the whole boot time from PXE to shell on a 8-core VM, from approximately 45 seconds to 20 seconds.

This PR adds `squashfs-tools` as a dependency. Since the package is smaller than 1 MB, the additional image size is justified by the performance improvement.

For backward compatibility, the existing `cp`-based extraction method is used when `unsquashfs` is unavailable, such as with images built before this change.

The extraction logic has also been moved into the common functions and is now shared between EL9, EL10, and Ubuntu.

Both untethered `squashfs` images and `confluent_multisquash` images are supported.

Images must be rebuilt to include `unsquashfs` and benefit from the faster extraction path.
2026-07-16 21:24:58 +02:00
Markus Hilger c3c4805f9d SELinux label diskless runtime files on EL
Centralize the SELinux chcon helper and use it for downloaded
systemd units, onboot hooks, and apiclient files across EL7 through EL10.
Include chcon in captured EL initramfs images.

Without this fix the onboot services failed to start on SELinux enabled
captured image.
2026-07-16 19:52:52 +02:00
Markus Hilger fa605160e0 Merge branch 'master' into ci 2026-07-14 17:04:16 +02:00
Jarrod Johnson 53172f760f Have the priority models brought out and more documented 2026-07-14 08:30:34 -04:00
Markus Hilger ab6eeb3ced Merge branch 'master' into ruff 2026-07-14 05:28:53 +02:00
Markus Hilger 2af402b13c ruff auto fixes
Apply ruff's safe autofixes.
The changes are mechanical and behaviour-preserving. Issues fixed:

- F401: remove unused imports.
- F841: drop unused local variables and assignments, including discarded
  await/return values, unused "except ... as e" bindings, and unused
  "with ... as name" targets.
- F541: remove the f prefix from f-strings that contain no placeholders.
- E711: compare against None with "is"/"is not" instead of "=="/"!=".
- E712: test truthiness directly instead of comparing to True.
- E713: use "x not in y" instead of "not x in y".
- E714: use "is not" instead of "not ... is".
- E731: convert lambdas bound to a name into def statements.
- W291/W293: trim trailing whitespace on touched lines.
2026-07-14 05:03:58 +02:00
Markus Hilger 69a6714108 Use raw string notation to fix python compile warnings
E.g.: SyntaxError: "\d" is an invalid escape sequence. Did you mean "\\d"? A raw string is also an option.
2026-07-14 01:26:19 +02:00
Jarrod Johnson 6bdd44ffcf Merge pull request #234 from Obihoernchen/netsettings
Add net.extra_settings for passthrough network settings
2026-07-13 08:45:23 -04:00
Markus Hilger 6d606f37f6 Fix Shellcheck errors
Fix SC2045 (error): Iterating over ls output is fragile. Use globs.

Add exception SC2068 exception for confluent_client/confluent_env.sh as this is intended.
SC2068 (error): Double quote array expansions to avoid re-splitting elements.
2026-07-13 05:34:12 +02:00
Markus Hilger 2f006e507f Add net.extra_settings for passthrough network settings
Allow arbitrary per-connection network settings, such as static routes
or a firewalld zone, to be specified as semicolon-delimited key=value
pairs on a net.*.extra_settings attribute. The keys are passed through
to the network backend of the deployed OS in its native syntax: nmcli
properties on NetworkManager systems, netplan YAML paths on netplan
systems, and ifcfg variables on wicked systems.
2026-07-11 20:46:46 +02:00
Jarrod Johnson 263953fc1e Remove nuisance autoncons output when empty
If no serial console detected, don't bother mentioning it.
2026-07-09 14:22:12 -04:00
Jarrod Johnson 5f34fac2bc confluent_nodename variable might not survive to imageboot
Pull it from the confluent.info file.
2026-07-09 14:13:12 -04:00
Jarrod Johnson 0a14e019d0 Skip suse16 diskless for now 2026-07-09 10:47:55 -04:00
Markus Hilger dba2af71c7 Match Apache-2.0 license name with SPDX expressions
For EPEL the official SPDX license expressions have to be used.
Check:

- https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
- https://spdx.org/licenses/
- https://docs.fedoraproject.org/en-US/legal/allowed-licenses/
2026-07-07 21:08:43 +02:00
Jarrod Johnson 1feec98edf Ensure install interface comes up in firstboot 2026-07-02 17:51:56 -04:00
Markus Hilger 7727cd86fc Fix typos in help text, errors, and log messages 2026-07-02 22:07:27 +02:00
Jarrod Johnson f6d7a47140 Successfully indicate install_url and TLS setup
While curl and agama download are happy with the CA bundle, zypper was not.  Have pre.sh properly set up the CA certs.

Additionally, indicate the install subdirectory of the repository to agama via it's cmdline conf.
2026-07-02 14:57:26 -04:00