]> git.proxmox.com Git - pve-installer.git/log
pve-installer.git
6 weeks agodrop glob helper and tests
Wolfgang Bumiller [Mon, 22 Apr 2024 09:19:47 +0000 (11:19 +0200)]
drop glob helper and tests

The tests weren't testing our code, but the glob crate itself, which
is not really our job...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agocleanup unnecessary clones
Wolfgang Bumiller [Mon, 22 Apr 2024 08:06:43 +0000 (10:06 +0200)]
cleanup unnecessary clones

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agosimplify some code
Wolfgang Bumiller [Tue, 23 Apr 2024 07:51:23 +0000 (09:51 +0200)]
simplify some code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agodowngrade internal doc comment to regular comment
Wolfgang Bumiller [Mon, 22 Apr 2024 07:52:07 +0000 (09:52 +0200)]
downgrade internal doc comment to regular comment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agouse qr// for regex variable
Wolfgang Bumiller [Mon, 22 Apr 2024 07:45:40 +0000 (09:45 +0200)]
use qr// for regex variable

and don't wrap it within `m//` when using it...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agoless strict regex for matching udev env variables
Wolfgang Bumiller [Mon, 22 Apr 2024 07:42:43 +0000 (09:42 +0200)]
less strict regex for matching udev env variables

looking through /usr/lib/udev/rules.d there are at least some which
also have digits (eg. `IEEE1394_...`), so let's just match [^=]+ for
the variable name.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agobump resolver to 2
Wolfgang Bumiller [Tue, 23 Apr 2024 08:02:04 +0000 (10:02 +0200)]
bump resolver to 2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 weeks agorename .cargo/config to .cargo/config.toml
Wolfgang Bumiller [Tue, 23 Apr 2024 08:00:39 +0000 (10:00 +0200)]
rename .cargo/config to .cargo/config.toml

as the old name is deprecated and newer rust compilers warn about it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agoauto-installer: move `system.root_ssh_keys` option to `global` section
Christoph Heiss [Mon, 22 Apr 2024 17:47:37 +0000 (19:47 +0200)]
auto-installer: move `system.root_ssh_keys` option to `global` section

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
7 weeks agoauto-installer: rename `global.password` option to `global.root_password`
Christoph Heiss [Mon, 22 Apr 2024 17:47:36 +0000 (19:47 +0200)]
auto-installer: rename `global.password` option to `global.root_password`

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
7 weeks agogitignore: sort and ignore package build-directory
Thomas Lamprecht [Mon, 22 Apr 2024 15:56:44 +0000 (17:56 +0200)]
gitignore: sort and ignore package build-directory

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agobump version to 8.2.1
Thomas Lamprecht [Mon, 22 Apr 2024 15:51:34 +0000 (17:51 +0200)]
bump version to 8.2.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agod/control: recommend xorriso for assistant package
Thomas Lamprecht [Mon, 22 Apr 2024 15:49:39 +0000 (17:49 +0200)]
d/control: recommend xorriso for assistant package

Not all commands require it, so do not make it a hard-dependency, but
a recommend fits quite well here.

Reported-by: Mira Limbeck <mira.limbeck@gmail.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoassistant: prepare iso: avoid an useless intermediate copy of the answer file
Thomas Lamprecht [Mon, 22 Apr 2024 14:48:39 +0000 (16:48 +0200)]
assistant: prepare iso: avoid an useless intermediate copy of the answer file

This fixes a bug for the case where the answer file was named
"answer.toml", as then the code tried to copy the file to itself,
which just caused the file being truncated.

This was quite confusing for the user, as the validation of the answer
file happened before the copy step, so one would see that it got
correctly validated only to then turn up empty inside the ISO..

While this was introduced through a14a934 ("assistant: perpare-iso
avoid separate directory and make less verbose"), copying the answer
file before injecting it into the ISO was never required, so just use
the source file directly.

Note that this is still a bit racy w.r.t. validation and inserting
into the ISO, to fix that we'd need to pass around empty files or
write the content directly, both not worth it for now.

Fixes: a14a934
Reported-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: use new `lvm_auto_rename` option to avoid prompt
Christoph Heiss [Mon, 22 Apr 2024 12:46:43 +0000 (14:46 +0200)]
auto-installer: use new `lvm_auto_rename` option to avoid prompt

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
7 weeks agolow-level install: add option to automatically rename LVM volumes
Christoph Heiss [Mon, 22 Apr 2024 12:46:42 +0000 (14:46 +0200)]
low-level install: add option to automatically rename LVM volumes

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
7 weeks agobump version to 8.2.0
Thomas Lamprecht [Thu, 18 Apr 2024 20:37:07 +0000 (22:37 +0200)]
bump version to 8.2.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoadd fixme comment to move ssh-key setup over to installer
Thomas Lamprecht [Mon, 22 Apr 2024 12:31:31 +0000 (14:31 +0200)]
add fixme comment to move ssh-key setup over to installer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: handle auto-reboot info messages directly
Christoph Heiss [Mon, 22 Apr 2024 12:11:07 +0000 (14:11 +0200)]
auto-installer: handle auto-reboot info messages directly

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: add new `system.root_ssh_keys` answer option
Christoph Heiss [Mon, 22 Apr 2024 12:11:06 +0000 (14:11 +0200)]
auto-installer: add new `system.root_ssh_keys` answer option

.. for declaratively adding SSH keys to the installed system. This is a
list of SSH public keys added to `/root/.ssh/authorized_keys` after the
installation has finished.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto install: rename network config source
Thomas Lamprecht [Mon, 22 Apr 2024 06:12:07 +0000 (08:12 +0200)]
auto install: rename network config source

A use_dhcp boolean implies that the network config is set to always
use DHCP, not that the installer uses the info that it got from DHCP
to write out a static network config.

Use a source field that allows to cleanly separate the two possible
options.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto install: drop post/pre command execution for now
Thomas Lamprecht [Mon, 22 Apr 2024 06:00:58 +0000 (08:00 +0200)]
auto install: drop post/pre command execution for now

This can be quite a bit dangerous w.r.t. prepared ISOs as attack
vector or copy cats, we rather should implement the common use cases,
like adding a SSH auth key, as explicit, declarative defined config
option.

Such a overly general command execution might be something to add at a
later stage, but not for the initial MVP.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoassistant: improve check if xorriso is installed
Thomas Lamprecht [Fri, 19 Apr 2024 17:20:03 +0000 (19:20 +0200)]
assistant: improve check if xorriso is installed

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoassistant: rename identifiers command to system-info
Thomas Lamprecht [Fri, 19 Apr 2024 16:33:15 +0000 (18:33 +0200)]
assistant: rename identifiers command to system-info

better fits to what it does and to the device-info sibling command.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoassistant: rustify getting sysinfo
Thomas Lamprecht [Fri, 19 Apr 2024 16:33:02 +0000 (18:33 +0200)]
assistant: rustify getting sysinfo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoprint paths directly with debug, not display
Thomas Lamprecht [Fri, 19 Apr 2024 16:06:14 +0000 (18:06 +0200)]
print paths directly with debug, not display

A debug print is not only shorter code but also quotes the path
correctly, making it nicer for the user to copy (e.g., if the path is
at the end of a sentence the trailing dot could be misinterpreted as
being part of the path otherwise)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoassistant: perpare-iso avoid separate directory and make less verbose
Thomas Lamprecht [Fri, 19 Apr 2024 15:52:34 +0000 (17:52 +0200)]
assistant: perpare-iso avoid separate directory and make less verbose

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch answers: rename partition search label
Thomas Lamprecht [Fri, 19 Apr 2024 13:14:27 +0000 (15:14 +0200)]
fetch answers: rename partition search label

The new one is far from perfect either, but labels can be at max 16
characters, so that's what we have to work with.

It now is slightly easier to read due to the hyphen separation and
contains the following relevant info:
- proxmox spelled out in full, so anybody seeing that label has a good
  chance to narrow down what it could do already by a lot
- inst is a bit cryptic, but that Proxmox has a installer is a easy to
  find out fact
- src should hopefully relay that this is the source of
  (configuration) for something related to a installer by proxmox

But yeah, please don't limit IDs or names to less than 32, ideally
even 64, characters, that's the bare minimum to get some expressive
names that can have actual meaning..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch answers: avoid utils module
Thomas Lamprecht [Fri, 19 Apr 2024 12:52:33 +0000 (14:52 +0200)]
fetch answers: avoid utils module

utils/helpers/tools are all modules with a way to generic name and
will be misused as dumping ground for basically everything.

Just move the helper to where they are used and drop some bogus
methods like get_answer_file, which neither searches nor gets an
answer file (type) but just is a plain and slightly over engineered
std::fs::read_to_string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch answers: name DHCP options more explicit
Thomas Lamprecht [Fri, 19 Apr 2024 12:51:57 +0000 (14:51 +0200)]
fetch answers: name DHCP options more explicit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto installer: rework sys-info struct layout and add more details
Thomas Lamprecht [Fri, 19 Apr 2024 12:20:16 +0000 (14:20 +0200)]
auto installer: rework sys-info struct layout and add more details

move the decoded DMI info into a "dmi" object to avoid crowding the
outer layer, add more info from the ISO and Product currently booted
and use the complete mocked variants for the assistant environments so
that users evaluating this have a full picture of possible keys.

Also include the NIC link name with the mach address so that one can
also configure the management interface correctly from a MAC.

Do this all in a slightly more ergonomic rust way, using separate
structs and impls for getting the info.

There could be even more details added, but that's for a future patch,
this one mostly transforms and enhances existing keys.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: add mocked variants for setup and ISO related info structs
Thomas Lamprecht [Fri, 19 Apr 2024 12:17:52 +0000 (14:17 +0200)]
common: add mocked variants for setup and ISO related info structs

and add necessary derives for debug and serialize so that we can use
this for the auto-installer HTTP payload that gets send to the client
to be able to determine a dynamic answer file.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agounconfigured: accept more telling boot cmdline option names
Thomas Lamprecht [Fri, 19 Apr 2024 11:05:32 +0000 (13:05 +0200)]
unconfigured: accept more telling boot cmdline option names

as alternative accept more telling names too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agounconfigured: rename auto-installer mode variable for clarity
Thomas Lamprecht [Fri, 19 Apr 2024 11:04:05 +0000 (13:04 +0200)]
unconfigured: rename auto-installer mode variable for clarity

the others are rather bad too, but proxauto is a bit less telling than
these, and no need to keep our existing (bad) style for new stuff.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto installer: make fetch print answer to stdout and explicitly run installer
Thomas Lamprecht [Fri, 19 Apr 2024 10:59:13 +0000 (12:59 +0200)]
auto installer: make fetch  print answer to stdout and explicitly run installer

Instead of executing the actual installer from inside a tool named
`fetch-answer` make it print the answer file content it queried to
stdout and use the outer "unconfigured" init process to redirect this
to a file inside run, which is then piped to the actual installer in a
separate command.

This makes the execution flow a bit easier to grasp when reading
unconfigured and allows to inspect the answer file in a debug session.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto installer: log: implement flush
Thomas Lamprecht [Fri, 19 Apr 2024 10:21:59 +0000 (12:21 +0200)]
auto installer: log: implement flush

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon installer: drop spurious println in FsType serializer
Thomas Lamprecht [Fri, 19 Apr 2024 10:13:32 +0000 (12:13 +0200)]
common installer: drop spurious println in FsType serializer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto installer: log: print to stderr and include level
Thomas Lamprecht [Fri, 19 Apr 2024 10:07:00 +0000 (12:07 +0200)]
auto installer: log: print to stderr and include level

and use the write! macro to write to the log file to avoid an
intermediate buffer.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agotree-wide: cargo fmt
Thomas Lamprecht [Fri, 19 Apr 2024 09:54:56 +0000 (11:54 +0200)]
tree-wide: cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto install: fine tune flag/config file names on ISO
Thomas Lamprecht [Fri, 19 Apr 2024 07:47:50 +0000 (09:47 +0200)]
auto install: fine tune flag/config file names on ISO

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agosplit out assistant CLI tool into own debian package
Thomas Lamprecht [Thu, 18 Apr 2024 18:54:37 +0000 (20:54 +0200)]
split out assistant CLI tool into own debian package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agorename proxmox-autoinst-helper to proxmox-auto-install-assistant
Thomas Lamprecht [Thu, 18 Apr 2024 18:10:37 +0000 (20:10 +0200)]
rename proxmox-autoinst-helper to proxmox-auto-install-assistant

stay on the verbose side

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoautoinst-helper: add prepare-iso subcommand
Aaron Lauterer [Thu, 18 Apr 2024 11:38:41 +0000 (13:38 +0200)]
autoinst-helper: add prepare-iso subcommand

This new subcommand makes it possible to prepare an ISO to use it for an
automated installation.

It is possible to control the behavior of the resulting automated ISO
with optional parameters.
If no target file is specified, the new ISO will be named with suffixes
to indicate it as automated and additional information. This should help
to distinct between the different options that were chosen to create it.

The code for parsing an answer file is moved to its own function.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch-answer: dpcp: improve logging of steps taken
Aaron Lauterer [Wed, 17 Apr 2024 12:31:07 +0000 (14:31 +0200)]
fetch-answer: dpcp: improve logging of steps taken

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch-answer: use ISO specified configurations
Aaron Lauterer [Wed, 17 Apr 2024 12:31:06 +0000 (14:31 +0200)]
fetch-answer: use ISO specified configurations

This patch switches the behavior to use the settings that can be
specified in the ISO.

This means, that it is possible to control how the answer file should be
fetched:

* auto - as usually, go through the options until one works (partition,
  http)
* included - the answer file is included in the ISO
* partition - only check for an answer file in a partition called
  'proxmoxinst' in lower or uppercase
* http - only fetch the answer file via an HTTP POST request.

Additionally it is possible to specify the HTTP URL directly in the ISO.

Placing the SSL fingerprint on a partition is not possible anymore. If
one wants to provide it right away (besides DHCP or DNS), it must be
incluced in the ISO itself. This reduced the need for another USB flash
drive.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: utils: define ISO specified settings
Aaron Lauterer [Wed, 17 Apr 2024 12:31:05 +0000 (14:31 +0200)]
auto-installer: utils: define ISO specified settings

These will be expected on the ISO itself and define the behavior of the
automated installation.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agofetch-answer: move get_answer_file to utils
Aaron Lauterer [Wed, 17 Apr 2024 12:31:04 +0000 (14:31 +0200)]
fetch-answer: move get_answer_file to utils

and switch to accepting the full path to the answer file. This makes it
possible to use it in more situations than just the partition case.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agod/control: add missing iproute2 and librust-nix (build) dependencies
Thomas Lamprecht [Thu, 18 Apr 2024 14:43:00 +0000 (16:43 +0200)]
d/control: add missing iproute2 and librust-nix (build) dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoadd proxmox-chroot utility
Aaron Lauterer [Wed, 17 Apr 2024 12:31:02 +0000 (14:31 +0200)]
add proxmox-chroot utility

it is meant as a helper utility to prepare an installation for chroot
and clean up afterwards

It tries to determine the used FS from the previous installation, will
do what is necessary to mount/import the root FS to /target. It then
will set up all bind mounts.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agounconfigured: add proxauto as option to start auto installer
Aaron Lauterer [Wed, 17 Apr 2024 12:30:48 +0000 (14:30 +0200)]
unconfigured: add proxauto as option to start auto installer

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: skip target_hd when deserializing InstallConfig
Aaron Lauterer [Wed, 17 Apr 2024 12:31:01 +0000 (14:31 +0200)]
common: skip target_hd when deserializing InstallConfig

as only the 'path' property is serialized -> deserialization is
problematic. The information would be present in the 'run-env-info-json',
but for now there is no need for it in any code that deserializes the
low-level config. Therefore we are currently skipping it on
deserialization

If we need it in the future, we need to think about how to handle the
deserialization.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocontrol: update build depends for auto installer
Aaron Lauterer [Wed, 17 Apr 2024 12:30:57 +0000 (14:30 +0200)]
control: update build depends for auto installer

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: fix dependencies feature/version and indentation ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
d/control: explicitly depend on rust crate features and minimum version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: answer: deny unknown fields
Aaron Lauterer [Wed, 17 Apr 2024 12:31:03 +0000 (14:31 +0200)]
auto-installer: answer: deny unknown fields

This way, serde will throw errors if fields are not known.

This can help to reduce frustration if one might think to have set an
option, but for example a small type has happened.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto installer: factor out fetch-answer and autoinst-helper
Aaron Lauterer [Wed, 17 Apr 2024 12:30:58 +0000 (14:30 +0200)]
auto installer: factor out fetch-answer and autoinst-helper

Putting proxmox-fetch-answer into it's own crate, will keep the use of
OpenSSL localized to where we need it. Otherwise building other binaries
will always depend on OpenSSL as well, even without actually needing it.

Having a dedicated crate for the proxmox-autoinst-helper should make it
easier to build it independently to have it available outside of the
install environment.

The fetch plugins have been moved to the proxmox-fetch-answer crate,
except for the 'get_nic_list' function and 'sysinfo.rs'. Since both are
also needed by the proxmox-autoinst-helper, they are kept in the
proxmox-auto-installer crate.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: fetch: add http plugin to fetch answer
Aaron Lauterer [Wed, 17 Apr 2024 12:30:55 +0000 (14:30 +0200)]
auto-installer: fetch: add http plugin to fetch answer

This plugin will send a HTTP POST request with identifying sysinfo to
fetch an answer file. The provided sysinfo can be used to identify the
system and generate a matching answer file on demand.

The URL to send the request to, can be defined in two ways. Via a custom
DHCP option or a TXT record on a predefined subdomain, relative to the
search domain received via DHCP.

Additionally it is possible to specify a SHA256 SSL fingerprint. This
can be useful if a self-signed certificate is used or the URL is using
an IP address instead of an FQDN. Even with a trusted cert, it can be
used to pin this specific certificate.

The certificate fingerprint can either be placed on the `proxmoxinst`
partition and needs to be called `cert_fingerprint.txt`, or it can be
provided in a second custom DHCP option or a TXT record.
If no fingerprint is provided, we switch rustls to native-certs and
native-tls.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: helper: add subcommand to view indentifiers
Aaron Lauterer [Wed, 17 Apr 2024 12:30:54 +0000 (14:30 +0200)]
auto-installer: helper: add subcommand to view indentifiers

It will collect the information from the current system and show the
payload of identifiers that will be send.

To avoid confusion, the subcommands for the device info and filter
matching have been renamed.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: fetch: add gathering of system identifiers and restructure code
Aaron Lauterer [Wed, 17 Apr 2024 12:30:53 +0000 (14:30 +0200)]
auto-installer: fetch: add gathering of system identifiers and restructure code

They will be used as payload when POSTing a request for an answer file. The
idea is, that with this information, it should be possible to identify
the system and generate a matching answer file on the fly.
Many of these properties can also be found on the machine or packaging
of the machine and could therefore be scanned into a database.

Identifiers are the following properties from `dmidecode` sections 1, 2,
and 3:
* Asset Tag
* Product Name
* Serial Number
* SKU Number
* UUID

As well as a list of the MAC addresses of all the NICs and the product
type: pve, pmg, pbs.

Since we now have more than a simple utils.rs module in the fetch
plugins, it, and the additional fetch plugin utilities are placed in
their own directory.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: add Display trait to ProxmoxProduct
Aaron Lauterer [Wed, 17 Apr 2024 12:30:52 +0000 (14:30 +0200)]
common: add Display trait to ProxmoxProduct

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: add proxmox-autoinst-helper tool
Aaron Lauterer [Wed, 17 Apr 2024 12:30:51 +0000 (14:30 +0200)]
auto-installer: add proxmox-autoinst-helper tool

It can parse an answer file to check against syntax errors, test match
filters against the current hardware and list properties of the current
hardware to match against.

Since this tool should be able to run outside of the installer
environment, it does not rely on the device information provided by the
low-level installer. It instead fetches the list of disks and NICs by
itself.
The rules when a device is ignored, should match how the low-level
installer handles it.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: add tests for answer file parsing
Aaron Lauterer [Wed, 17 Apr 2024 12:30:45 +0000 (14:30 +0200)]
auto-installer: add tests for answer file parsing

By matching the resulting json to be passed to the low level installer
against known good ones.

The environment info was gathered from one of our AMD Epyc Rome test
servers to have a realistic starting point.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: add fetch answer binary
Aaron Lauterer [Wed, 17 Apr 2024 12:30:47 +0000 (14:30 +0200)]
auto-installer: add fetch answer binary

it is supposed to be run first and fetch an answer file.

The initial implementation searches for a partition/filesystem called
'proxmoxinst' or 'PROXMOXINST' with an 'answer.toml' file in the root
directory.

Once it has an answer file, it will call the 'proxmox-auto-installer'
and pipe in the contents via stdin.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoauto-installer: add auto-installer binary
Aaron Lauterer [Wed, 17 Apr 2024 12:30:46 +0000 (14:30 +0200)]
auto-installer: add auto-installer binary

It expects the contents of an answer file via stdin. It will then be
parsed and the JSON for the low level installer is generated.

It then calls the low level installer directly.
The output of the installaton progress is kept rather simple for now.

If configured in the answer file, commands will be run pre and post the
low level installer.

It also logs everything to the logfile, currently
'/tmp/auto_installer.log'.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agoadd auto-installer crate
Aaron Lauterer [Wed, 17 Apr 2024 12:30:39 +0000 (14:30 +0200)]
add auto-installer crate

The new auto-installer is intended for unattended installations and
should be especially helpful for users with frequent and/or big
installations.

The main idea is that a answer file is provided by some mechanism,
e.g., on the ISO itself, on a separate (USB pen drive) partition, or
the network, which holds a somewhat generic config in form of a TOML
file that also supports wildcard glob'ing for selecting, e.g., target
disks for flexibility.

This is a initial implementation that will be improved and extended
over the next commits.

The installation config is currently generated through a dedicated
function (parse_answer) instead of a From implementation. This is
because for now the source data is spread over several other structs
in comparison to one in the TUI installer.

Logging is done to both stdout and a dedicated log file.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ TL: Squash initial "build-up" patches ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agolow-level: add dump-udev command
Aaron Lauterer [Wed, 17 Apr 2024 12:30:38 +0000 (14:30 +0200)]
low-level: add dump-udev command

Fetches UDEV device properties prepended with 'E:' for NICs and disks.
The result is stored in its own JSON file.

This information is needed to filter for specific devices. Mainly for
the auto-installer for now.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 [ TL: rework Udev module to avoid external dependencies, keep those
   in the Sys modules ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: add deserializer for CidrAddress and filesystem types
Aaron Lauterer [Wed, 17 Apr 2024 12:30:36 +0000 (14:30 +0200)]
common: add deserializer for CidrAddress and filesystem types

For the Enums that will be used to deserialize an answer file.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: tui: use BTreeMap for predictable ordering
Aaron Lauterer [Wed, 17 Apr 2024 12:30:35 +0000 (14:30 +0200)]
common: tui: use BTreeMap for predictable ordering

necessary for the disk selection and network interfaces maps to have
tests with results that can be compared without much additional effort.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agocommon: make InstallZfsOption members public
Aaron Lauterer [Wed, 17 Apr 2024 12:30:34 +0000 (14:30 +0200)]
common: make InstallZfsOption members public

as they will be used directly by the auto installer

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agotui: common: move InstallConfig struct to common crate
Aaron Lauterer [Wed, 17 Apr 2024 12:30:33 +0000 (14:30 +0200)]
tui: common: move InstallConfig struct to common crate

It describes the data structure expected by the low-level-installer.
We do this so we can use it in more than the TUI installer, for example
the planned auto installer.

Make the members public so we can easily implement a custom From method
for each dependent crate.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agolow-level: write final installation config to /tmp
Aaron Lauterer [Wed, 17 Apr 2024 12:30:59 +0000 (14:30 +0200)]
low-level: write final installation config to /tmp

This helps to know how the system was set up in steps after the
installation. For example in debug mode or when using post commands in
the automatic/unattended installation.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agod/source: mark as native package
Thomas Lamprecht [Thu, 18 Apr 2024 18:51:52 +0000 (20:51 +0200)]
d/source: mark as native package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agodrop outdated debian package install files
Thomas Lamprecht [Thu, 18 Apr 2024 18:50:33 +0000 (20:50 +0200)]
drop outdated debian package install files

These are unused since our unification into one installer package

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 weeks agosys/net: drop module path from local FQDN regex variable
Thomas Lamprecht [Thu, 18 Apr 2024 16:12:05 +0000 (18:12 +0200)]
sys/net: drop module path from local FQDN regex variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agorun env: use default error message if country detection failed with empty string
Christoph Heiss [Tue, 26 Mar 2024 13:29:19 +0000 (14:29 +0100)]
run env: use default error message if country detection failed with empty string

Bit of perl fun again.
$err from detect_country_tracing_to() can be empty string under certain
circumstances (according to a forum post [0]). The // operator
evaluates an empty as true, thus `warn` receives an empty string to and
just prints

  Warning: something wrong at /usr/share/perl5/proxmox/Install/RunEnv.pm line 305

Which isn't particular helpful. Use the || operator instead, that
evaluates an empty string as false and thus would fall back to the
generic error message.

A minimal reproducer/example for completeness sake:

  #!/usr/bin/env perl
  use strict;
  use warnings;

  warn ('' // "unable to detect country\n");
  warn ('' || "unable to detect country\n");

gives

  Warning: something's wrong at ./test.pl line 5.
  unable to detect country

[0] https://forum.proxmox.com/threads/blank-screen-while-installing.143928/

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 months agohtml: pbs: fix missing <br> in template after feature list
Christoph Heiss [Wed, 3 Apr 2024 10:45:14 +0000 (12:45 +0200)]
html: pbs: fix missing <br> in template after feature list

This adds an empty line between the feature list and the "more
information" paragraph, which looks a lot better.

The exact same is already present in the HTML template for both other
products, probably a simple oversight.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 months agobuild: run shellcheck as part of `test` step
Christoph Heiss [Fri, 15 Mar 2024 10:23:45 +0000 (11:23 +0100)]
build: run shellcheck as part of `test` step

Especially unconfigured.sh is worth checking consistently.

Running shellcheck also does not really have any notable impact on build
time, so no downside there either.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2 months agounconfigured: move terminal size setting before starting debug shell
Christoph Heiss [Tue, 12 Mar 2024 11:59:12 +0000 (12:59 +0100)]
unconfigured: move terminal size setting before starting debug shell

Otherwise, when using the serial debug shell, the console size will be
0x0. This in turn breaks the TUI installer, as it cannot detect the
size properly.

It also adjust the size to the proper 80x24 instead of 80x25, as
advertised in the log message.

As while for VGA 80x25 is the standard size [0], for serial consoles
aka.  VT10x emulated terminals it is actually 80x24 [1], which
basically everything uses as reference. GRUB also uses 80x24 when used
over a serial interface. It spits out 24 lines at least.

[0] https://www.kernel.org/doc/Documentation/svga.txt (`NORMAL_VGA`)
[1] https://vt100.net/dec/ek-vt100-tm-002.pdf (page 21, "Format")

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: include further references about size from discussion ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobump version to 8.1.12
Thomas Lamprecht [Wed, 28 Feb 2024 15:07:12 +0000 (16:07 +0100)]
bump version to 8.1.12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agoinstallation: pmg: handle clamav-clamonacc.service being already disabled
Thomas Lamprecht [Wed, 28 Feb 2024 15:06:09 +0000 (16:06 +0100)]
installation: pmg: handle clamav-clamonacc.service being already disabled

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobump version to 8.1.11
Thomas Lamprecht [Wed, 28 Feb 2024 14:29:27 +0000 (15:29 +0100)]
bump version to 8.1.11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agotui: install_progress: write low-level non-JSON messages to separate file
Christoph Heiss [Mon, 26 Feb 2024 14:18:38 +0000 (15:18 +0100)]
tui: install_progress: write low-level non-JSON messages to separate file

The low-level installer prints quite a few messages during the install
to its stdout which are not JSON-formatted and thus parseable.

Thus catch them early and write them to `/tmp/install-low-level.log`, to
avoid polluting the log tty at /dev/tty2 with mostly useless parse
errors.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agoinstall: zfs: fix setting compression to 'off'
Christoph Heiss [Tue, 27 Feb 2024 09:17:38 +0000 (10:17 +0100)]
install: zfs: fix setting compression to 'off'

The default for the `compression` property in ZFS got changed ~2 years
ago by

    56fa4aa96 ("Default to ON for compression") [0]

Support for setting this option originally got introduced into the
installer in 2016 by

    c7779156 ("refactor disk setup, add advanced ZFS options") [1]

where the default of 'off' was still correct.

As the installer only set the property if it was *not* explicitly set
to 'on', this actually regressed in the meantime.

Thus just remove the conditional all together, as the definedness-check
did not have any impact anyway (since $value gets set to 'on'
regardless) and the latter just causes regressions like this one.

Tested by installing once w/o the patch to confirm the report and once
with the patch applied, checking `zfs get compression` on the freshly
installed system.

[0] https://github.com/openzfs/zfs/commit/56fa4aa96eb3875f254e93eaef646ea20ba187f9
[1] https://git.proxmox.com/?p=pve-installer.git;a=commit;h=c7779156db5c38cf184e143de0cab534bd0a9cb1

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agogtk: FQDN parsing: fix fallback from error to generic message
Thomas Lamprecht [Tue, 27 Feb 2024 09:36:55 +0000 (10:36 +0100)]
gtk: FQDN parsing: fix fallback from error to generic message

$@ is an empty string here, so we need to use a logical or operator,
not the definedness one, i.e., just like the if-branch condition
itself.

Reported-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobump version to 8.1.10
Thomas Lamprecht [Mon, 26 Feb 2024 19:51:07 +0000 (20:51 +0100)]
bump version to 8.1.10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agosys/command: double wait frequency and send SIGKILL once after 0.5s
Thomas Lamprecht [Mon, 26 Feb 2024 19:40:14 +0000 (20:40 +0100)]
sys/command: double wait frequency and send SIGKILL once after 0.5s

100 ms is quite plenty, while we would be better of using a event
based wait, i.e., dropping the WNOHANG, that would also mean handling
the time out via alarm, EINTR checking and quite a bit other stuff
making this more convoluted, so for now just go faster..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agosys: command: wait for process exit with sub-second granularity
Christoph Heiss [Mon, 26 Feb 2024 16:50:43 +0000 (17:50 +0100)]
sys: command: wait for process exit with sub-second granularity

Using full seconds as a granularity for sleeping between waitpid()'s is
way too much and unnecessarily slows down the installation a lot. Most
processes take a few moments after closing their stdin/stdout to
actually exit fully, which means that we would sleep a second in most
cases.

Lower it to 0.1 second, which immensely improves the situation.

Some values for comparison; tui-installer on the same bog-standard
2-core, SeaBIOS, ext4, virtio VM (roughly averaged over multiple runs):

  * 8.0 ISO (baseline): ~2:30 min
  * w/o patch: ~9:00 min
  * w/  patch: ~2:30 min

Values measured are from pressing the 'Install' button until the
autoreboot dialog (aka. install finished) popped up.

Fixes: 152bbef ("sys: command: factor out kill() + waitpid() from run_command()")
Reported-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Reported-by: Filip Schauer <f.schauer@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agobump version to 8.1.9
Thomas Lamprecht [Mon, 26 Feb 2024 14:11:49 +0000 (15:11 +0100)]
bump version to 8.1.9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agorun command: use explicit return undef in closures on call sites
Thomas Lamprecht [Mon, 26 Feb 2024 13:38:11 +0000 (14:38 +0100)]
run command: use explicit return undef in closures on call sites

To avoid a misinterpretation of the auto-return value:

> In the absence of an explicit return, a subroutine, eval, or do FILE
> automatically returns the value of the last expression evaluated.
-- https://perldoc.perl.org/functions/return

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agorun command: avoid using 1 as special value
Thomas Lamprecht [Mon, 26 Feb 2024 13:34:09 +0000 (14:34 +0100)]
run command: avoid using 1 as special value

In Perl, the last expression of a block (e.g. of a method, eval) gets
returned if there's no explicit return statement. Quite often that is
truthy, i.e., 1.

As that was chosen as the special value for the CMD_FINISHED flag it
had quite a few false positives, causing weird effects and
installation failure.

Reserve that overly problematic value and chose 2 as new CMD_FINISHED
value, albeit it could be better to signal this even more explicitly,
like with a structured hash reference, but for now this is a good stop
gap.

Fixes: 23c5fbe ("sys: command: allow terminating the process early from log subroutine")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobump version to 8.1.8
Thomas Lamprecht [Sat, 24 Feb 2024 15:30:12 +0000 (16:30 +0100)]
bump version to 8.1.8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agotests: code-style and error handling fixes for ui2stdio
Thomas Lamprecht [Sat, 24 Feb 2024 17:17:10 +0000 (18:17 +0100)]
tests: code-style and error handling fixes for ui2stdio

use modern calling style, avoid duplicate use of Test::More module,
handle fork error more visible, handle pipe creation errors and do
that all in one commit as it's just a test and I don't care.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agotui: install progress: add tests for UI^2 stdio protocol
Christoph Heiss [Wed, 6 Dec 2023 11:34:55 +0000 (12:34 +0100)]
tui: install progress: add tests for UI^2 stdio protocol

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agobuildsys: setup proper test environment for testsuite
Christoph Heiss [Wed, 6 Dec 2023 11:34:54 +0000 (12:34 +0100)]
buildsys: setup proper test environment for testsuite

Some test to come will need a proper environment.

`prepare-test-env` can also be generally useful while developing to
quickly set up a new test environment as needed.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agotest: add tests for UI^2 stdio protocol
Christoph Heiss [Wed, 6 Dec 2023 11:34:53 +0000 (12:34 +0100)]
test: add tests for UI^2 stdio protocol

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agostdio connected UI: drop perl prototype definitions
Thomas Lamprecht [Sat, 24 Feb 2024 16:56:26 +0000 (17:56 +0100)]
stdio connected UI: drop perl prototype definitions

The prototypes where completely circumvented by calling those two
methods by reference via &, and that probably happened as the send_msg
one was just wrong, it forced scalar context for the second parameter,
while that was a list (or well hash, but the difference there can be
blurry).

Anyhow, prototypes are not always of help, and can be a PITA with
side-effects too, and especially for such small modules it has not
that much use to declare them for privately-scoped methods, so just
drop them and fix the calling style.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agotui, ui: switch over to JSON-based protocol
Christoph Heiss [Wed, 6 Dec 2023 11:34:52 +0000 (12:34 +0100)]
tui, ui: switch over to JSON-based protocol

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agofqdn comparison: make more efficient
Thomas Lamprecht [Fri, 23 Feb 2024 16:22:18 +0000 (17:22 +0100)]
fqdn comparison: make more efficient

Compare lazily to always avoid to vector collections and if one of the
first parts mismatch some lower_case calls.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agofqdn comparison: expand test scope
Thomas Lamprecht [Fri, 23 Feb 2024 16:19:15 +0000 (17:19 +0100)]
fqdn comparison: expand test scope

Add some negative tests to ensure a `return true` (exaggerated)
refactoring won't pass the suite, and add one test where a and b is
the same, just to be sure.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agofix #5230: sys: net: properly escape FQDN regex
Christoph Heiss [Thu, 15 Feb 2024 12:39:38 +0000 (13:39 +0100)]
fix #5230: sys: net: properly escape FQDN regex

Due to interpolation, the \. sequence must be double-escaped.
Previously, this would result in a non-escaped dot, thus matching much
more liberally than it should.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: fix bug # reference in code comments ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agosys: net: do not allow overlong FQDNs as per RFCs and Debian spec
Christoph Heiss [Thu, 15 Feb 2024 12:39:37 +0000 (13:39 +0100)]
sys: net: do not allow overlong FQDNs as per RFCs and Debian spec

Debian limits labels to 63 characters each and the total length to 253
characters [0].

[0] https://manpages.debian.org/stable/manpages/hostname.7.en.html

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
3 months agoproxinstall: avoid open-coding FQDN sanity check
Christoph Heiss [Thu, 15 Feb 2024 12:39:36 +0000 (13:39 +0100)]
proxinstall: avoid open-coding FQDN sanity check

.. by moving it into its own subroutine. Makes the whole thing quite a
bit neater and easier to maintain.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>