]> git.proxmox.com Git - proxmox.git/log
proxmox.git
4 months agotime-api: add copyright file
Dietmar Maurer [Mon, 3 Jun 2024 07:27:38 +0000 (09:27 +0200)]
time-api: add copyright file

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agodns-api: add debian control file
Dietmar Maurer [Mon, 3 Jun 2024 07:24:26 +0000 (09:24 +0200)]
dns-api: add debian control file

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agodns-api: avoid auto-generated cargo features
Dietmar Maurer [Mon, 3 Jun 2024 07:21:42 +0000 (09:21 +0200)]
dns-api: avoid auto-generated cargo features

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: add debian control file
Dietmar Maurer [Mon, 3 Jun 2024 07:14:14 +0000 (09:14 +0200)]
product-config: add debian control file

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoacme-api: remove stale feature gate and always compile api types
Dietmar Maurer [Mon, 3 Jun 2024 07:08:16 +0000 (09:08 +0200)]
acme-api: remove stale feature gate and always compile api types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoacme-api: commit missing file
Dietmar Maurer [Fri, 31 May 2024 10:35:42 +0000 (12:35 +0200)]
acme-api: commit missing file

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoacme-api: remove useless api-types feature
Dietmar Maurer [Fri, 31 May 2024 10:19:10 +0000 (12:19 +0200)]
acme-api: remove useless api-types feature

We always need those types, so there is no need to make this a feature.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoacme-api: add init method to setup directories
Dietmar Maurer [Fri, 31 May 2024 10:12:23 +0000 (12:12 +0200)]
acme-api: add init method to setup directories

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: simplify by removing the configuration directory
Dietmar Maurer [Fri, 31 May 2024 09:29:59 +0000 (11:29 +0200)]
product-config: simplify by removing the configuration directory

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoremove system-management-api
Dietmar Maurer [Thu, 30 May 2024 07:53:59 +0000 (09:53 +0200)]
remove system-management-api

Which is now split into separate crates:

- time-api
- network-api
- dns-api
- syslog-api

4 months agosyslog-api: new crate, split out from system-management-api
Dietmar Maurer [Thu, 30 May 2024 07:44:48 +0000 (09:44 +0200)]
syslog-api: new crate, split out from system-management-api

4 months agonetwork-api: new crate, split out from system-management-api
Dietmar Maurer [Thu, 30 May 2024 07:23:08 +0000 (09:23 +0200)]
network-api: new crate, split out from system-management-api

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agotime-api: new crate, split out from system-managent-api
Dietmar Maurer [Thu, 30 May 2024 06:52:37 +0000 (08:52 +0200)]
time-api: new crate, split out from system-managent-api

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agodns-api: new crate, split out from system-management-api
Dietmar Maurer [Thu, 30 May 2024 06:43:32 +0000 (08:43 +0200)]
dns-api: new crate, split out from system-management-api

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: remove digest implementation (move to proxmox-config-digest crate)
Dietmar Maurer [Wed, 29 May 2024 16:40:11 +0000 (18:40 +0200)]
product-config: remove digest implementation (move to proxmox-config-digest crate)

And use the new proxmox-config-digest crate instead.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoconfig-digest: split out config digest api type into separate crate
Dietmar Maurer [Wed, 29 May 2024 15:59:03 +0000 (17:59 +0200)]
config-digest: split out config digest api type into separate crate

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agosys: use 0750 as default directory permissions
Dietmar Maurer [Wed, 29 May 2024 09:04:41 +0000 (11:04 +0200)]
sys: use 0750 as default directory permissions

Should not make a difference because default umask is 022 ...

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: remove functions to check permissions, which are now in proxmox-sys.
Dietmar Maurer [Wed, 29 May 2024 08:19:00 +0000 (10:19 +0200)]
product-config: remove functions to check permissions, which are now in proxmox-sys.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agosys: add helpers to check file and directory permissions
Dietmar Maurer [Wed, 29 May 2024 08:14:24 +0000 (10:14 +0200)]
sys: add helpers to check file and directory permissions

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agosys: create options: make file parameter generic
Dietmar Maurer [Wed, 29 May 2024 07:28:07 +0000 (09:28 +0200)]
sys: create options: make file parameter generic

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: factor out methods to create different file creation options
Dietmar Maurer [Wed, 29 May 2024 05:47:17 +0000 (07:47 +0200)]
product-config: factor out methods to create different file creation options

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agoproduct-config: use Path instead of str everywhere
Dietmar Maurer [Wed, 29 May 2024 04:52:04 +0000 (06:52 +0200)]
product-config: use Path instead of str everywhere

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 months agolang: drop commented-out c_str! implementation variants
Wolfgang Bumiller [Fri, 24 May 2024 10:56:41 +0000 (12:56 +0200)]
lang: drop commented-out c_str! implementation  variants

This was an old version of a const-fn compatible checked c_str
implementation which was never enabled.

When we get rust 1.72, `CStr::from_bytes_with_nul` becomes usable in
const contexts.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agometrics: influxdb test uri creation
Gabriel Goller [Thu, 23 May 2024 11:18:17 +0000 (13:18 +0200)]
metrics: influxdb test uri creation

Extract the URI creation for write and health URIs. Add unit test to
test the encoding of special characters in the organization and bucket
parameters.

Follow-up-to: bfa73aad ("metrics: encode influxdb org and bucket parameters")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
FG: downgraded form_urlencoded version to packaged one
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 months agoauth-api: bump version to 0.4.0
Wolfgang Bumiller [Wed, 22 May 2024 13:59:15 +0000 (15:59 +0200)]
auth-api: bump version to 0.4.0

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agosys: bump version to 0.5.5-1
Wolfgang Bumiller [Wed, 22 May 2024 13:48:00 +0000 (15:48 +0200)]
sys: bump version to 0.5.5-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agoauth-api: rustfmt
Wolfgang Bumiller [Wed, 22 May 2024 13:41:56 +0000 (15:41 +0200)]
auth-api: rustfmt

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agoauth-api: cleanup a warning
Wolfgang Bumiller [Wed, 22 May 2024 13:40:12 +0000 (15:40 +0200)]
auth-api: cleanup a warning

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agoauth-api: remove unnecessary allocation
Wolfgang Bumiller [Wed, 22 May 2024 13:38:26 +0000 (15:38 +0200)]
auth-api: remove unnecessary allocation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 months agoauth-api: fix types `compilefail` test
Stefan Sterz [Wed, 6 Mar 2024 12:36:05 +0000 (13:36 +0100)]
auth-api: fix types `compilefail` test

due to missing `use` statements they failed, as they should, but for
the wrong reasons. also adapt a test case that presumably was meant
to test whether `TokennameRef` can be compared, but instead
duplicated the `UsernameRef` test case.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agosys: crypt: use constant time comparison for password verification
Stefan Sterz [Wed, 6 Mar 2024 12:36:04 +0000 (13:36 +0100)]
sys: crypt: use constant time comparison for password verification

by using `openssl::memcmp::eq()` we can avoid potential timing side
channels as its runtime only depends on the length of the arrays, not
the contents. this requires the two arrays to have the same length, but
that should be a given since the hashes should always have the same
length.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agosys: crypt: move to yescrypt for password hashing
Stefan Sterz [Wed, 6 Mar 2024 12:36:03 +0000 (13:36 +0100)]
sys: crypt: move to yescrypt for password hashing

previously we used `sha256scrypt` for password hashing. while this may
by safe if used with the correct parameters, we used the default
parameters which are considered unsafe. according to `man crypt(5)`:

> The default CPU time cost parameter is 5000, which is too low for
> modern hardware.

hence, we needed to adapt this code anyway. conveniently, verification
with crypt also works for older hashes as the parameters for the
hashing function are encoded in the output of crypt. so this is a drop
in replacement that will simply use yescrypt for new hashes while
old hashes will still verify properly.

this commit also adds a wrapper for `crypt_gensalt_rn` to more easily
generate correctly formatted salt strings. this is also useful for
switching the cpu time hardness parameter, as otherwise we'd need to
encode that ourselves.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agoauth-api: move to hmac signing for csrf tokens
Stefan Sterz [Wed, 6 Mar 2024 12:36:02 +0000 (13:36 +0100)]
auth-api: move to hmac signing for csrf tokens

previously we used our own hmac-like implementation for csrf token
signing that simply appended the key to the message (csrf token).
however, this is possibly insecure as an attacker that finds a
collision in the hash function can easily forge a signature. after all,
two messages would then produce the same start conditions before
hashing the key. while this is probably a theoretic attack on our csrf
implementation, it does not hurt to move to the safer standard hmac
implementation that avoids such pitfalls.

this commit re-uses the hmac key wrapper used for the keyring. it also
keeps the old construction around so we can use it for a transition
period between old and new csrf token implementations.

this is a breaking change as it changes the signature of the
`csrf_secret` method of the `AuthContext` trait to return an hmac
key.

also exposes `assemble_csrf_prevention_toke` so we can re-use this
code here instead of duplicating it in e.g. proxmox-backup's
auth_helpers.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agoauth-api: use constant time comparison for csrf tokens
Stefan Sterz [Wed, 6 Mar 2024 12:36:01 +0000 (13:36 +0100)]
auth-api: use constant time comparison for csrf tokens

by using openssl's `memcmp::eq()` we can avoid potential side-channel
attack on the csrf token comparison. this comparison's runtime only
depends on the length of the two byte vectors, not their contents.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agoauth-api: add ability to use hmac singing in keyring
Stefan Sterz [Wed, 6 Mar 2024 12:36:00 +0000 (13:36 +0100)]
auth-api: add ability to use hmac singing in keyring

previously we only used asymmetric cryptographic schemes to
authenticate tickets. this is fairly costly and not necessary in every
instance. imagine a service that runs as a single daemon. this daemon
is then the only party that needs to sign and verify tickets. this
makes hmac perfectly suitable for such usecases. hmac has some
advantages over asymmetric schemes:

- much simpler and well reviewed construction
- much faster and better optimized crypto primitives (hash functions)

this commit first introduces a new hmac key wrapper that uses openssl's
hmac implementation and can easily be reused by other parts of the
code. it also refactors the keyring code to make it easier to rotate
new hmac keys into place so switching to hmac keys is easier.

hmac keys are symmetric, so the verification key is the same key as the
signing key. this breaks the previous assumption by the keyring that
these correspond to public and private keys. thus, this commit
introduces two wrapper enums to distinguish between hmac and asymmetric
signature schemes.

the verification of hmac keys is also done via `openssl::memcmp::eq()`
to avoid potential timing side-channel attacks.

below are some simple benchmarks done with criterion.rs to show how much
faster hmac is, no matter the actual hash function:

rsa 4096 + sha256        time:   [2.7825 ms 2.7907 ms 2.7995 ms]
ed25519                  time:   [94.411 µs 94.840 µs 95.324 µs]
hmac sha256              time:   [5.7202 µs 5.7412 µs 5.7645 µs]
hmac sha384              time:   [6.6577 µs 6.6780 µs 6.7006 µs]
hmac sha3_256            time:   [5.6930 µs 5.7114 µs 5.7322 µs]

rsa with 4096 bit keys and a sha256 digest is our current default. the
test itself consists of a single sign + verification cycle. criterion
repeats this test as it sees fit to arrive at the above numbers.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agoauth-api: move to Ed25519 signatures
Stefan Sterz [Wed, 6 Mar 2024 12:35:59 +0000 (13:35 +0100)]
auth-api: move to Ed25519 signatures

previously we used P-256 as the curve of our choice for ec signatures.
however, in the meantime Ed25519 has become a lot more wide-spread.
this simplifies our ec generation code significantly while keeping the
same security level. Ed25519 was also specifically designed and
reviewed to avoid implementation errors likely making it a more secure
choice

note that Ed25519 as a signature scheme always uses sha512, so signing
or verifying with a chosen digest is not supported.

as this mostly affects newly generated keys, this should not break any
existing setups.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
4 months agoauth-api: move signing into the private key
Stefan Sterz [Wed, 6 Mar 2024 12:35:58 +0000 (13:35 +0100)]
auth-api: move signing into the private key

this commit moves the current ticket signing code into the private key
implementation. the upside is that the caller does not need to deal
with openssl's `Signer` directly. it also simplifies and unifies the
code by using the same helper for verifying a signature and creating it.

also derive `Clone` on `PrivateKey` and `PublicKey`. as they are
essentially thin wrappers around `openssl::pkey::PKey<Private>` and
`openssl::pkey::PKey<Public>`, which can be cloned, deriving `Clone`
just makes them easier to use.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
5 months agoacme-api: add debian packaging
Dietmar Maurer [Fri, 17 May 2024 10:10:13 +0000 (12:10 +0200)]
acme-api: add debian packaging

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoacme-api: use product-config instead of custom acme api configuration
Dietmar Maurer [Fri, 17 May 2024 09:52:57 +0000 (11:52 +0200)]
acme-api: use product-config instead of custom acme api configuration

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agobump proxmox-section-config to 2.0.2-1
Dietmar Maurer [Fri, 17 May 2024 09:04:10 +0000 (11:04 +0200)]
bump proxmox-section-config to 2.0.2-1

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosection-config: pass filesystem paths as AsRef<Path>
Dietmar Maurer [Fri, 17 May 2024 08:57:35 +0000 (10:57 +0200)]
section-config: pass filesystem paths as AsRef<Path>

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoacme-api: reusable ACME api implementation.
Dietmar Maurer [Wed, 20 Mar 2024 08:59:23 +0000 (09:59 +0100)]
acme-api: reusable ACME api implementation.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agobump proxmox-acme to 0.5.2
Dietmar Maurer [Thu, 16 May 2024 09:37:09 +0000 (11:37 +0200)]
bump proxmox-acme to 0.5.2

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoacme: add async-client feature
Dietmar Maurer [Wed, 20 Mar 2024 12:03:53 +0000 (13:03 +0100)]
acme: add async-client feature

The client code is copied from propxmox-backup, without the load/safe
account functionality.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoacme: allow to compile/use api types separately.
Dietmar Maurer [Mon, 18 Mar 2024 12:08:23 +0000 (13:08 +0100)]
acme: allow to compile/use api types separately.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-management-api: network: add create_interface and update_interface
Dietmar Maurer [Thu, 16 May 2024 08:24:41 +0000 (10:24 +0200)]
system-management-api: network: add create_interface and update_interface

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-management: use ip/cidr schema types from proxmox-schema
Dietmar Maurer [Thu, 16 May 2024 07:42:10 +0000 (09:42 +0200)]
system-management: use ip/cidr schema types from proxmox-schema

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agobump proxmox-schema to 3.1.1-1
Dietmar Maurer [Thu, 16 May 2024 07:35:50 +0000 (09:35 +0200)]
bump proxmox-schema to 3.1.1-1

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoschema: api-types: add ip/cidr api schemas
Dietmar Maurer [Thu, 16 May 2024 07:09:37 +0000 (09:09 +0200)]
schema: api-types: add ip/cidr api schemas

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-management-api: rename features (add suffix -api-types)
Dietmar Maurer [Wed, 15 May 2024 11:33:55 +0000 (13:33 +0200)]
system-management-api: rename features (add suffix -api-types)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agorename proxmox-system-config-api to proxmox-system-management-api
Dietmar Maurer [Wed, 15 May 2024 11:23:42 +0000 (13:23 +0200)]
rename proxmox-system-config-api to proxmox-system-management-api

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: add syslog feature
Dietmar Maurer [Wed, 15 May 2024 10:31:50 +0000 (12:31 +0200)]
system-config-api: add syslog feature

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoRevert "system-config-api: network: add alias 'iface' for interface name."
Dietmar Maurer [Tue, 14 May 2024 09:50:44 +0000 (11:50 +0200)]
Revert "system-config-api: network: add alias 'iface' for interface name."

This reverts commit a4de726601d7f003833e4c040b9fcebe5adc26b4.

Turn out we do not need this.

5 months agosystem-config-api: expose helpers to set ports/slaves as string (list)
Dietmar Maurer [Mon, 13 May 2024 10:25:07 +0000 (12:25 +0200)]
system-config-api: expose helpers to set ports/slaves as string (list)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: network: add api type to update network interfaces
Dietmar Maurer [Mon, 13 May 2024 08:09:02 +0000 (10:09 +0200)]
system-config-api: network: add api type to update network interfaces

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: cleanup: remove useless serde rename property
Dietmar Maurer [Fri, 10 May 2024 09:15:12 +0000 (11:15 +0200)]
system-config-api: cleanup: remove useless serde rename property

5 months agosystem-config-api: network: add alias 'iface' for interface name.
Dietmar Maurer [Fri, 10 May 2024 08:23:27 +0000 (10:23 +0200)]
system-config-api: network: add alias 'iface' for interface name.

So that we can use the Interface struct with create and update api calls (which
currently use 'iface' instead of 'name').

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: network: add helpers to check for duplicate gateway propertie
Dietmar Maurer [Fri, 10 May 2024 08:08:23 +0000 (10:08 +0200)]
system-config-api: network: add helpers to check for duplicate gateway propertie

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: network: add helpers to set bridge ports and bond slaves
Dietmar Maurer [Fri, 10 May 2024 07:53:27 +0000 (09:53 +0200)]
system-config-api: network: add helpers to set bridge ports and bond slaves

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: add network feature
Dietmar Maurer [Wed, 8 May 2024 11:02:01 +0000 (13:02 +0200)]
system-config-api: add network feature

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: use cargo features to sparate functionality
Dietmar Maurer [Wed, 8 May 2024 08:28:34 +0000 (10:28 +0200)]
system-config-api: use cargo features to sparate functionality

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agosystem-config-api: add functions to read/write time and timezone
Dietmar Maurer [Tue, 7 May 2024 12:04:53 +0000 (14:04 +0200)]
system-config-api: add functions to read/write time and timezone

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agorename proxmox-dns-api to proxmox-system-config-api
Dietmar Maurer [Tue, 7 May 2024 11:24:39 +0000 (13:24 +0200)]
rename proxmox-dns-api to proxmox-system-config-api

Because we want to bundle system configuration APIs in one crate,
i.e. Time, DNS, Network. We may separate them in future using
cargo features.

5 months agodns-api: add feature "impl"
Dietmar Maurer [Mon, 6 May 2024 11:41:42 +0000 (13:41 +0200)]
dns-api: add feature "impl"

So the we can use the api types with our UI crates.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoproduct-config: add feature "impl"
Dietmar Maurer [Mon, 6 May 2024 11:21:04 +0000 (13:21 +0200)]
product-config: add feature "impl"

So the we can use the ConfigDigest with our UI crates.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoproduct-config: add method to detect config digest modifications.
Dietmar Maurer [Mon, 6 May 2024 10:34:21 +0000 (12:34 +0200)]
product-config: add method to detect config digest modifications.

Using an object method with strong typing is considered cleaner.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agodns-api: do not serlialize option None
Dietmar Maurer [Mon, 6 May 2024 08:29:49 +0000 (10:29 +0200)]
dns-api: do not serlialize option None

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agodns-api: export all defined api types
Dietmar Maurer [Fri, 3 May 2024 07:51:34 +0000 (09:51 +0200)]
dns-api: export all defined api types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agodns-api: add debian packaging
Dietmar Maurer [Fri, 3 May 2024 07:30:40 +0000 (09:30 +0200)]
dns-api: add debian packaging

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoproduct-config: add debian packaging
Dietmar Maurer [Fri, 3 May 2024 07:29:46 +0000 (09:29 +0200)]
product-config: add debian packaging

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agofix typo in proxmox-product-config workspace dependency
Dietmar Maurer [Fri, 3 May 2024 07:28:33 +0000 (09:28 +0200)]
fix typo in proxmox-product-config workspace dependency

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agodns-api: new crate which implements the DNS api
Dietmar Maurer [Thu, 2 May 2024 11:04:43 +0000 (13:04 +0200)]
dns-api: new crate which implements the DNS api

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agoproduct-config: add rust API type for configuration digest
Dietmar Maurer [Thu, 2 May 2024 10:15:59 +0000 (12:15 +0200)]
product-config: add rust API type for configuration digest

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agonew crate for commonly used functions to read and write configuration files
Dietmar Maurer [Fri, 26 Apr 2024 10:05:44 +0000 (12:05 +0200)]
new crate for commonly used functions to read and write configuration files

Factor out functions to read and write configuration files with
product specific permissions.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 months agometrics: bump version to 0.3.1-1
Thomas Lamprecht [Fri, 26 Apr 2024 15:34:43 +0000 (17:34 +0200)]
metrics: bump version to 0.3.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agometrics: influxdb: inline variables into template format string
Thomas Lamprecht [Fri, 26 Apr 2024 15:31:22 +0000 (17:31 +0200)]
metrics: influxdb: inline variables into template format string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agometrics: encode influxdb org and bucket parameters
Gabriel Goller [Fri, 26 Apr 2024 14:02:42 +0000 (16:02 +0200)]
metrics: encode influxdb org and bucket parameters

In order to remove the current limitations on the bucket and
organization names, we need to make sure that they are transmitted
correctly. In order to do this, we encode them using the url crate.

This way we support organization/bucket names that include slashes,
whitespaces, etc.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
5 months agosys: bump version to 0.5.4-2
Thomas Lamprecht [Fri, 26 Apr 2024 15:24:23 +0000 (17:24 +0200)]
sys: bump version to 0.5.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agosys: bump version to 0.5.4-1
Thomas Lamprecht [Fri, 26 Apr 2024 14:52:41 +0000 (16:52 +0200)]
sys: bump version to 0.5.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agoauth-api: bump version to 0.3.5
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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>
5 months 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>