Commit Graph

2969 Commits

Author SHA1 Message Date
Wolfgang Bumiller
a092b06d9f rest-server: shorten some format strings
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-11-08 12:09:53 +01:00
Gabriel Goller
d8fa495a50 rest-server: check permissions on proxy.key and proxy.pem files
To avoid openssl's unhelpful error messages when the proxy.key or
proxy.pem files have the wrong permissions, we open the files. To load
the private key, we can simply read from the file and pass it to the
`set_private_key` openssl function. Sadly such a function does not exist
for loading certificate chains, so we have to open and close the file
before calling the `set_certificate_chain_file` fn.

Motivation: https://forum.proxmox.com/threads/proxmox-backup-tailscale-proxmox-backup-proxy-service-wont-boot.153204

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2024-11-08 12:09:53 +01:00
Wolfgang Bumiller
db69867d4d rest-server: pass cipher suite/list to acceptor
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-08 12:09:53 +01:00
Dietmar Maurer
35c60f652b subscription: use correct debian release name
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-11-07 13:35:00 +01:00
Dietmar Maurer
996c86bb32 subscription: bump version to 0.5.0-1
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-11-07 13:19:13 +01:00
Dominik Csapak
ae55575f2a subscription: move most of the implmentation into impl feature
so we can use the types without having openssl, proxmox-sys, etc. as
dependencies.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-11-07 12:43:17 +01:00
Fabian Grünbichler
f96c0e6036 http: update d/control
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-10-30 12:20:36 +01:00
Lukas Wagner
e8e5c11c6a fix #5808: http: use native-tls instead of rustls for the sync client
In the reference Bugzilla entry, a certificate with an IP address as a
SAN was used. rustls seems to have problems with that [1].
Also, pretty much all of our code uses native-tls at the moment, so
it makes sense to not pull in a second TLS implementation.

Tested by rebuilding libpve-rs-perl and testing a Gotify notification
target with a self-signed TLS certificate (one that is accepted by
OpenSSL but not by rusttls).

[1] https://github.com/rustls/rustls/issues/184

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-10-30 12:19:56 +01:00
Fabian Grünbichler
f5e7f4ed7f proxmox-apt-api-types: use workspace excludes
else the `debian` dir is contained in the .crate archive, breaking the build..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-10-23 13:29:22 +02:00
Thomas Lamprecht
ba3ee7a4db api-marcro: throw compiler error if description for enums is empty
A description is required for the API schema types and we fallback to
the rust doc-comment when no explicit one is set.
But a empty string was returned if no doc-comment existed, so check
for the comment to be non-empty and throw a compile-time error
otherwise.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-22 15:14:43 +02:00
Thomas Lamprecht
1c4467841d schema: property description: output indentation where its required
The wrap_text helper accepts and initial indentation, so use that as
central point to add the indentation that glues the list entry
together with its description.

Mostly a small optimization, should not matter in practice, i.e. where
all properties should have a description.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-22 14:51:19 +02:00
Thomas Lamprecht
bd1133fcd2 notify: add missing doc-comment description for api enums
this is used as description in the api schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-22 14:49:10 +02:00
Thomas Lamprecht
331fa7a732 apt-api-types: add missing doc-comment description for api enums
this is used as description in the api schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-22 14:48:47 +02:00
Gabriel Goller
1b70270b2d log: only print error level to syslog/stderr
We only want to print the error level, and not all the levels below
error to stderr/syslog.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2024-10-18 18:28:37 +02:00
Thomas Lamprecht
21c314b56e schema: property description: switch format strings to inline template variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-18 17:37:30 +02:00
Thomas Lamprecht
b809d86d73 cli: format: switch some format strings to inline template variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-18 17:29:17 +02:00
Thomas Lamprecht
aa12dcbba0 time: bump version to 2.0.2-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-17 16:16:56 +02:00
Thomas Lamprecht
44e7ca98cd time: add some simple unit tests for time span conversions
For starters, could definitively be expanded.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-17 14:23:27 +02:00
Thomas Lamprecht
17bf3ec9fe time: add module level docs for time span
There was basically no documentation at all, so try to document the
basic format syntax and where it comes from. The text is partially
adapted from the systemd docs.

Could be still expanded with some example code and the methods might
do good with getting some docs too, but those parts can be relatively
easily be figured out from the code itself, the basic underlying
design and format background is much harder to guess..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-17 14:23:27 +02:00
Thomas Lamprecht
191299605f time: display minute/month such that it can be parsed again
Previously we displayed, e.g., "4m 1h 1min", i.e. using "m" for months
and "min" for minutes but "m"  was not accepted as month when parsing
a timespan string, so a 4 month timespan would be printed "4m" but if
parsed again it would result in a timespan of 4 minutes.

So switch month to an uppercase "M" and minute to the lower case "m",
which makes renderings of common timespans nicer, as in most of our
use cases they are in the range of minutes to hours, sometimes days
but seldom longer than weeks. So using single letters for all but
"min" stuck out quite a bit, e.g.: "1h 5min 2s" looks odd compared to
"1h 5m 1s"

While the duplicate letter is not 100% ideal it's still better than
the status quo, where rendering and parsing would interpret things
differently.
Also, the order still makes it quite clear, e.g.:
"7m 2w 3d 1h 5min 44s" now becomes "7M 2w 3d 1h 5m 44s"

As a side effect this also brings the display format closer to what is
used inside PVE backup job taks logs.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-17 14:22:44 +02:00
Thomas Lamprecht
9ae91303fd time: switch to inline template variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-17 11:40:21 +02:00
Christian Ebner
67822186a2 time: drop trailing space when not showing seconds at end
Seconds are not displayed when the value is smaller than 0.1s and
they are not at the start of the display output, e.g. `1h 2m`.
Drop the additional whitespace currently appended for this edge case.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-10-17 10:38:53 +02:00
Wolfgang Bumiller
c76090b907 tfa: clean up unused 'use' statements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-15 15:19:03 +02:00
Wolfgang Bumiller
11930517ef acme: bump to 0.5.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-03 09:52:46 +02:00
Wolfgang Bumiller
b52b3739be acme: deny(unsafe_code)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-02 12:49:17 +02:00
Wolfgang Bumiller
f298ed6aec acme: detect base64 vs base64url encoded hmac keys
We do this in the PVE code as well.

Link: https://forum.proxmox.com/threads/acme-with-custom-acme-directory-doesnt-work.147058/
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-02 12:45:31 +02:00
Wolfgang Bumiller
c30169d08f tfa: bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-01 12:51:04 +02:00
Wolfgang Bumiller
2a1458126c tfa: bump to 5.0.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-01 12:48:36 +02:00
Wolfgang Bumiller
8698f3afc7 tfa: provide TfaUser via the 'types' feature and module
So we can access it from UI code.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-10-01 12:48:27 +02:00
Wolfgang Bumiller
ee113bf244 login: bump to 0.1.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-30 11:48:12 +02:00
Dominik Csapak
eb3dd9453b login: boolean parser: also accept "1" and "0" as strings
since that's what the pve api sometimes returns for booleans

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-09-30 11:45:06 +02:00
Wolfgang Bumiller
7379bdfb9c README: extend Adding Cates section, convert to markdown
(conveted with pandoc and some minor manual fixups)

Mention that the crates should activate `doc_cfg, doc_auto_cfg` and
ideally `#[deny(unsafe_op_in_unsafe_fn)]` and `#[deny(missing_docs)]`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-30 10:26:56 +02:00
Wolfgang Bumiller
f7e130d5b5 api-macro: bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 14:56:56 +02:00
Wolfgang Bumiller
d601b57fd0 api-macro: bump to 1.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 14:52:52 +02:00
Wolfgang Bumiller
532d4d3e9a login: bump to 0.1.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 14:51:53 +02:00
Wolfgang Bumiller
2b3c356ece api-macro: allow declaring an additional-properties field
Object schemas can now declare a field which causes
'additional_properties' to be set to true and the field being ignored
in the schema.

This allows adding a flattened HashMap<String, Value> to gather the
additional unspecified properties.

    #[api(additional_properties: "rest")]
    struct Something {
        #[serde(flatten)]
        rest: HashMap<String, Value>,
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 12:47:58 +02:00
Wolfgang Bumiller
e72528ca70 login: add 'raw' webauthn challenge access
So we can get going on the wasm side where we don't yet have access to
the webauthn-rs crate.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 12:40:32 +02:00
Wolfgang Bumiller
c85b534837 readme: update cargo config path
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-20 08:44:19 +02:00
Wolfgang Bumiller
005678cec2 buildsys: add a 'make list-packages' target
To ease development on new machines, this provides an easy way to just
do

    # apt install $(make list-packages)

to get started.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-20 08:43:08 +02:00
Wolfgang Bumiller
d6e86d670b tree-wide: unify workspace inherited attributes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-20 08:42:45 +02:00
Wolfgang Bumiller
6e8ad21227 rrd-api-types: bump to 1.0.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 15:17:08 +02:00
Wolfgang Bumiller
9ed8f7f110 rrd-api-types: follor acronym capitalization guidelines
Link: https://rust-lang.github.io/api-guidelines/naming.html
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 15:13:26 +02:00
Wolfgang Bumiller
111a883788 rrd-api-types: bump to 1.0.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 14:59:08 +02:00
Wolfgang Bumiller
4f787391de rrd-api-types: make mode and timeframe +Eq+PartialEq+Debug
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 14:55:51 +02:00
Wolfgang Bumiller
b38568158a sys: bump to 0.6.4-1
This should also fix a build issue on aarch64 caused by a signed-ness
differences of c_char.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 09:07:01 +02:00
Wolfgang Bumiller
fb8a706066 rrd-api-types: check in d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-19 09:06:55 +02:00
Wolfgang Bumiller
8f3eecab68 rrd-api-types: bump to 1.0.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-18 16:05:21 +02:00
Wolfgang Bumiller
3cf67472a1 rrd: bump to 0.4.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-18 16:05:21 +02:00
Wolfgang Bumiller
0177b1d975 add proxmox-rrd-api-types crate - moved out of proxmox-rrd
so we can access them from wasm without pulling in proxmox-rrd as it
also pulls in sys...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-18 15:55:43 +02:00
Wolfgang Bumiller
e57a65879e rrd: bump to 0.3.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-18 15:24:16 +02:00