]> git.proxmox.com Git - proxmox.git/log
proxmox.git
25 hours agoauth-api: bump version to 0.3.5 master
Thomas Lamprecht [Wed, 24 Apr 2024 19:22:15 +0000 (21:22 +0200)]
auth-api: bump version to 0.3.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
25 hours agoldap: bump version to 0.2.2-1
Thomas Lamprecht [Wed, 24 Apr 2024 19:12:19 +0000 (21:12 +0200)]
ldap: bump version to 0.2.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
38 hours agonotify: fix TemplateType::Subject doc comment
Fabian Grünbichler [Mon, 22 Apr 2024 13:04:44 +0000 (15:04 +0200)]
notify: fix TemplateType::Subject doc comment

wrongly copied

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
47 hours agonotify: bump version to 0.4.0-1
Thomas Lamprecht [Tue, 23 Apr 2024 21:09:36 +0000 (23:09 +0200)]
notify: bump version to 0.4.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
47 hours agonotify: add getter for notification timestamp
Lukas Wagner [Tue, 23 Apr 2024 11:51:51 +0000 (13:51 +0200)]
notify: add getter for notification timestamp

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
47 hours agonotify: endpoints: matcher: improve descriptions for API types
Lukas Wagner [Tue, 23 Apr 2024 11:51:50 +0000 (13:51 +0200)]
notify: endpoints: matcher: improve descriptions for API types

proxmox-schema will automatically append text (e.g. 'Can be specified
more than once'), so we should end every comment with a '.'.

Also copy over some text from PVE docs, since these doc comments will
now be visible in the PBS documentation.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
47 hours agonotify: pbs-context: exclude successful prunes in default matcher
Lukas Wagner [Tue, 23 Apr 2024 11:51:49 +0000 (13:51 +0200)]
notify: pbs-context: exclude successful prunes in default matcher

PBS sends notifications for all events but successful prune jobs.
There we only care about errors.

This commit adapts the 'default-matcher' to reflect that behavior
as well.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
47 hours agonotify: use std::sync::OnceCell instead of lazy_static!
Lukas Wagner [Tue, 23 Apr 2024 11:51:48 +0000 (13:51 +0200)]
notify: use std::sync::OnceCell instead of lazy_static!

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
47 hours agonotify: expose `config` module
Lukas Wagner [Tue, 23 Apr 2024 11:51:47 +0000 (13:51 +0200)]
notify: expose `config` module

This is needed because we want to access CONFIG and PRIVATE_CONFIG
from the docgen helper in PBS.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
47 hours agonotify: renderer: add relative-percentage helper from PBS
Lukas Wagner [Fri, 19 Apr 2024 14:17:15 +0000 (16:17 +0200)]
notify: renderer: add relative-percentage helper from PBS

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: pbs context: include nodename in default sendmail author
Lukas Wagner [Fri, 19 Apr 2024 14:17:14 +0000 (16:17 +0200)]
notify: pbs context: include nodename in default sendmail author

The old notification stack in proxmox-backup includes the nodename, so
we include it here as well.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: derive Deserialize/Serialize for Notification struct
Lukas Wagner [Fri, 19 Apr 2024 14:17:13 +0000 (16:17 +0200)]
notify: derive Deserialize/Serialize for Notification struct

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: derive `api` for Deleteable*Property
Lukas Wagner [Fri, 19 Apr 2024 14:17:12 +0000 (16:17 +0200)]
notify: derive `api` for Deleteable*Property

The API endpoints in Proxmox Backup Server require ApiType to be
implemented for any deserialized parameter.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: api: add get_targets
Lukas Wagner [Fri, 19 Apr 2024 14:17:11 +0000 (16:17 +0200)]
notify: api: add get_targets

This method allows us to get a list of all notification targets.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: give each notification a unique ID
Lukas Wagner [Fri, 19 Apr 2024 14:17:10 +0000 (16:17 +0200)]
notify: give each notification a unique ID

We need this for queuing notifications on PBS from the unprivileged
proxy process.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: cargo.toml: add spaces before curly braces
Lukas Wagner [Fri, 19 Apr 2024 14:17:09 +0000 (16:17 +0200)]
notify: cargo.toml: add spaces before curly braces

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: make the `mail-forwarder` feature depend on proxmox-sys
Lukas Wagner [Fri, 19 Apr 2024 14:17:08 +0000 (16:17 +0200)]
notify: make the `mail-forwarder` feature depend on proxmox-sys

It uses proxmox_sys::nodename - the dep is needed, otherwise the code
does not compile in some feature flag permutations.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: don't make tests require pve-context
Lukas Wagner [Fri, 19 Apr 2024 14:17:07 +0000 (16:17 +0200)]
notify: don't make tests require pve-context

Tests now have their own context, so requiring pve-context is not
necessary any more.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: convert Option<Vec<T>> -> Vec<T> in config structs
Lukas Wagner [Fri, 19 Apr 2024 14:17:06 +0000 (16:17 +0200)]
notify: convert Option<Vec<T>> -> Vec<T> in config structs

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: make api methods take config struct ownership
Lukas Wagner [Fri, 19 Apr 2024 14:17:05 +0000 (16:17 +0200)]
notify: make api methods take config struct ownership

This saves us from some of the awkward cloning steps when updating.

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
47 hours agonotify: switch to file-based templating system
Lukas Wagner [Fri, 19 Apr 2024 14:17:04 +0000 (16:17 +0200)]
notify: switch to file-based templating system

Instead of passing the template strings for subject and body when
constructing a notification, we pass only the name of a template.
When rendering the template, the name of the template is used to find
corresponding template files. For PVE, they are located at
/usr/share/proxmox-ve/templates/default. The `default` part is
the 'template namespace', which is a preparation for user-customizable
and/or translatable notifications.

Previously, the same template string was used to render HTML and
plaintext notifications. This was achieved by providing some template
helpers that 'abstract away' HTML/plaintext formatting. However,
in hindsight this turned out to be pretty finicky. Since the
current changes lay the foundations for user-customizable notification
templates, I ripped these abstractions out. Now there are simply two
templates, one for plaintext, one for HTML.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
6 days agofix #5249: apt: allow parsing Packages without Priority field
Fabian Grünbichler [Thu, 14 Mar 2024 10:26:53 +0000 (11:26 +0100)]
fix #5249: apt: allow parsing Packages without Priority field

it seems there are repositories out there that don't (always) include
it, and while it is required for the .deb packages themselves in Debian,
the repository "spec" doesn't make it mandatory.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
6 days agofix #5249: apt: allow parsing Packages without Priority field
Fabian Grünbichler [Thu, 14 Mar 2024 10:26:53 +0000 (11:26 +0100)]
fix #5249: apt: allow parsing Packages without Priority field

it seems there are repositories out there that don't (always) include
it, and while it is required for the .deb packages themselves in Debian,
the repository "spec" doesn't make it mandatory.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 weeks agonotify: fix #5274: also set 'X-Gotify-Key' header for authentication
Lukas Wagner [Wed, 3 Apr 2024 08:08:25 +0000 (10:08 +0200)]
notify: fix #5274: also set 'X-Gotify-Key' header for authentication

Versions of Gotify < 2.2.0 only supported the 'X-Gotify-Key' header
for passing the API token. This comment sets this header in addition
to the regular 'Authorization' header in order to be compatible with
older Gotify servers.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
4 weeks agobump proxmox-http to 0.9.1-1
Wolfgang Bumiller [Thu, 28 Mar 2024 12:17:56 +0000 (13:17 +0100)]
bump proxmox-http to 0.9.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 weeks agohttp: support ALPN negotiated http2
Wolfgang Bumiller [Thu, 28 Mar 2024 10:19:56 +0000 (11:19 +0100)]
http: support ALPN negotiated http2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 weeks agotree-wide: run cargo fmt
Thomas Lamprecht [Mon, 25 Mar 2024 16:04:17 +0000 (17:04 +0100)]
tree-wide: run cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoauth-api: implement `Display` for `Realm{, Ref}`
Christoph Heiss [Fri, 12 Jan 2024 16:15:58 +0000 (17:15 +0100)]
auth-api: implement `Display` for `Realm{, Ref}`

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
4 weeks agoldap: add method for retrieving root DSE attributes
Christoph Heiss [Fri, 12 Jan 2024 16:15:57 +0000 (17:15 +0100)]
ldap: add method for retrieving root DSE attributes

The root DSE holds common attributes about the LDAP server itself.
Needed to e.g. support Active Directory-based LDAP servers to retrieve
the base DN from the server itself, based on an valid bind.

See also RFC 4512, Section 5.1 [0] for more information about this
special object.

[0] https://www.rfc-editor.org/rfc/rfc4512#section-5.1

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
4 weeks agoldap: avoid superfluous allocation when calling .search()
Christoph Heiss [Fri, 12 Jan 2024 16:15:56 +0000 (17:15 +0100)]
ldap: avoid superfluous allocation when calling .search()

The `attrs` parameter of `Ldap::search()` is an `impl AsRef<[impl
AsRef<str>]>` anyway, so replace `vec![..]` with `&[..]`.

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
4 weeks agofix: use fragmented block size for space calculation
Gabriel Goller [Mon, 22 Jan 2024 14:23:32 +0000 (15:23 +0100)]
fix: use fragmented block size for space calculation

We currently calculate the size of a datastore using `statfs64`, which
returns the number of blocks in the fs and the two block sizes:
fragemented block size(f_frsize) and block size (f_bsize). To calculate
eg the total space in a datastore we use total_blocks * f_bsize, which
is not always correct.

`f_frsize` is the minimum unit of allocation on the filesystem (in
bytes) and in 99% of the cases equal to `f_bsize`, but in some cases
it differs. For example some filesystems allow smaller blocks for small
files, in case f_frsize < f_bsize. In that case, f_frsize * total_blocks
returns (mostly) the correct result (ceph also did some weird stuff, which is
now being fixed though [0][1]). `statvfs` also documents this as the
recommended way ('fsblkcnt_t f_blocks;   /* Size of fs in f_frsize units */')[2].

This patch aligns the the behavior with the libc utilities (also used by
`df`) [3].

Motivation: [4] (Forum post)

[0]: https://tracker.ceph.com/issues/3793
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=92a49fb0f79f3300e6e50ddf56238e70678e4202
[2]: https://www.man7.org/linux/man-pages/man3/statvfs.3.html
[3]: https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/fsusage.c#n147
[4]: https://forum.proxmox.com/threads/pbs-3-1-2-wrong-datastore-information-sshfs.139875/#post-626959

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
5 weeks agosys: d/copyright: update years
Thomas Lamprecht [Tue, 19 Mar 2024 10:23:43 +0000 (11:23 +0100)]
sys: d/copyright: update years

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 weeks agobump proxmox-notify to 0.3.3-1
Wolfgang Bumiller [Tue, 19 Mar 2024 10:10:30 +0000 (11:10 +0100)]
bump proxmox-notify to 0.3.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agobump proxmox-auth-api to 0.3.4
Wolfgang Bumiller [Tue, 19 Mar 2024 10:09:10 +0000 (11:09 +0100)]
bump proxmox-auth-api to 0.3.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agobump proxmox-schema to 3.1.0-1
Wolfgang Bumiller [Tue, 19 Mar 2024 10:07:08 +0000 (11:07 +0100)]
bump proxmox-schema to 3.1.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agonotify: adapt to proxmox_schema changes, use const_format
Wolfgang Bumiller [Tue, 19 Mar 2024 09:29:27 +0000 (10:29 +0100)]
notify: adapt to proxmox_schema changes, use const_format

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agonotify: sort and group dependencies
Wolfgang Bumiller [Tue, 19 Mar 2024 09:27:25 +0000 (10:27 +0100)]
notify: sort and group dependencies

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 weeks agoproxmox-schema: moved common api types from pbs-api-types
Dietmar Maurer [Fri, 15 Mar 2024 11:27:32 +0000 (12:27 +0100)]
proxmox-schema: moved common api types from pbs-api-types

We want to use those types in all of our products.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agoproxmox-schema: add IP address regex/api-types
Dietmar Maurer [Fri, 15 Mar 2024 11:27:31 +0000 (12:27 +0100)]
proxmox-schema: add IP address regex/api-types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agoproxmox-auth-api: use const_format to define static strings
Dietmar Maurer [Fri, 15 Mar 2024 11:27:30 +0000 (12:27 +0100)]
proxmox-auth-api: use const_format to define static strings

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agoproxmox-schema: use const_format to define static strings.
Dietmar Maurer [Fri, 15 Mar 2024 11:27:29 +0000 (12:27 +0100)]
proxmox-schema: use const_format to define static strings.

Macro rules are not hygienic, and current rust macro visibility rules
are a nightmare. Using const_format::concatcp!() is a much cleaner
solution.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agobump proxmox-acme to 0.5.1
Wolfgang Bumiller [Thu, 7 Mar 2024 12:27:15 +0000 (13:27 +0100)]
bump proxmox-acme to 0.5.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agoacme: formatting fixups
Wolfgang Bumiller [Thu, 7 Mar 2024 12:24:42 +0000 (13:24 +0100)]
acme: formatting fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agoacme: drop api-types feature from schema dependency
Wolfgang Bumiller [Thu, 7 Mar 2024 12:24:37 +0000 (13:24 +0100)]
acme: drop api-types feature from schema dependency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
7 weeks agoproxmox-acme: derive PartialEq for API types
Dietmar Maurer [Thu, 7 Mar 2024 11:54:44 +0000 (12:54 +0100)]
proxmox-acme: derive PartialEq for API types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agoproxmox-acme: add api-types feature
Dietmar Maurer [Thu, 7 Mar 2024 09:45:33 +0000 (10:45 +0100)]
proxmox-acme: add api-types feature

Because AccountData is exposed via our API (currently as type Object).

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agorrd: fixup examples with the renamed types
Wolfgang Bumiller [Wed, 21 Feb 2024 11:28:09 +0000 (12:28 +0100)]
rrd: fixup examples with the renamed types

Some types were recently renamed but the examples not updated
accordingly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 2f942833672d "rrd: spell out hard to understand abbreviations in public types"
2 months agobump proxmox-schema to 3.0.1-1
Wolfgang Bumiller [Wed, 21 Feb 2024 11:24:25 +0000 (12:24 +0100)]
bump proxmox-schema to 3.0.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoschema: drop periods after errors
Wolfgang Bumiller [Wed, 21 Feb 2024 11:04:39 +0000 (12:04 +0100)]
schema: drop periods after errors

lower case start + period = wrong

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoschema: add regression tests for additional_properties in AllOf
Wolfgang Bumiller [Wed, 21 Feb 2024 11:02:00 +0000 (12:02 +0100)]
schema: add regression tests for additional_properties in AllOf

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoschema: AllOf/OneOf: actually perform additional_properties() check
Wolfgang Bumiller [Wed, 21 Feb 2024 10:41:53 +0000 (11:41 +0100)]
schema: AllOf/OneOf: actually perform additional_properties() check

rather than just always allowing additional properties, only return
true if any of the available schemas allows it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agorouter: Use safe wrapper for libc::isatty
Maximiliano Sandoval R [Fri, 16 Feb 2024 14:59:01 +0000 (15:59 +0100)]
router: Use safe wrapper for libc::isatty

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agosys: Use safe wrapper for libc::isatty
Maximiliano Sandoval R [Fri, 16 Feb 2024 14:59:00 +0000 (15:59 +0100)]
sys: Use safe wrapper for libc::isatty

Use the `std::io::IsTerminal` trait introduced in Rust 1.70.

Internally it calls `libc::isatty`, see [1, 2]. Note that it switches
the comparison from `== 1` to `!= 0` which shouldn't make a difference
assuming that libc::isatty upholds the promises made in its man page.

The MSRV was set on the workspace to reflect this change.

[1] https://doc.rust-lang.org/src/std/io/stdio.rs.html#1079
[2] https://doc.rust-lang.org/src/std/sys/unix/io.rs.html#79

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2 months agobump proxmox-subscription to 0.4.3-1
Wolfgang Bumiller [Fri, 2 Feb 2024 13:24:27 +0000 (14:24 +0100)]
bump proxmox-subscription to 0.4.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-rrd to 0.1.1-1
Wolfgang Bumiller [Fri, 2 Feb 2024 13:22:22 +0000 (14:22 +0100)]
bump proxmox-rrd to 0.1.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-notify to 0.3.2-1
Wolfgang Bumiller [Fri, 2 Feb 2024 13:19:52 +0000 (14:19 +0100)]
bump proxmox-notify to 0.3.2-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-client to 0.3.1-1
Wolfgang Bumiller [Fri, 2 Feb 2024 13:05:44 +0000 (14:05 +0100)]
bump proxmox-client to 0.3.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-section-config to 2.0.1-1
Wolfgang Bumiller [Fri, 2 Feb 2024 13:03:10 +0000 (14:03 +0100)]
bump proxmox-section-config to 2.0.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-auth-api to 0.3.3
Wolfgang Bumiller [Fri, 2 Feb 2024 13:01:28 +0000 (14:01 +0100)]
bump proxmox-auth-api to 0.3.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-tfa to 4.1.2
Wolfgang Bumiller [Fri, 2 Feb 2024 13:00:27 +0000 (14:00 +0100)]
bump proxmox-tfa to 4.1.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-rest-server to 0.5.2-1
Wolfgang Bumiller [Fri, 2 Feb 2024 11:08:15 +0000 (12:08 +0100)]
bump proxmox-rest-server to 0.5.2-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-router to 2.1.3-1
Wolfgang Bumiller [Fri, 2 Feb 2024 12:55:23 +0000 (13:55 +0100)]
bump proxmox-router to 2.1.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-human-byte to 0.1.3-1
Wolfgang Bumiller [Fri, 2 Feb 2024 12:51:47 +0000 (13:51 +0100)]
bump proxmox-human-byte to 0.1.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-apt to 0.10.8-1
Wolfgang Bumiller [Fri, 2 Feb 2024 12:47:49 +0000 (13:47 +0100)]
bump proxmox-apt to 0.10.8-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-api-macro to 1.0.8-1
Wolfgang Bumiller [Fri, 2 Feb 2024 12:45:41 +0000 (13:45 +0100)]
bump proxmox-api-macro to 1.0.8-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump proxmox-schema to 3.0.0-1
Wolfgang Bumiller [Fri, 2 Feb 2024 11:11:21 +0000 (12:11 +0100)]
bump proxmox-schema to 3.0.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoschema: implement split_list iterator
Wolfgang Bumiller [Tue, 4 Apr 2023 14:00:59 +0000 (16:00 +0200)]
schema: implement split_list iterator

and reuse splitting code in no_schema's SeqAccess as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorouter: OneOfSchema support
Wolfgang Bumiller [Fri, 17 Mar 2023 14:44:45 +0000 (15:44 +0100)]
router: OneOfSchema support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agoschema: implement oneOf schema support
Wolfgang Bumiller [Thu, 16 Mar 2023 16:11:05 +0000 (17:11 +0100)]
schema: implement oneOf schema support

A 'oneOf' schema is basically exactly what a rust `enum` is.
Exactly one of the possible values must match the data.

This should ultimately be the base to allow using the
`#[api]` macro on a newtype style enum as well as using this
schema as a configuration for our section config parser.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorouter: cli: option to specify args explicitly
Wolfgang Bumiller [Tue, 14 Mar 2023 08:02:45 +0000 (09:02 +0100)]
router: cli: option to specify args explicitly

so CLI tools can pre-parse out non-api parameters before
passing the remaining stuff to the router

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorest-server: support configuring the privileged connection
Wolfgang Bumiller [Thu, 9 Mar 2023 14:50:55 +0000 (15:50 +0100)]
rest-server: support configuring the privileged connection

Adds a privileged_addr to ApiConfig, and some helpers for
hyper (both server and client)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorest-server: support unix sockets in create_daemon
Wolfgang Bumiller [Wed, 8 Mar 2023 12:26:50 +0000 (13:26 +0100)]
rest-server: support unix sockets in create_daemon

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agobump proxmox-rrd to 0.1.0-1
Wolfgang Bumiller [Thu, 1 Feb 2024 12:46:28 +0000 (13:46 +0100)]
bump proxmox-rrd to 0.1.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agorrd: spell out hard to understand abbreviations in public types
Lukas Wagner [Wed, 31 Jan 2024 15:26:01 +0000 (16:26 +0100)]
rrd: spell out hard to understand abbreviations in public types

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorrd: fix a few typos
Lukas Wagner [Wed, 31 Jan 2024 13:56:51 +0000 (14:56 +0100)]
rrd: fix a few typos

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agorrd: feature-gate support for the v1 format
Lukas Wagner [Wed, 31 Jan 2024 13:51:54 +0000 (14:51 +0100)]
rrd: feature-gate support for the v1 format

new users of this crate might not really need support for the v1
format.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agoadd debian packaging for proxmox-rrd
Lukas Wagner [Wed, 31 Jan 2024 12:02:52 +0000 (13:02 +0100)]
add debian packaging for proxmox-rrd

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agoadd `proxmox-rrd` to workspace
Lukas Wagner [Wed, 31 Jan 2024 11:57:22 +0000 (12:57 +0100)]
add `proxmox-rrd` to workspace

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2 months agoMerge branch proxmox-rrd
Lukas Wagner [Wed, 31 Jan 2024 11:40:20 +0000 (12:40 +0100)]
Merge branch proxmox-rrd

The proxmox-backup repo was filtered using `git filter-repo` using the
following paths:

proxmox-rrd
proxmox-rrd-api-types
src/rrd

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agobump proxmox-login to 0.1.1-1
Wolfgang Bumiller [Wed, 24 Jan 2024 11:48:09 +0000 (12:48 +0100)]
bump proxmox-login to 0.1.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoMakefile: enforce the use packaged cargo
Wolfgang Bumiller [Wed, 24 Jan 2024 08:26:02 +0000 (09:26 +0100)]
Makefile: enforce the use packaged cargo

Nightly currently produces a different output format so this command
doesn't work right now when +system is not the default cargo.
Let's hope this is just a temporary hiccup in nightly, given that
there is an explicit `--format-version=1` parameter...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agologin: parse helpers for floats
Wolfgang Bumiller [Wed, 24 Jan 2024 08:01:54 +0000 (09:01 +0100)]
login: parse helpers for floats

Of course PVE also stringifies those in the API, duh...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agoschema: cli: simplify can_default check
Wolfgang Bumiller [Mon, 22 Jan 2024 13:55:05 +0000 (14:55 +0100)]
schema: cli: simplify can_default check

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agohttp: concat! user agent instead of format!
Wolfgang Bumiller [Mon, 15 Jan 2024 10:17:57 +0000 (11:17 +0100)]
http: concat! user agent instead of format!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agonotify: bump d/control
Wolfgang Bumiller [Wed, 10 Jan 2024 13:15:48 +0000 (14:15 +0100)]
notify: bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agobump proxmox-notify to 0.3.1-1
Wolfgang Bumiller [Wed, 10 Jan 2024 13:04:36 +0000 (14:04 +0100)]
bump proxmox-notify to 0.3.1-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agonotify: matcher: support lists of values for 'exact' match-field mode
Lukas Wagner [Wed, 13 Dec 2023 16:37:42 +0000 (17:37 +0100)]
notify: matcher: support lists of values for 'exact' match-field mode

For example, one can now use:
  match-field exact:type=vzdump,replication
to match on vzdump AND replication events.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: include 'type' metadata field for forwarded mails
Lukas Wagner [Wed, 13 Dec 2023 16:37:41 +0000 (17:37 +0100)]
notify: include 'type' metadata field for forwarded mails

Seems like this was forgotten in the initial version. Without it,
it's not really possible to create matchers for forwarded mails.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: include 'hostname' metadata field for forwarded mails
Lukas Wagner [Wed, 13 Dec 2023 16:37:40 +0000 (17:37 +0100)]
notify: include 'hostname' metadata field for forwarded mails

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: add separate context for unit-tests
Lukas Wagner [Wed, 10 Jan 2024 09:31:22 +0000 (10:31 +0100)]
notify: add separate context for unit-tests

... as using PVEContext for tests is brittle and annoying for some
tests.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: api: allow resetting built-in targets if used by a matcher
Lukas Wagner [Wed, 10 Jan 2024 09:31:21 +0000 (10:31 +0100)]
notify: api: allow resetting built-in targets if used by a matcher

In the 'delete'-handler targets, we check if a
target is still referenced by a matcher - if it is, we return an
error. For built-in targets, this is actually not necessary, since
'deleting' a built-in only resets it to its default settings - it will
continue to exist after that.
The user could easily trigger this if 'mail-to-root', which is
referenced by 'default-matcher' is modified and then reset to its
defaults: An error is shown, the built-in target is not reset.

This commit disables this check if it is a built-in target.

Renamed the helper 'ensure_unused' to 'ensure_safe_to_delete' in the
process.

Also fixed the tests in api::test - they were never executed due to a
faulty #[cfg] directive.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: smtp: add `Auto-Submitted` header to email body
Lukas Wagner [Wed, 10 Jan 2024 09:52:52 +0000 (10:52 +0100)]
notify: smtp: add `Auto-Submitted` header to email body

`Auto-Submitted` is defined in the rfc 5436 [1] and describes how
an automatic response (f.e. ooo replies, etc.) should behave on the
emails. When using `Auto-Submitted: auto-generated` (or any value
other than `none`) automatic replies won't be triggered.

[1]: https://www.rfc-editor.org/rfc/rfc3834.html

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agonotify: smtp: forward original message instead nesting
Lukas Wagner [Wed, 10 Jan 2024 09:52:51 +0000 (10:52 +0100)]
notify: smtp: forward original message instead nesting

For mails forwarded by `proxmox-mail-forward` to an SMTP target, the
original message was nested as a 'message/rfc822' message part.
Originally this approach was chosen to avoid having to rewrite
message headers.
Good email-clients, such as Thunderbird can display these inline.
Other, more limited clients will show these messages as an attached
.eml file, which is not really a good user experience.

This patch changes the approach for message forwarding to be more like
forwarding mails in a mail client. We create a new message and
add the original message body as a body. Additionally, we also copy
over all message headers that are relevant to correctly display the
original message body (e.g. Content-Type, Content-Transfer-Encoding)

Tested with a couple of different email messages (varying in
structure, body parts, encoding, etc.) against the following SMTP
relays:
  - gmail
  - outlook
  - our own webmail service

Originally reported in our community forum:
https://forum.proxmox.com/threads/proxmox-mail-forward-sends-mails-as-eml.137710/

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agobump proxmox-sys to 0.5.3-1
Wolfgang Bumiller [Mon, 8 Jan 2024 11:48:18 +0000 (12:48 +0100)]
bump proxmox-sys to 0.5.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agobump proxmox-time dependency to 1.1.6
Wolfgang Bumiller [Mon, 8 Jan 2024 11:17:47 +0000 (12:17 +0100)]
bump proxmox-time dependency to 1.1.6

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agobump proxmox-time to 1.1.6
Wolfgang Bumiller [Mon, 8 Jan 2024 11:17:16 +0000 (12:17 +0100)]
bump proxmox-time to 1.1.6

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 months agosys: email: use `epoch_to_rfc2822` from proxmox_time
Lukas Wagner [Mon, 11 Dec 2023 13:29:08 +0000 (14:29 +0100)]
sys: email: use `epoch_to_rfc2822` from proxmox_time

`strftime`'s formatting is locale-dependent. If the system locale was
set to e.g. de_DE.UTF-8, the `Date` header became invalid
(e.g Mo instead of Mon for 'Monday'), tripping up some mail clients
(e.g. KMail).

This commit should fix this by using the new `epoch_to_rfc2822`
function from proxmox_time. Under the hood, this function uses
`strftime_l` with a fixed locale (C).

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agotime: posix: add epoch_to_rfc2822
Lukas Wagner [Mon, 11 Dec 2023 13:29:07 +0000 (14:29 +0100)]
time: posix: add epoch_to_rfc2822

This is the format used in the 'Date' header in mails.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agotime: posix: add bindings for strftime_l
Lukas Wagner [Mon, 11 Dec 2023 13:29:06 +0000 (14:29 +0100)]
time: posix: add bindings for strftime_l

This variant of strftime can be provided with a locale_t, which
determines the locale used for time formatting.

A struct `Locale` was also introduced as a safe wrapper around
locale_t.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
3 months agotime: posix: inline vars in string formatting
Lukas Wagner [Mon, 11 Dec 2023 13:29:05 +0000 (14:29 +0100)]
time: posix: inline vars in string formatting

No functional changes.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>