Commit Graph

2558 Commits

Author SHA1 Message Date
Wolfgang Bumiller
d9b783f1a8 bump proxmox-auth-api to 0.3.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 14:01:57 +01:00
Wolfgang Bumiller
9da7b3ad49 bump proxmox-tfa to 4.1.2
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 14:00:49 +01:00
Wolfgang Bumiller
890d9e58f7 bump proxmox-rest-server to 0.5.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:58:05 +01:00
Wolfgang Bumiller
f67ea142bc bump proxmox-router to 2.1.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:56:34 +01:00
Wolfgang Bumiller
d143efd01a bump proxmox-human-byte to 0.1.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:56:01 +01:00
Wolfgang Bumiller
d7876b1837 bump proxmox-apt to 0.10.8-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:56:01 +01:00
Wolfgang Bumiller
ca6ca904ad bump proxmox-api-macro to 1.0.8-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:56:01 +01:00
Wolfgang Bumiller
245524d0d8 bump proxmox-schema to 3.0.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:53:12 +01:00
Wolfgang Bumiller
5df9da2af4 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>
2024-02-02 12:06:46 +01:00
Wolfgang Bumiller
ae7454b05e router: OneOfSchema support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-02 12:06:28 +01:00
Wolfgang Bumiller
d48a150835 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>
2024-02-02 12:06:28 +01:00
Wolfgang Bumiller
1c0edfb518 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>
2024-02-02 12:05:34 +01:00
Wolfgang Bumiller
2bba40f604 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>
2024-02-01 14:00:22 +01:00
Wolfgang Bumiller
aad01f7a90 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>
2024-02-01 13:59:48 +01:00
Wolfgang Bumiller
440c7e3361 bump proxmox-rrd to 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-01 13:46:28 +01:00
Lukas Wagner
2f94283367 rrd: spell out hard to understand abbreviations in public types
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-01 10:32:19 +01:00
Lukas Wagner
f9e8ebfdc8 rrd: fix a few typos
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-01 10:32:19 +01:00
Lukas Wagner
6eed8ed992 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>
2024-02-01 10:32:19 +01:00
Lukas Wagner
4d150d35c7 add debian packaging for proxmox-rrd
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-01 10:32:19 +01:00
Lukas Wagner
5cbc8a4b66 add proxmox-rrd to workspace
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-01 10:30:57 +01:00
Lukas Wagner
b8c56e7b6c 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>
2024-02-01 10:30:23 +01:00
Wolfgang Bumiller
2b56eba35c bump proxmox-login to 0.1.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-24 12:49:06 +01:00
Wolfgang Bumiller
de8fd435fb 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>
2024-01-24 09:26:03 +01:00
Wolfgang Bumiller
6ee541d5f2 login: parse helpers for floats
Of course PVE also stringifies those in the API, duh...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-24 09:20:49 +01:00
Wolfgang Bumiller
2fa645af2e schema: cli: simplify can_default check
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-24 09:20:42 +01:00
Wolfgang Bumiller
fe8b11eeec http: concat! user agent instead of format!
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-15 11:17:57 +01:00
Wolfgang Bumiller
3c453f7468 notify: bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-10 14:15:48 +01:00
Wolfgang Bumiller
1484676ac4 bump proxmox-notify to 0.3.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-10 14:04:36 +01:00
Lukas Wagner
ead4190e7b 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>
2024-01-10 12:38:32 +01:00
Lukas Wagner
39c4d7d85e 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>
2024-01-10 12:38:32 +01:00
Lukas Wagner
870d9c2739 notify: include 'hostname' metadata field for forwarded mails
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-01-10 12:38:32 +01:00
Lukas Wagner
f0bf95f53b 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>
2024-01-10 12:29:26 +01:00
Lukas Wagner
50fa98e241 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>
2024-01-10 12:29:26 +01:00
Lukas Wagner
efa607f1b5 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>
2024-01-10 12:20:41 +01:00
Lukas Wagner
b03c394039 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>
2024-01-10 12:20:41 +01:00
Wolfgang Bumiller
674ab33a43 bump proxmox-sys to 0.5.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-08 12:48:57 +01:00
Wolfgang Bumiller
8fdf696eed bump proxmox-time dependency to 1.1.6
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-08 12:18:12 +01:00
Wolfgang Bumiller
ea05268cde bump proxmox-time to 1.1.6
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-08 12:18:12 +01:00
Lukas Wagner
dc72878d37 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>
2024-01-08 12:04:47 +01:00
Lukas Wagner
1384bd9161 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>
2024-01-08 12:04:11 +01:00
Lukas Wagner
795b3a57a7 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>
2024-01-08 11:59:26 +01:00
Lukas Wagner
5b25e7cc90 time: posix: inline vars in string formatting
No functional changes.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-01-08 11:57:25 +01:00
Lukas Wagner
7033c497a0 time: posix: use strftime from the libc crate.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-01-08 11:57:15 +01:00
Lukas Wagner
228ce9d69c client: do a POST instead of PUT in post_without_body
Probably a copy-paste mistake.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-01-04 08:15:01 +01:00
Wolfgang Bumiller
1f377da07c bump api-macro to 1.0.7-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 16:02:42 +01:00
Wolfgang Bumiller
3c1103e7d5 bump proxmox-tfa to 4.1.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 16:01:13 +01:00
Wolfgang Bumiller
01e68eb40e bump proxmox-router to 2.1.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 16:00:10 +01:00
Wolfgang Bumiller
1d6174d36d bump proxmox-apt to 0.10.7-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 15:59:59 +01:00
Wolfgang Bumiller
5d9e33d1d9 tfa: fix deserialize-default in TfaUser
Note that this was currently not deserialized anywhere, so this was
not an issue, but the api-macro now treats this as an error.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 14:54:47 +01:00
Wolfgang Bumiller
2435ab29e2 api-macro: make skip_serializing_if without default an error
except for Option types, since this causes deserialization issues

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 14:39:47 +01:00