]> git.proxmox.com Git - pve-common.git/log
pve-common.git
11 months agofix #4778: fix boolean type check for json parameters over the api
Dominik Csapak [Thu, 15 Jun 2023 12:36:43 +0000 (14:36 +0200)]
fix #4778: fix boolean type check for json parameters over the api

if a real json boolean is sent via the api, $value is a
JSON::PP::Boolean here instead of a string/scalar

so we should validate that too

the $value itself can be used normally in conditions like
----
if ($value) {
----

if the value is stringified, the result is either '1' or '0' so even if
we have some explicit checks like that it should not make a problem

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agosyslog: interpret priority level 'warn' correctly
Fiona Ebner [Wed, 14 Jun 2023 13:05:58 +0000 (15:05 +0200)]
syslog: interpret priority level 'warn' correctly

There are some use sites, e.g. HA manager, pvescheduler that
incorrectly use priority level 'warn'. Likely because that is allowed
for some other log helpers in the codebase. Instead of fixing them all
one-by-one, simply allow 'warn' as a priority too.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agoldap: fail authentication if dn is empty
Friedrich Weber [Tue, 13 Jun 2023 13:04:25 +0000 (15:04 +0200)]
ldap: fail authentication if dn is empty

This fixes an issue with LDAP servers that accept anonymous binds with
a non-empty password: If a user exists in the PVE LDAP realm, but PVE
cannot find the corresponding LDAP entry during login, they could log
in with any non-empty password.

This issue affects only LDAP realms. AD realms are not affected
because they perform no username->dn mapping.

At least the following LDAP server configurations seem to accept a
bind with empty DN and non-empty password and are affected:

* OpenLDAP with anonymous binds and the non-default setting
  `olcAllows: bind_anon_cred` enabled.
* AD (when used in an LDAP realm instead of an AD realm). However, for
  the issue to trigger, the LDAP search for the username->dn mapping
  has to succeed but return zero results. This can happen, for
  example, if the LDAP realm has (1) a bind DN set or (2) no bind DN
  set and AD was manually configured to allow anonymous LDAP searches
  for user entries.

The situation that a user exists in the PVE realm but is missing in
the LDAP directory can occur, for example, (1) if the user was created
manually or (2) if the LDAP entry is deleted or the base DN is
changed, but the LDAP realm has not been re-synced with
remove-vanished.

The username->dn mapping is performed by `get_user_dn`, which performs
an LDAP search. If the LDAP search for the user entry succeeds but
returns zero results (e.g. if the entry does not exist), `get_user_dn`
returns undef. Then, `auth_user_dn` is called with $dn being undef and
the user-provided $pw and performs an LDAP simple bind with these
credentials. If $pw is empty, Net::LDAP throws an error, but if it is
non-empty, it performs an LDAP bind with an empty DN and the password
provided by the user. If the LDAP server accepts this bind, the user
is logged in.

To fix this, `auth_user_dn` now dies/returns (depending on the $noerr
parameter) if the dn is falsy, which is the case for undef and the
empty string.

The issue was originally reported by forum user ITKR [0].

[0] https://forum.proxmox.com/threads/128788/

Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
11 months agoread firstline: only map ENOENT to undef, raise error otherwise
Thomas Lamprecht [Tue, 13 Jun 2023 05:12:06 +0000 (07:12 +0200)]
read firstline: only map ENOENT to undef, raise error otherwise

Errors like permission denied or I/O ones should bubble up, otherwise
it might hide serious issues and seemingly continue to work, with a
wrong state or the like.

One could argue that the case for not existent should return undef,
while an empty file should return an empty string, but for that we
might want to check all use-sites first.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 8.0.3
Wolfgang Bumiller [Wed, 7 Jun 2023 11:53:25 +0000 (13:53 +0200)]
bump version to 8.0.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agod/control: break qemu-server <<8.0.1 and geust-common <<5.0.1
Wolfgang Bumiller [Wed, 7 Jun 2023 11:53:20 +0000 (13:53 +0200)]
d/control: break qemu-server <<8.0.1 and geust-common <<5.0.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agoJSONSchema: disable '-alist' format
Dominik Csapak [Tue, 6 Jun 2023 13:08:47 +0000 (15:08 +0200)]
JSONSchema: disable '-alist' format

this should not be needed anymore since we can now use a simple array
in the api instead

Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agosection config: implement array support
Dominik Csapak [Tue, 6 Jun 2023 13:08:46 +0000 (15:08 +0200)]
section config: implement array support

enables section configs in the style of:

----
type: id
    property value
    property value2
    property value3
----

can be combined with property strings

the provided create and update schema just pass through the array type
to the api, so the api call must always contain the complete array

also adds a test case for such array fields

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agobump version to 8.0.2
Wolfgang Bumiller [Wed, 7 Jun 2023 11:12:27 +0000 (13:12 +0200)]
bump version to 8.0.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agoJSONSchema: add support for array parameter in api calls, cli and config
Dominik Csapak [Tue, 6 Jun 2023 13:08:45 +0000 (15:08 +0200)]
JSONSchema: add support for array parameter in api calls, cli and config

a few things were missing for it to work:
* on the cli, we have to get the option as an array if the type is an
  array
* the untainting must be done recursively, otherwise, the regex matching
  converts an array hash into the string 'ARRAY(0x123412341234)'
* JSONSchema::parse_config did not handle array formats specially, but
  we want to allow to specify them multiple time
* the biggest point: in the RESTHandler, to be compatible with the
  current gui behavior, we have to rewrite two parameter types:
  - when the api defines a '-list' format for a string type, but we get
    a list (because of the changes in http-server), we join the list
    with a comma into a string
  - when the api defines an 'array' type, but we get a scalar value,
    wrap the value in an array (because for www-form-urlencoded, you
    cannot send an array with a single value) add tests for this
    behavior, some of which we want to deprecate and remove in the
    future

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agojson schema: improve description of bwlimit parameter
Stefan Hanreich [Wed, 29 Mar 2023 12:34:33 +0000 (14:34 +0200)]
json schema: improve description of bwlimit parameter

This makes the description consistent with the other places that
have bwlimit as a parameter as well.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
11 months agoremove unused SysFSTools::pci_cleanup_mdev_device
Wolfgang Bumiller [Mon, 5 Jun 2023 09:54:51 +0000 (11:54 +0200)]
remove unused SysFSTools::pci_cleanup_mdev_device

its use was dropped with qemu-server 7.2-7 which we already
have a 'Breaks' entry for, so no bump required there

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobump version to 8.0.1
Thomas Lamprecht [Fri, 19 May 2023 12:39:09 +0000 (14:39 +0200)]
bump version to 8.0.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/control: record dependency on libanyevent-perl
Fiona Ebner [Fri, 19 May 2023 09:18:16 +0000 (11:18 +0200)]
d/control: record dependency on libanyevent-perl

It's not just a build-dependency. Noticed during an sbuild of
qemu-server that would fail with, because it couldn't locate the
AnyEvent module used in RESTEnvironment.pm.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
12 months agocli usage: remove extra newlines before descriptions
Thomas Lamprecht [Wed, 17 May 2023 08:23:20 +0000 (10:23 +0200)]
cli usage: remove extra newlines before descriptions

Reduce wasting vertical space for both, the command description and
the property description, just print the respective text at the next
line, with no extra empty line in between.

For better visual command separation color would help more.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agocli handler/formatter: small indendation clean-up
Thomas Lamprecht [Wed, 17 May 2023 07:15:16 +0000 (09:15 +0200)]
cli handler/formatter: small indendation clean-up

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agomakefile: convert to use simple parenthesis
Thomas Lamprecht [Wed, 17 May 2023 06:50:37 +0000 (08:50 +0200)]
makefile: convert to use simple parenthesis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobump version to 8.0.0
Thomas Lamprecht [Mon, 8 May 2023 13:27:33 +0000 (15:27 +0200)]
bump version to 8.0.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: derive upload dist automatically
Thomas Lamprecht [Mon, 8 May 2023 13:26:42 +0000 (15:26 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: cleanup and expand clean target
Thomas Lamprecht [Mon, 8 May 2023 13:26:05 +0000 (15:26 +0200)]
buildsys: cleanup and expand clean target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: add sbuild target for convenience
Thomas Lamprecht [Mon, 8 May 2023 13:26:01 +0000 (15:26 +0200)]
buildsys: add sbuild target for convenience

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: improve DSC generation
Thomas Lamprecht [Mon, 8 May 2023 13:25:40 +0000 (15:25 +0200)]
buildsys: improve DSC generation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/control: raise standards version compliance to 4.6.2
Thomas Lamprecht [Mon, 8 May 2023 13:16:25 +0000 (15:16 +0200)]
d/control: raise standards version compliance to 4.6.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/control: define compat level via build-depends and raise to 13
Thomas Lamprecht [Mon, 8 May 2023 13:13:15 +0000 (15:13 +0200)]
d/control: define compat level via build-depends and raise to 13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobump version to 7.4-1
Thomas Lamprecht [Wed, 26 Apr 2023 10:23:29 +0000 (12:23 +0200)]
bump version to 7.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agocgroup: allow one to set the memory.high CGv2 knob too
Thomas Lamprecht [Mon, 17 Apr 2023 14:16:36 +0000 (16:16 +0200)]
cgroup: allow one to set the memory.high CGv2 knob too

will be used from our current only call site in pve-container.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agoprocfs tools: group and order use statements
Thomas Lamprecht [Mon, 17 Apr 2023 14:15:59 +0000 (16:15 +0200)]
procfs tools: group and order use statements

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agomemory info: add regex anchor to avoid false positives
Thomas Lamprecht [Mon, 17 Apr 2023 14:15:06 +0000 (16:15 +0200)]
memory info: add regex anchor to avoid false positives

if arcstat gets re-ordered or new field that includes 'size' gets
added at the top

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agomemory info: avoid errors if ZFS arc stat cannot be read
Thomas Lamprecht [Mon, 17 Apr 2023 14:14:14 +0000 (16:14 +0200)]
memory info: avoid errors if ZFS arc stat cannot be read

E.g., if used in PMG and running on a kernel without ZFS.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agofix #1454: meminfo: also return arcsize
Matthias Heiserer [Tue, 28 Mar 2023 12:49:26 +0000 (14:49 +0200)]
fix #1454: meminfo: also return arcsize

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
13 months agocert: fix invalid CSR version
Mira Limbeck [Fri, 31 Mar 2023 16:12:24 +0000 (18:12 +0200)]
cert: fix invalid CSR version

According to rfc2986 the only valid version is 0. No newer rfc changed
that.
See section 4.1:
https://www.rfc-editor.org/rfc/rfc2986#section-4.1

Manually verifying the CSR with openssl results in the following error:
```
$ openssl req -in bad.csr -text -noout
Certificate Request:
    Data:
        Version: Unknown (2)
```

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
13 months agofix #4671: use O_DIRECTORY from Fcntl
Wolfgang Bumiller [Tue, 18 Apr 2023 07:27:02 +0000 (09:27 +0200)]
fix #4671: use O_DIRECTORY from Fcntl

on ARM this flag has a different value, let's not hardcode
it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
13 months agorest handler: minimize scope of no-strict-refs exemption
Thomas Lamprecht [Tue, 11 Apr 2023 14:18:10 +0000 (16:18 +0200)]
rest handler: minimize scope of no-strict-refs exemption

with a rough check and a slight amount of hope that nothing else in
the module dependent on turning that off for the whole module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agovarious perl critic fixes
Thomas Lamprecht [Tue, 11 Apr 2023 14:17:10 +0000 (16:17 +0200)]
various perl critic fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agocli handler: contain no-stricture scope
Thomas Lamprecht [Tue, 11 Apr 2023 13:09:20 +0000 (15:09 +0200)]
cli handler: contain no-stricture scope

to please perlcritic's highest severity level and as it makes just
sense to contain such things to the smallest possible scope.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agocli handler: fix "return" statement followed by "sort" critic
Thomas Lamprecht [Tue, 11 Apr 2023 13:08:29 +0000 (15:08 +0200)]
cli handler: fix "return" statement followed by "sort" critic

As that's undefined behavior if the containing sub is called in
scalar context.

https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitReturnSort

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agoimprove code style of exception helper module
Thomas Lamprecht [Tue, 11 Apr 2023 12:49:59 +0000 (14:49 +0200)]
improve code style of exception helper module

fixes a perl critic lint against one-argument use of bless.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobump version to 7.3-4
Thomas Lamprecht [Mon, 27 Mar 2023 08:36:55 +0000 (10:36 +0200)]
bump version to 7.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agofix #4615: REST environment: improve AnyEvent detectíon in child cleanup
Dominik Csapak [Mon, 27 Mar 2023 08:26:32 +0000 (10:26 +0200)]
fix #4615: REST environment: improve AnyEvent detectíon in child cleanup

I assumed that the 'priv' and 'pub' RESTEnvironment types always
contained an AnyEvent eventloop, but this is actually not the case in
pvestatd and pvescheduler.

But it depended on the used model that AnyEvent used (and auto
detected) if this wrong assumption worked or not. With the
AnyEvent::Impl::Perl there weren't any problems and it seemingly
worked by accident, but when using AnyEvent::Impl::EV (which is
autodetected and used when libev-perl is installed) it interfered
with our SIG_CHLD handlers and only ever called them once. (Not clear
why this happens, maybe because AnyEvent is not setup correctly).

This patch uses $AnyEvent::MODEL as a detection instead since this is
`undef` until the first AnyEvent watcher is created, which should be
only the case where we really use AnyEvent, such as pveproxy and
pvedaemon.

Fixes: 6870afa ("RESTEnvironment: better SIGCHLD handling in AnyEvent event loop")
Link: https://lists.proxmox.com/pipermail/pve-devel/2023-March/056057.html
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agobump version to 7.3-3
Thomas Lamprecht [Thu, 16 Mar 2023 15:35:45 +0000 (16:35 +0100)]
bump version to 7.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocli formatter: check data ref when printing array
Thomas Lamprecht [Thu, 16 Mar 2023 15:18:48 +0000 (16:18 +0100)]
cli formatter: check data ref when printing array

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocertificate: actually print openssl errors
Fabian Grünbichler [Tue, 7 Mar 2023 10:50:18 +0000 (11:50 +0100)]
certificate: actually print openssl errors

print_errs (which is also called internally by die_now) will only
'warn' the collected error stack if the log level is set to tracing.
otherwise, it will just return the error message(s) corresponding to
the error stack as string.

while they are not always the most user-friendly ones, they do
provide additional context that might help to find out what is
actually causing a particular failure. both helpers here actually
provide a meaninful user friendly context (via $msg) as final line.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
 [ T: resolve merge conflict due to dropped warn helper ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agosection config: add helper for deleting keys from a entry
Dominik Csapak [Tue, 17 Jan 2023 11:46:52 +0000 (12:46 +0100)]
section config: add helper for deleting keys from a entry

This is a pattern that can be found often in Proxmox VE's API stack,
so implement it centrally here for re-use.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoRESTEnvironment: better SIGCHLD handling in AnyEvent event loop
Dominik Csapak [Mon, 20 Feb 2023 10:08:28 +0000 (11:08 +0100)]
RESTEnvironment: better SIGCHLD handling in AnyEvent event loop

when we're in an API server that uses AnyEvent, we must postpone
the worker_reaper, since it calls 'active_workers' which might already
be called and then we're inside the lock twice (flocks are per process
for us, see PVE::Tools::lock_file)

This resulted in an error like this:
close (rename) atomic file '/var/log/pve/tasks/active' failed: No such file or directory

We use the fact that only 'pub' and 'priv' RESTEnvironment types are an
api server with anyevent. For other types we call it like before.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agocert: avoid module-wide variable used only once
Thomas Lamprecht [Tue, 7 Mar 2023 17:31:58 +0000 (18:31 +0100)]
cert: avoid module-wide variable used only once

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert: check_pem: code reduction/cleanup
Thomas Lamprecht [Tue, 7 Mar 2023 17:21:05 +0000 (18:21 +0100)]
cert: check_pem: code reduction/cleanup

mainly by avoiding the useless intermediate variables

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert info: minimal code reduction
Thomas Lamprecht [Tue, 7 Mar 2023 17:17:43 +0000 (18:17 +0100)]
cert info: minimal code reduction

shorter and avoids variable are longer in scope than they're used too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert: csr: sensible param default for warn helper, avoid early line breaks
Thomas Lamprecht [Tue, 7 Mar 2023 17:11:24 +0000 (18:11 +0100)]
cert: csr: sensible param default for warn helper, avoid early line breaks

If one sets a param hard-coded to the same vallue in all but one case
it often is a nicer to negate it and but it at the end.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert: drop single-use warn helper
Thomas Lamprecht [Tue, 7 Mar 2023 17:06:26 +0000 (18:06 +0100)]
cert: drop single-use warn helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert: move trailing newline into die helper
Thomas Lamprecht [Tue, 7 Mar 2023 17:05:41 +0000 (18:05 +0100)]
cert: move trailing newline into die helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocert: make die helper a private sub and fix code style on use
Thomas Lamprecht [Tue, 7 Mar 2023 17:02:55 +0000 (18:02 +0100)]
cert: make die helper a private sub and fix code style on use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocertificate: add check_ prefix to cert/key match helper
Fabian Grünbichler [Tue, 7 Mar 2023 10:51:15 +0000 (11:51 +0100)]
certificate: add check_ prefix to cert/key match helper

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
14 months agocertificate: fix formatting and whitespace
Max Carrara [Fri, 3 Mar 2023 17:57:03 +0000 (18:57 +0100)]
certificate: fix formatting and whitespace

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
14 months agocertificate: add subroutine that checks if cert and key match
Max Carrara [Fri, 3 Mar 2023 17:57:02 +0000 (18:57 +0100)]
certificate: add subroutine that checks if cert and key match

This is done here in order to allow other packages to make use of
this subroutine.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
14 months agofix #4547: set MTU on dynamically created vlan bridges
Dominik Csapak [Fri, 24 Feb 2023 11:06:21 +0000 (12:06 +0100)]
fix #4547: set MTU on dynamically created vlan bridges

Otherwise the created vlan bridge has the default MTU, which is
unexpected when the original bridge has some other MTU configured.

We already do this for the firewall bridges, so we should do so too for
the vlan bridges.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agobump version to 7.3-2
Wolfgang Bumiller [Fri, 27 Jan 2023 09:30:46 +0000 (10:30 +0100)]
bump version to 7.3-2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
16 months agotools: Add callback based filtering for logfile dump
Christian Ebner [Wed, 11 Jan 2023 13:32:20 +0000 (14:32 +0100)]
tools: Add callback based filtering for logfile dump

This patch introduces callback based filtering functionality for logfile dumps.
Further, the `dump_logfile` function is split into a reusable part for dumps
generated based on a filehandle. The state parameter can be used to keep the
state for multiple consecutive function invocations.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
16 months agofix #4299: network : disable_ipv6: fix path checking
Alexandre Derumier [Wed, 19 Oct 2022 22:24:29 +0000 (00:24 +0200)]
fix #4299: network : disable_ipv6: fix path checking

It's possible to have a
/proc/sys/net/ipv6/ directory

but no
/proc/sys/net/ipv6/conf/$iface/disable_ipv6

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
16 months agofix typo
Fabian Grünbichler [Tue, 10 Jan 2023 11:25:54 +0000 (12:25 +0100)]
fix typo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
16 months agobuild: add missing build-dependencies
Fabian Grünbichler [Tue, 10 Jan 2023 11:23:10 +0000 (12:23 +0100)]
build: add missing build-dependencies

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agobump version to 7.3-1
Thomas Lamprecht [Thu, 24 Nov 2022 16:13:04 +0000 (17:13 +0100)]
bump version to 7.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodump logfile: avoid boolean ternary if already boolean value
Thomas Lamprecht [Thu, 24 Nov 2022 16:10:46 +0000 (17:10 +0100)]
dump logfile: avoid boolean ternary if already boolean value

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodump logfile: return whole log file if limit is 0
Daniel Tschlatscher [Wed, 23 Nov 2022 14:52:10 +0000 (15:52 +0100)]
dump logfile: return whole log file if limit is 0

The dump_logfile now returns the whole log file if the limit
parameter is set to 0. This must be done explicitly though, as in the
case of 'limit' being undefined, the default as before, 50 will be
used.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
17 months agonetwork: add|del_fdb: fix learning check
Alexandre Derumier [Mon, 21 Nov 2022 09:54:04 +0000 (10:54 +0100)]
network: add|del_fdb: fix learning check

ovs port don't have sysfs path
"/sys/class/net/$iface/brport/learning"

We need to check if the value is undef too

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
18 months agobump version to 7.2-8
Thomas Lamprecht [Sun, 20 Nov 2022 15:26:29 +0000 (16:26 +0100)]
bump version to 7.2-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonetwork: support adding fdb directly in tap_plug
Thomas Lamprecht [Sun, 20 Nov 2022 15:07:36 +0000 (16:07 +0100)]
network: support adding fdb directly in tap_plug

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonetwork: fix whitespace error
Thomas Lamprecht [Sun, 20 Nov 2022 15:07:48 +0000 (16:07 +0100)]
network: fix whitespace error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoPBSClient: file_restore_list: add extraParams and use timeout
Dominik Csapak [Thu, 10 Nov 2022 10:36:30 +0000 (11:36 +0100)]
PBSClient: file_restore_list: add extraParams and use timeout

under some conditions, like when calling it in the api where we have
a 30s pveproxy limit, we want to make use of the '--timeout' parameter
of the file-restore binary, but we may want to call it in the future
where we don't want add timeout.

To achieve that, add an extendable 'extra_params' hash parameter to
'file_restore_list' and use the timeout from there.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agocache: allow importing nodename method
Thomas Lamprecht [Tue, 15 Nov 2022 06:25:32 +0000 (07:25 +0100)]
cache: allow importing nodename method

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobump version to 7.2-7
Thomas Lamprecht [Sun, 13 Nov 2022 14:54:59 +0000 (15:54 +0100)]
bump version to 7.2-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agod/control: record breaks for older qemu-server/pve-container
Thomas Lamprecht [Sun, 13 Nov 2022 14:48:22 +0000 (15:48 +0100)]
d/control: record breaks for older qemu-server/pve-container

as we now auto-detect if the 'bridge-disable-mac-learning' is set in
the Network::tap_plug method and disable learning if so, we need to
ensure that the qemu-server and pve-container can cope with that by
manually registering the guests MAC into the FDB.

So this certainly isn't a hard break, but as network is dead for the
guest on update, if that option is set and the new qemu-server and/or
pve-container packages ain't yet updated, it seems still worthy of a
break.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agonetwork: tap plug: auto-disable learning if bridge-disable-mac-learning is set
Thomas Lamprecht [Sun, 13 Nov 2022 12:56:45 +0000 (13:56 +0100)]
network: tap plug: auto-disable learning if bridge-disable-mac-learning is set

avoids that we need to repeat the same code hunk two times each for
CT and VM call sites.

If required it can be simply overridden by setting it explicitly on
call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoprocfs tools: modernize write_proc_entry
Thomas Lamprecht [Sun, 13 Nov 2022 12:54:57 +0000 (13:54 +0100)]
procfs tools: modernize write_proc_entry

that unless stuff is just hard to read and against our code style.

note that there's also basically the same helper in SysFSTools, and
neither is really dependent on sysfs or procfs semantics, so both
probably should go away..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agotests: section config: comment need for warn on debugging
Thomas Lamprecht [Sun, 13 Nov 2022 10:54:32 +0000 (11:54 +0100)]
tests: section config: comment need for warn on debugging

as often only warn really makes it out of perl/our pit of std out/err
handling (e.g., I had a case where neither print STDERR nor syslog
worked, but warn did)

also, the tests are rather brittle w.r.t their expect_fail variant,
as the actual expected error should be enforced.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agojob registry: avoid injecting the section id unconditionally in configs
Thomas Lamprecht [Sun, 13 Nov 2022 10:50:40 +0000 (11:50 +0100)]
job registry: avoid injecting the section id unconditionally in configs

this can result in a broken config due to it getting written out on
write_config serialization, and if a plugin did not declare `id` as
an option it understood (none do currently), it would then fail the
next parse, far from ideal...

As the section ID is available already anyway we should probably just
drop this, but for now avoid rushed changes and just make it
conforming to section config semantics and check if the option is
actually understood by the respective section type we're working on.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agojob registry: drop unused get_job skeleton
Thomas Lamprecht [Sun, 13 Nov 2022 10:49:52 +0000 (11:49 +0100)]
job registry: drop unused get_job skeleton

didn't do anything anyway

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobump version to 7.2-6
Thomas Lamprecht [Sat, 12 Nov 2022 15:05:02 +0000 (16:05 +0100)]
bump version to 7.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoinotify: whitespace fix
Thomas Lamprecht [Sat, 12 Nov 2022 15:02:24 +0000 (16:02 +0100)]
inotify: whitespace fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agomove Job base config & registry over from manager as PVE::Job::Registry
Thomas Lamprecht [Sat, 12 Nov 2022 15:00:58 +0000 (16:00 +0100)]
move Job base config & registry over from manager as PVE::Job::Registry

It was PVE::Jobs::Plugin in pve-manager so we don't have any clash
potential, so no Breaks record required in d/control.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobuildsys: avoid phony 'install' target by setting actual pre-requisites
Thomas Lamprecht [Sat, 12 Nov 2022 14:41:29 +0000 (15:41 +0100)]
buildsys: avoid phony 'install' target by setting actual pre-requisites

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobuildsys: actually drop Subscription.pm from sources to install list
Thomas Lamprecht [Sat, 12 Nov 2022 14:40:49 +0000 (15:40 +0100)]
buildsys: actually drop Subscription.pm from sources to install list

Fixes: e94cd57 ("remove PVE::Subscription and friends")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobuildsys: sort list of module sources alphabetically
Thomas Lamprecht [Fri, 11 Nov 2022 09:50:03 +0000 (10:50 +0100)]
buildsys: sort list of module sources alphabetically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoadd section config tests
Wolfgang Bumiller [Wed, 9 Nov 2022 14:35:01 +0000 (15:35 +0100)]
add section config tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agosupport unknown types in section config
Wolfgang Bumiller [Wed, 9 Nov 2022 14:35:22 +0000 (15:35 +0100)]
support unknown types in section config

This adds an opt-in flag to `parse_config` and
`write_config` to allow for unknown section types.

This will simply be left unverified.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agosysfs tools: add comment w.r.t. mdev uuid to pci_cleanup_mdev_device
Thomas Lamprecht [Fri, 11 Nov 2022 09:45:55 +0000 (10:45 +0100)]
sysfs tools: add comment w.r.t. mdev uuid to pci_cleanup_mdev_device

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobump version to 7.2-5
Thomas Lamprecht [Mon, 7 Nov 2022 15:05:32 +0000 (16:05 +0100)]
bump version to 7.2-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agod/control: record breaks for qemu-server (<< 7.0-192-6)
Thomas Lamprecht [Mon, 7 Nov 2022 15:27:13 +0000 (16:27 +0100)]
d/control: record breaks for qemu-server (<< 7.0-192-6)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agocgroup: add note w.r.t. adding new params to change_cpu_shares
Thomas Lamprecht [Mon, 7 Nov 2022 15:04:07 +0000 (16:04 +0100)]
cgroup: add note w.r.t. adding new params to change_cpu_shares

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agochange cpu shares: drop unused $cgroupv1_default parameter
Fiona Ebner [Fri, 7 Oct 2022 12:41:51 +0000 (14:41 +0200)]
change cpu shares: drop unused $cgroupv1_default parameter

The only expression it appears in short-circuits, because the line
before ensures that $shares is guaranteed to be set.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agoschema: take over 'pve-targetstorage' option
Fabian Grünbichler [Wed, 28 Sep 2022 12:50:48 +0000 (14:50 +0200)]
schema: take over 'pve-targetstorage' option

from qemu-server, for re-use in pve-container.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agobump version to 7.2-4
Wolfgang Bumiller [Fri, 4 Nov 2022 13:11:16 +0000 (14:11 +0100)]
bump version to 7.2-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agopbs client: backup fs tree: drop namespace parameter
Fabian Ebner [Wed, 20 Jul 2022 10:59:45 +0000 (12:59 +0200)]
pbs client: backup fs tree: drop namespace parameter

Instead, use the one from the initial configuration. The only current
caller is in PMG and the namespace parameter set there agrees with
the one from the initial configuration, so this is not actually a
breaking change.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 months agopbs client: deprecate namespaced parameters
Fabian Ebner [Wed, 20 Jul 2022 10:59:44 +0000 (12:59 +0200)]
pbs client: deprecate namespaced parameters

All existing callers for functions with namespaced parameters just
re-use the one that's passed in via the initial configuration already,
so there is no need for namespaced parameters currently.

If the need for one PBS client to handle multiple namespaces arises, a
set_namespace() function could be added, or the relevant functions
could take an additional parameter, either for just the namespace or
like $cmd_opts in restore_pxar().

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 months agopbs client: default to configured namespace for non-namespaced parameters
Fabian Ebner [Wed, 20 Jul 2022 10:59:43 +0000 (12:59 +0200)]
pbs client: default to configured namespace for non-namespaced parameters

For get_snapshots(), also set the default when no namespaced parameter
is present at all.

This would break any callers that have a namespace in the initial
config and explicitly don't set it for a later call, but the only
such caller is restore_pxar() in PMG, which /should/ be using the
namespace!

In other words, this implicitly fixes the restore_pxar() call in PMG
and avoids the need to extract the namespace from the configuration
(which already is present in the client) on the call site for all
functions that currently take a namespaced parameter.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 months agopbs client: forget snapshot: suppress output
Fabian Ebner [Wed, 20 Jul 2022 10:59:42 +0000 (12:59 +0200)]
pbs client: forget snapshot: suppress output

Otherwise, there will be
Result: {
      "data": null
}
when calling via a CLI tool for example. This also makes it consistent
with PVE in preparation to switch to using PBSClient there.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 months agopbs client: delete password: return success for non-existent file
Fabian Ebner [Wed, 20 Jul 2022 10:59:41 +0000 (12:59 +0200)]
pbs client: delete password: return success for non-existent file

It's currently possible to add a remote in PMG without password (via
API), but deletion of such a remote would fail here.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
19 months agocgroup: move get_cpuunits helper from qemu-server as clamp_cpu_shares
Thomas Lamprecht [Wed, 19 Oct 2022 10:29:35 +0000 (12:29 +0200)]
cgroup: move get_cpuunits helper from qemu-server as clamp_cpu_shares

Based on a patch from Fiona[0] that proposed to move it to
guest-common, rather go for common where the CGroup module resides to
avoid having to touch multiple sites if this changes another time
(hopefully not)

[0]: https://lists.proxmox.com/pipermail/pve-devel/2022-October/054225.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agobump version to 7.2-3
Thomas Lamprecht [Wed, 21 Sep 2022 14:18:27 +0000 (16:18 +0200)]
bump version to 7.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agocgroup: get mode by checking /sys/fs/cgroup mount point
Wolfgang Bumiller [Wed, 21 Sep 2022 07:53:13 +0000 (09:53 +0200)]
cgroup: get mode by checking /sys/fs/cgroup mount point

Since even in pure unified layouts there may be a `name=systemd` v1
cgroup mounted additionally (manually or potentially via
systemd-nspawn apparently), we should check what's actually mounted
at `/sys/fs/cgroup` rather than whether v1 cgroups exist.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
20 months agocgroup: make get_v1_controllers private
Wolfgang Bumiller [Wed, 21 Sep 2022 07:53:12 +0000 (09:53 +0200)]
cgroup: make get_v1_controllers private

we have no external users left

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>