and guard it to only run on ceph-using systems (the regular 'inited' check
doesn't work as a guard for this, because it checks for new-style inits
including the dir existing).
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Due to Ceph dropping privileges when running the 'ceph-crash' daemon
[0], it is necessary to allow the daemon to authenticate with its
cluster in a safe manner.
In order to avoid exposing sensitive keyrings or somehow escalating
its privileges again, 'ceph-crash' is therefore provided with its own
keyring in the '/etc/pve/ceph' directory. This directory, due to being
on 'pmxcfs', may be read by members of the 'www-data' group, which
'ceph-crash' is made part of [1].
Expected Configuration
----------------------
1. A keyring file named '/etc/pve/ceph/ceph.client.crash.keyring'
exists
2. A section named 'client.crash' exists in '/etc/pve/ceph.conf'
3. The 'client.crash' section has a key named 'keyring' which
references the keyring file as '/etc/pve/ceph/$cluster.$name.keyring'
4. The 'client.crash' section has *no* key named 'key'
New Clusters
------------
The keyring file is created and the conf file is updated after the first
monitor has been created (when calling `pveceph mon create`).
Existing Clusters
-----------------
A new helper script creates and configures the 'client.crash' keyring in
`postinst`, if:
* Ceph is installed
* Ceph is initialized ('/etc/pve/ceph.conf' and '/etc/pve/ceph' exist)
* Connection to RADOS is successful
If the above conditions are met, the helper script ensures that the
existing configuration matches the expected configuration mentioned
above.
The configuration is not changed if it is already as expected.
The helper script may be called again manually if the `postinst` hook
fails. It is installed to '/usr/share/pve-manager/helpers/pve-init-ceph-crash'.
Existing `client.crash` Key
---------------------------
If a key named 'client.crash' already exists within the cluster, it is
reused and not regenerated.
[0]: https://github.com/ceph/ceph/pull/48713
[1]: https://git.proxmox.com/?p=ceph.git;a=commitdiff;h=f72c698a55905d93e9a0b7b95674616547deba8a
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
This commit adds the '/etc/pve/ceph' directory to our overall expected
Ceph configuration.
This directory is meant to store cluster-wide, non-private
configuration files used by Ceph applications and services that are
executed with lower privileges, such as 'ceph-crash.service'.
The existence of the directory is now also checked for when checking
whether Ceph is configured correctly. This makes it easier for our
other tooling to rely on the directory's existence, reducing the
number of otherwise needless frequent checking.
* For new clusters: `pveceph init` now creates '/etc/pve/ceph' when
called.
* For existing clusters: The 'postinst' hook this commit adds ensures
that '/etc/pve/ceph' is created when updating.
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Based on how we handle this for PBS but without the hidden fields,
which do not really make this simpler, at least not if the logic is
only required on creation due to the field being only editable then.
As example, if the port of the ESXi host would be 8080, one would
enter `192.168.1.2:8080` for an IPv4 address or `[2001:db8::42]:8443`
for an IPv6 one.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Allows to configure a custom broadcast address to use when sending a
wake on lan packet to wake a remote node.
Default behaviour remains to fallback to 255.255.255.255.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Allows to optionally configure a local interface name to which to
bind to when sending a wake on lan packet to wake a remote node.
Default behaviour remains to send the packet via the interface for
the default gateway.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Moves the wakeonlan property to be a property string, with current mac
address as default key. This allows to later add further optional
properties such as bind-interface and broadcast-address.
Adds the `get_wakeonlan_config` helper function to parse the string
when read from the node config.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
handle mapping purely in the change handler for the prepare-for-virtio
checkbox and avoid any such mapping logic in the renderer, while
slightly longer the code is much easier to reason about.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Otherwise changes will persist, e.g., disabling a CDROM drive won't
work if the values got assembled for the "Resulting Config" tab
before. Same for the "Prepare for VirtIO" checkbox, there one got the
disk twice, once as (old) mapped SATA and once as (original) SCSI.
To fix this do not work on a reference of the original VM config, but
rather always copy that to a new object before applying the form
values.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
We switched the storage browser navigation entry to 'Virtual Guests'
recently, but still used the icon for import.
For now switch to use to the one for VMs for this entry, matching the
label, and use the import icon for the "Import" button instead.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Aaron originally designed the new "unique MAC address" checkbox after
this one for alignment reasons [0]. I changed it and argued that's
fine if there is a misalignment between those components [1], which I
still think, but tbh. I also like the boxLabel more for the "Prepare
for VirtIO" checkbox, so lets use it there too and hope all are happy
again.
[0]: https://lists.proxmox.com/pipermail/pve-devel/2024-March/062411.html
[1]: https://lists.proxmox.com/pipermail/pve-devel/2024-March/062412.html
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Mapping to SATA is only one thing it does, and what we actually want
to do is preparing for VirtIO, the effects are implementation detail,
so name it after the reason not one specific step.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
it's popular in VMware ESXi and so should be available to choose
directly, avoiding a invalid model field in the import wizard.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Avoid some global widget config to store internal state, rather use
the existing viewModel for that.
Also avoid unnecessary references and switch to a boxLabel, drop also
the tooltip, as that doesn't add much here where the effect can be
seen in the grid.
Avoid reconfiguring all grids if only the network one can have changed
due to a change of this check box value.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
by adding a new checkbox and render the grid accordingly.
If unique MAC addresses are enabled, set them to undefined when getting
the values from the grid.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
[ TL: also improve if-expression wrapping ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
The Ceph monitor removal assertion contains a condition that checks
whether the given mon ID actually exists and thus may be removed.
The first part of the condition checks whether the hash returned by
`get_services_info` [0] contains the key "mon.$monid". However, the
hash's keys are never prefixed with "mon.", which makes this check
incorrect.
This is fixed by just using "$monid" directly.
The second part checks whether the mon hashes returned by
Ceph contain the "name" key before comparing the key with the given
mon ID. This key existence check is also incorrect; in particular:
* If the lookup `$_->{name}` evaluates to e.g. "foo", the check
passes, because "foo" is truthy. [1]
* If the lookup `$_->{name}` evaluates to "0", the check fails,
because "0" is falsy (due to it being equivalent to the number 0,
according to Perl [1]).
This is solved by using the inbuilt `defined()` instead of relying on
Perl's definition of truthiness.
[0]: https://git.proxmox.com/?p=pve-manager.git;a=blob;f=PVE/Ceph/Services.pm;h=e0f31e8eb6bc9b3777b3d0d548497276efaa5c41;hb=HEAD#l112
[1]: https://perldoc.perl.org/perldata#Scalar-values
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=5198
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
This makes it possible to select any of the IP addresses listed in the
full view window to copy & paste it.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
[ TL: reworked subject ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
To hedge against a scenario where an attacker has local or even
physical access to a computer where a user is logged in.
While that general scenario cannot neither get detected nor really
secured against, at least not without requiring re-authentication on
every API call that can have side-effect (i.e., all but GET method),
it still makes sense to ensure that credentials cannot be modified,
which would allow denial of service.
See the related pve-access-control commit 5bcf553 ("user: password
change: require confirmation-password parameter")
Reported-by: Wouter Arts <security@wth-security.nl>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
While on simple cases the frontend will translate a `.5` to `0.5` the
backend really doesn't care and takes either.
And it seems that editing from an exiting `0.5` to `.75` will often
cause this to submitted as is.
Independent of how such a value comes into the config, it broke parsing
the network rate property in the UI, where we assumed that there's
always a digit on the left side of the floating point separator.
Simply extend the regex to allow parsing those floats that directly
start with a separator too.
Link: https://forum.proxmox.com/threads/143525/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
and add a link to recreate the boot entries in ovmf
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
[ TL: break up String.format to avoid overly long line ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
we have to set it to '__default__' if we didn't get one from the API
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
[ TL: fix-up eslint warning ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
it seems on esxi, most windows vms with uefi are automatically
configured with an lsi scsi controller, which we can't currently support
(ovmf driver issue) so automatically activate the sata mapping + virtio
preparation in this case
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
while most of our 'windiows' ostypes start with 'win' not all of them do
(wxp, wvista), so just shorten the condition to 'starts with `w`', this
covers all our windows ostypes, while not including others.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Fixes#5293 [0]. This happens when no OSDs are created yet and thus the
total space is 0, which leads to a division-by-zero.
Add a simple check if the total space is greater than 0.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=5293
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Use the default value of the field also as start value in the
viewModel, as other wise the two-way binding can cause the empty
string to be set to the field's value, not vice-versa.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
While it was required before commit ca9dce9e8 ("ui: guest import:
rework windows virtio-scsi preparation") to avoid making this crowded,
after that commit we already got the top-padding from the columnT
here, so no need for adding extra padding to that.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
On ESXi one can have at max 768 vCPUs and that over maximal 128
sockets. Further, by default ESXi will favor adding single-cpu
sockets, so if one just enters "give me 8 vCPUs", it will be 8
single-core sockets.
As we only supported up to 4 sockets in the web UI, which caused this
field to show up as invalid on initial load for such VMs, which is not
nice.
Having that many sockets is rather odd, so for us it doesn't make
sense to allow more than the ESXi limit that, but having more vCPUs
might make sense, so allow up to 1024 for that for now.
Note that QEMU and our API backend doesn't really cares, the kernels
NR_MAX_CPU is the limit there. Albeit it is questionable if using more
vCPU threads as there are host threads has some sense in any setup.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>