]> git.proxmox.com Git - pmg-api.git/log
pmg-api.git
2 years agounpack: adapt to new libarchive methods
Stoiko Ivanov [Mon, 7 Jun 2021 18:55:22 +0000 (18:55 +0000)]
unpack: adapt to new libarchive methods

This patch changes the deprecated method used from libarchive-perl.
It needs a versioned dependency bump on libarchive-perl (>= 3.4.0).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoupdate postgresql dependency to 13
Stoiko Ivanov [Mon, 31 May 2021 14:03:15 +0000 (14:03 +0000)]
update postgresql dependency to 13

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoutils: do not hardcode postgres version
Stoiko Ivanov [Mon, 31 May 2021 13:53:05 +0000 (13:53 +0000)]
utils: do not hardcode postgres version

PMG::Utils::lookup_real_service_name is only called
for translating the service names provided as arguments
to PMG::API2::Nodes::syslog (for fetching the journal
for specific units). Instead of hardcoding the
version getting it with a call to `psql` seems justified.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoapi: statistics: drop deprecated detail statistic methods
Stoiko Ivanov [Tue, 8 Jun 2021 17:25:29 +0000 (17:25 +0000)]
api: statistics: drop deprecated detail statistic methods

in e89b61c5190e3e374c2c3bcb3dce444c64c718cf we introduced a method
taking the address as explicit parameter instead of path component
(local-parts can contain '/'). now we can drop the old paths.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoapi: quarantine: drop deprecated b/w-list methods
Stoiko Ivanov [Tue, 8 Jun 2021 17:22:17 +0000 (17:22 +0000)]
api: quarantine: drop deprecated b/w-list methods

in e8d909c11faeb5a4f84f39ef50e0eaf8ea65046d we introduced methods
which take the address to be deleted as parameter instead of path
component (local-parts can contain '/') - now we can drop the old
paths as indicated in 53e5e5da24ec13c49e9fdeffa9560833b28ad107

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoTLSPolicy: drop deprecated 'domain' parameter
Stoiko Ivanov [Tue, 8 Jun 2021 16:26:49 +0000 (16:26 +0000)]
TLSPolicy: drop deprecated 'domain' parameter

the domain parameter was a misnomer and was replaced by destination in
cce8e372aa9e902dfa7b8b17770e82450dd319b9

With a major version change upcoming we can now drop the old
parameter name.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoRevert "improve csrf backward compatibility"
Stoiko Ivanov [Tue, 8 Jun 2021 16:11:55 +0000 (16:11 +0000)]
Revert "improve csrf backward compatibility"

This commit was added in PMG 5.2 for backwards compatibility and can
now be dropped.

This reverts commit 7aff29f38091462a13431ec80f6cbdd8e93e2c4b.

2 years agoapi: nodes: drop deprecated 'upgrade' option of termproxy
Stoiko Ivanov [Tue, 8 Jun 2021 16:06:50 +0000 (16:06 +0000)]
api: nodes: drop deprecated 'upgrade' option of termproxy

The termproxy api was adapted to the changes from PVE and PBS
in d9e79ff4b7f0f9b2c49f06484091546353980c5e
We can now drop the 'upgrade' option kept for backwards compatibility

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoclamav: remove deprecated SafeBrowsing
Oguz Bektas [Wed, 19 May 2021 12:32:43 +0000 (14:32 +0200)]
clamav: remove deprecated SafeBrowsing

this database was discontinued in 2019 due to legal reasons.

see:
https://blog.clamav.net/2021/04/are-you-still-attempting-to-download.html

archive in case it goes 404:
https://web.archive.org/web/20210408140341/https://blog.clamav.net/2021/04/are-you-still-attempting-to-download.html

* remove from freshclam.conf.in template
* remove from description
* default to 0 just to be sure
* if 'safebrowsing' set in pmg.conf, this is now ignored

note about removing the option in PMG 7.0

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
changed the removal notice form PMG 7.0 to 8.0
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agod/control: bump versioned dependency on pve-common and pve-http-server
Stoiko Ivanov [Fri, 11 Jun 2021 14:48:35 +0000 (16:48 +0200)]
d/control: bump versioned dependency on pve-common and pve-http-server

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agopmgproxy: allow setting LISTEN_IP parameter
Oguz Bektas [Wed, 24 Mar 2021 12:59:31 +0000 (13:59 +0100)]
pmgproxy: allow setting LISTEN_IP parameter

LISTEN_IP is defined in /etc/default/pmgproxy.

this depends on the changes in pve-common and pve-http-server (#2997)

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
added changes ported from pve-manager commit
8da3ad7ce8ca9d609f0e5be3860f63f3d1a58889
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agobuildsys: update lintian-overrides
Stoiko Ivanov [Tue, 8 Jun 2021 13:47:28 +0000 (13:47 +0000)]
buildsys: update lintian-overrides

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agobuildsys: bump d/compat to 12 and adapt d/rules
Stoiko Ivanov [Mon, 31 May 2021 12:55:05 +0000 (12:55 +0000)]
buildsys: bump d/compat to 12 and adapt d/rules

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agobuildsys: wrap-and-sort
Stoiko Ivanov [Mon, 31 May 2021 10:52:37 +0000 (10:52 +0000)]
buildsys: wrap-and-sort

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: upload costum certificate: actually return info
Fabian Ebner [Wed, 28 Apr 2021 08:22:50 +0000 (10:22 +0200)]
api: upload costum certificate: actually return info

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoaccess control: add newline when dying on auth
Thomas Lamprecht [Wed, 28 Apr 2021 05:59:43 +0000 (07:59 +0200)]
access control: add newline when dying on auth

to avoid the module-path + line suffixed in the error..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-4
Thomas Lamprecht [Thu, 15 Apr 2021 13:19:04 +0000 (15:19 +0200)]
bump version to 6.4-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoacme: allow wildcard domain entries
Stoiko Ivanov [Mon, 12 Apr 2021 19:28:31 +0000 (21:28 +0200)]
acme: allow wildcard domain entries

Reported in our community forum [0], support for wildcard certificates
via ACME sounds like a good enhancement (especially for PMG).

In order for this to work you need to configure the wild-card
sub-entry (*.domain.example) as ACME domains and be able to verify
that via a DNS Plugin.
This is best described in the announcement by Let's Encrypt announcing
wildcard certificate support [1], or the dns challenge type
documentation[2].

Quickly tested with a domain of mine (and the powerdns plugin)

[0]: https://forum.proxmox.com/threads/feature-request-add-wildcard-support-for-acme.87495/
[1]: https://community.letsencrypt.org/t/acme-v2-production-environment-wildcards/55578
[2]: https://letsencrypt.org/docs/challenge-types/#dns-01-challenge

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2228: automatically deliver/delete on whitelist/blacklist
Thomas Lamprecht [Tue, 30 Mar 2021 15:05:47 +0000 (17:05 +0200)]
fix #2228: automatically deliver/delete on whitelist/blacklist

If a user chooses to blacklist a specific sender of a mail, the mail
is highly probably undesired too, so delete it in that case.

The reverse should hold for white listing a mail's sender, deliver it
in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoquarantine/content: better error message for internal error
Thomas Lamprecht [Tue, 30 Mar 2021 09:09:14 +0000 (11:09 +0200)]
quarantine/content: better error message for internal error

should really not happen, but if (e.g., enum gets adaped) it is good
to know the actual value triggering it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-3
Thomas Lamprecht [Fri, 26 Mar 2021 18:09:49 +0000 (19:09 +0100)]
bump version to 6.4-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: rephrase notification mail
Stoiko Ivanov [Tue, 23 Mar 2021 16:45:47 +0000 (17:45 +0100)]
pbs: rephrase notification mail

currently the provided logs are not too detailed.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 6.4-3
Stoiko Ivanov [Fri, 26 Mar 2021 17:53:18 +0000 (18:53 +0100)]
bump version to 6.4-3

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agomailqueue: fixup rmtree/mkpath usage
Stoiko Ivanov [Fri, 26 Mar 2021 17:43:56 +0000 (18:43 +0100)]
mailqueue: fixup rmtree/mkpath usage

the mkpath and rmtree functions [0] seem to interpret their
second and third argument as 'verbose' and 'mode', leading to
wrongly created spooldirs.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 6.4-2
Thomas Lamprecht [Tue, 23 Mar 2021 07:30:51 +0000 (08:30 +0100)]
bump version to 6.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofixup check for statement execute
Thomas Lamprecht [Tue, 23 Mar 2021 07:29:43 +0000 (08:29 +0100)]
fixup check for statement execute

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-1
Thomas Lamprecht [Mon, 22 Mar 2021 16:30:41 +0000 (17:30 +0100)]
bump version to 6.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3164: api: quarantine: allow to return spam from all users
Thomas Lamprecht [Mon, 22 Mar 2021 07:49:55 +0000 (08:49 +0100)]
fix #3164: api: quarantine: allow to return spam from all users

The pmail was only checked for the spam quarantine call, and there
mainly to ensure that the quarantine user only can check their own
mails. Make the pmail parameter also optional for this quarantine
related endpoint as long as one has a role other than quser.
This allows to query all spam quarantine entries from all pmails at
once, providing the backend side to address #3164.

The main argument against this was performance, but postgres can
handle even hundreds of thousands of rows rather fine, it's a high
performant database after all and this is quite the simple query
(single join, but no functions on columns, nested queries or other
performance hogs).

Some data, 45k records on a read limited disk, gathered with EXPLAIN
ANALYZE commands:

All caches dropped and fresh start: 440ms
Running for a bit with caches warm:  55ms

A simple extrapolation would mean that for half a million rows we
would spent about 5s in the DB, which is not too bad considering our
hard limit of 30s per requests, and the overhead of perl/https seems
to put the limit on my not so beefy VM at at least ~1.5 million rows
from a *cold* cache, which seems plenty (default 7 days keep window
and an avg. of 10 spam mails per day means >21k qusers). And with
warm caches and a beefier machine one can probably gain one or even
two order of magnitudes here.

And at the end, no mail admin is forced to use this and if they run a
setup with tens of millions of spam in their spam-keep time window,
well, they really should not be surprised that querying all has a
certain cost.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agotypo fixes all over the place
Thomas Lamprecht [Sun, 21 Mar 2021 18:18:07 +0000 (19:18 +0100)]
typo fixes all over the place

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopmgproxy: server widget toolkit image directory
Thomas Lamprecht [Fri, 19 Mar 2021 18:03:32 +0000 (19:03 +0100)]
pmgproxy: server widget toolkit image directory

so that the pmx-clear-trigger CSS class from the widget toolkit can
be used

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: certs: drop unused variable
Thomas Lamprecht [Thu, 18 Mar 2021 16:02:02 +0000 (17:02 +0100)]
api: certs: drop unused variable

commit 1ecf138e1729dee908431673b73ac5baf8fd35a9 forgot to remove the
variable it changes made useless

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agounify File::path use
Thomas Lamprecht [Thu, 18 Mar 2021 15:58:53 +0000 (16:58 +0100)]
unify File::path use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocerts: reload postfix to activate new certificate
Stoiko Ivanov [Thu, 18 Mar 2021 15:14:49 +0000 (16:14 +0100)]
certs: reload postfix to activate new certificate

the current logic for reloading postfix only does so if the tls config
parameter changes (after rewriting the config files).
this does not cover the case where a certificate is replaced in a
setup, which already has tls enabled (config stays the same, so
postfix does not get reloaded)

the issue is mostly cosmetic, since postfix does eventually fork off
new smtpd instances, which read the files from disk, but it's
inconvenient, when trying out the new acme integration, and then
running a ssl-check on your PMG from external just to see that the
certificate was not updated.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agocluster: use old and new fingerprint on master
Stoiko Ivanov [Thu, 18 Mar 2021 15:14:48 +0000 (16:14 +0100)]
cluster: use old and new fingerprint on master

when triggering a fingerprint update on master right after reloading
pmgproxy as we do for ACME certificates it can happen that the
connection is made against the old pmgproxy process (with the old
fingerprint). Simply trusting both fingerprints in that case seems
acceptable from a security perspective and makes the fingerprint
update more robust

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoacme: recursively create account directory
Stoiko Ivanov [Thu, 18 Mar 2021 15:14:47 +0000 (16:14 +0100)]
acme: recursively create account directory

to account for the new layout

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agopackage: ship /etc/pmg/acme/accounts in deb
Stoiko Ivanov [Thu, 18 Mar 2021 15:14:46 +0000 (16:14 +0100)]
package: ship /etc/pmg/acme/accounts in deb

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 6.3-7
Thomas Lamprecht [Thu, 18 Mar 2021 10:05:24 +0000 (11:05 +0100)]
bump version to 6.3-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonode config: add format_description for 'usage' property
Thomas Lamprecht [Thu, 18 Mar 2021 10:15:04 +0000 (11:15 +0100)]
node config: add format_description for 'usage' property

the docs API schema dumper requires it

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorearrange acme files
Wolfgang Bumiller [Thu, 18 Mar 2021 08:51:58 +0000 (09:51 +0100)]
rearrange acme files

Old layout:
  /etc/pmg/acme-plugins.conf
  /etc/pmg/acme/<account_name>

New layout:
  /etc/pmg/acme/plugins.conf
  /etc/pmg/acme/accounts/<account_name>

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agofix revocation of old certificate on renewal
Wolfgang Bumiller [Wed, 17 Mar 2021 10:12:18 +0000 (11:12 +0100)]
fix revocation of old certificate on renewal

in PMG key and certificate are in the same file so we need
to extract the certificate (like in the revoke api call)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocheck acme cert expiration in pmg-daily
Wolfgang Bumiller [Wed, 17 Mar 2021 10:02:16 +0000 (11:02 +0100)]
check acme cert expiration in pmg-daily

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd PMG::NodeConfig::filter_domains_by_type helper
Wolfgang Bumiller [Wed, 17 Mar 2021 10:02:15 +0000 (11:02 +0100)]
add PMG::NodeConfig::filter_domains_by_type helper

for reuse

The private $filter_domains is still there to do the
in-place modification it did before.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosupport forced account deactivation
Wolfgang Bumiller [Wed, 17 Mar 2021 10:02:14 +0000 (11:02 +0100)]
support forced account deactivation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd missing use statement
Wolfgang Bumiller [Wed, 17 Mar 2021 10:02:13 +0000 (11:02 +0100)]
add missing use statement

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopmgcm: use minus for join-command, alias for compat
Thomas Lamprecht [Tue, 16 Mar 2021 18:12:45 +0000 (19:12 +0100)]
pmgcm: use minus for join-command, alias for compat

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopmgcm: do not error out if not a cluster
Thomas Lamprecht [Tue, 16 Mar 2021 18:03:32 +0000 (19:03 +0100)]
pmgcm: do not error out if not a cluster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopmgcm: drop 'trigger' from 'update-fingerprints' name
Thomas Lamprecht [Tue, 16 Mar 2021 18:03:06 +0000 (19:03 +0100)]
pmgcm: drop 'trigger' from 'update-fingerprints' name

one verb is enough

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocluster: whitespace/indentation fixes
Thomas Lamprecht [Tue, 16 Mar 2021 18:02:17 +0000 (19:02 +0100)]
cluster: whitespace/indentation fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: cluster/update-fingerprint: code cleanups and iterate sorted
Thomas Lamprecht [Tue, 16 Mar 2021 18:01:03 +0000 (19:01 +0100)]
api: cluster/update-fingerprint: code cleanups and iterate sorted

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: certificates: trigger fingerprint update
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:35 +0000 (23:01 +0100)]
api: certificates: trigger fingerprint update

in clustered systems, so that the cluster-sync remains possible with
the new certificate.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopmgcm: add trigger-update-fingerprint
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:34 +0000 (23:01 +0100)]
pmgcm: add trigger-update-fingerprint

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocluster: add trigger_update_fingerprints
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:33 +0000 (23:01 +0100)]
cluster: add trigger_update_fingerprints

this commit adds a method that sends a POST request to
'/config/cluster/update-fingerprints' on the master node in a cluster.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: cluster: add update-fingerprints call
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:32 +0000 (23:01 +0100)]
api: cluster: add update-fingerprints call

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocluster: add helper to get remote cert fingerprint
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:31 +0000 (23:01 +0100)]
cluster: add helper to get remote cert fingerprint

via ssh executing 'openssl x509'

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocluster: refactor rsync_command
Stoiko Ivanov [Mon, 15 Mar 2021 22:01:30 +0000 (23:01 +0100)]
cluster: refactor rsync_command

pull out the ssh part for later reusal

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: cert order: print details for failed challenge if available
Thomas Lamprecht [Tue, 16 Mar 2021 17:02:18 +0000 (18:02 +0100)]
api: cert order: print details for failed challenge if available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: certs: sort hash keys, just to be sure
Thomas Lamprecht [Tue, 16 Mar 2021 16:43:52 +0000 (17:43 +0100)]
api: certs: sort hash keys, just to be sure

knowing perl this is just nicer and should never be an issue as
without it they will be scrambled around on each run anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: acme order: fix check for configured domains
Thomas Lamprecht [Tue, 16 Mar 2021 13:43:01 +0000 (14:43 +0100)]
api: acme order: fix check for configured domains

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd acme and cert subcommands to pmgconfig
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:15 +0000 (11:24 +0100)]
add acme and cert subcommands to pmgconfig

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoadd node-config api entry points
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:14 +0000 (11:24 +0100)]
add node-config api entry points

adds /nodes/{nodename}/config to access node config

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoadd certificates api endpoint
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:13 +0000 (11:24 +0100)]
add certificates api endpoint

This adds /nodes/{nodename}/certificates endpoint
containing:

  /custom/{type} - update smtp or api certificates manually
  /acme/{type} - update via acme

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoapi: add ACME and ACMEPlugin module
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:12 +0000 (11:24 +0100)]
api: add ACME and ACMEPlugin module

This adds the cluster-wide acme account and plugin
configuration:

   * /config/acme
   |`+ account/
   | '- {name}
   |`- tos
   |`- directories
   |`- challenge-schema
    `+ plugins/
     '- {name}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agocluster: sync acme/ and acme-plugins.conf
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:11 +0000 (11:24 +0100)]
cluster: sync acme/ and acme-plugins.conf

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoadd PMG::NodeConfig module
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:10 +0000 (11:24 +0100)]
add PMG::NodeConfig module

for node-local configuration, currently only containing acme
domains/account choices

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoadd PMG::CertHelpers module
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:09 +0000 (11:24 +0100)]
add PMG::CertHelpers module

Contains helpers to update certificates and provide locking
for certificates and when accessing acme accounts.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agodepend on libpmg-rs-perl and proxmox-acme
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:08 +0000 (11:24 +0100)]
depend on libpmg-rs-perl and proxmox-acme

This contains `PMG::RS::Acme` and `PMG::RS::CSR` which are
used for letsencrypt certificates.

Note that for the DNS plugins this still uses the perl code
from proxmox-acme for now.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.3-6
Thomas Lamprecht [Fri, 5 Mar 2021 21:48:17 +0000 (22:48 +0100)]
bump version to 6.3-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: add notify parameter to 'classic' backup
Stoiko Ivanov [Mon, 1 Mar 2021 14:12:20 +0000 (15:12 +0100)]
backup: add notify parameter to 'classic' backup

for feature-parity, and since we recently had a user in our community
forum, who does regular backups via cron+rsync (small site w/o
dedicated backup host). Those setups could also benefit from this.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: fix #3146 add email notifications
Stoiko Ivanov [Mon, 1 Mar 2021 14:12:19 +0000 (15:12 +0100)]
backup: fix #3146 add email notifications

this patch addresses the missing email notification for scheduled
backup related tasks, which we have in all our other products, for our
mail product.

the parameter names are inspired by PBS' datastore config.

the default is 'never' in order to stay consistent with the current
code.

it uses the templateing system for the notification, because this
results in less code and a bit of added flexibility for the users.

the recipient address is currently hardcoded to the admin address in
pmg.conf as we also send the (admin) pmgreport there, and I did not
want to overengineer this (even more).

I shortly considered adding a $SIG{'__DIE__'} handler to the
run_backup API call but dropped the idea due to the warning in
perlvar(1).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: pbs: prevent race in concurrent backups
Stoiko Ivanov [Mon, 1 Mar 2021 14:12:18 +0000 (15:12 +0100)]
backup: pbs: prevent race in concurrent backups

If two pbs backup-creation calls happen simultaneously, it is possible
that the first removes the backup dir before the other is done
creating or sending it to the pbs remote.

This patch takes the same route as non-PBS backups - creating a unique
tempdir indexed by remote, PID and current time.

the tmp-dir now also needs to be removed in case of error while
backing up. (before the next invocation would have wiped it).

Noticed while having 2 schedules to different PBS instances with the
same interval and w/o random delay.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodebian: add some OK lintian overrides
Thomas Lamprecht [Thu, 25 Feb 2021 09:40:18 +0000 (10:40 +0100)]
debian: add some OK lintian overrides

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomakefile: fix missing trailing backslash and whitespace errors
Thomas Lamprecht [Thu, 25 Feb 2021 09:37:01 +0000 (10:37 +0100)]
makefile: fix missing trailing backslash and whitespace errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3154: backup: add 'include-statistics' to pbs
Stoiko Ivanov [Wed, 24 Feb 2021 18:30:59 +0000 (19:30 +0100)]
fix #3154: backup: add 'include-statistics' to pbs

This patch addresses part of #3154 - by adding the parameter
'include-statistics' for each remote in /etc/pmg/pbs/pbs.conf.

The other part (actively asking the user whether to include it) is GUI
only, since the API already has the paramter for backup calls.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: fix die invocation
Stoiko Ivanov [Wed, 24 Feb 2021 18:30:58 +0000 (19:30 +0100)]
backup: fix die invocation

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: get_detail_statistics: rework param passing
Thomas Lamprecht [Wed, 10 Feb 2021 09:44:33 +0000 (10:44 +0100)]
api: get_detail_statistics: rework param passing

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoutils: allow '/' inside email address localpart
Stoiko Ivanov [Tue, 2 Feb 2021 13:03:16 +0000 (14:03 +0100)]
utils: allow '/' inside email address localpart

The change is motivated by a report in our community forum [0], where
a mail addressed to an address containing '/' in its local-part ended
up in the quarantine.
This is permitted by RFC5322 ([1]), and, probably more relevant,
happily accepted and processed by postfix.

Once inside the quarantine (or the statistic database) the records cannot
be displayed (due to the parameter verification failure).

This leaves the user unable to delete the quarantined mail.

Apart from the quarantine and statistics the 'pmg-email-address'
format is only used in the PBSConfig and the fetchmail configuration
(both of which are available only to the admin and can be still be
edited irrespective of the set localpart).

[0]
https://forum.proxmox.com/threads/pmg-error-parameter-verification-failed-400.82353/
[1] https://tools.ietf.org/html/rfc5322

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: statistics: add common method for details
Stoiko Ivanov [Tue, 2 Feb 2021 13:03:15 +0000 (14:03 +0100)]
api: statistics: add common method for details

This patch changes adds a new method, which yields the detail statistics
for a particular address.

Depending on the provided type argument it returns the same information as
the contact/sender/receiver detail calls.

This allows the statistics to be displayed for addresses containing
'/' in their localpart, once this is permitted in our api schema.

the idea follows a similar change for the user blocklists in
e8d909c11faeb5a4f84f39ef50e0eaf8ea65046d

By adding a new API method we can eventually drop the old methods with 7.0

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: statistics: refactor detail calls
Stoiko Ivanov [Thu, 21 Jan 2021 15:51:04 +0000 (16:51 +0100)]
api: statistics: refactor detail calls

the API calls returning the detailed statistics for a particular
email use much common code.
This patch introduces a sub to be used in all detail api calls.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: statistics: refactor return for detail calls
Stoiko Ivanov [Thu, 21 Jan 2021 15:51:03 +0000 (16:51 +0100)]
api: statistics: refactor return for detail calls

all api methods returning information for a particular sender,
receiver or contact have similar returns.

This commit pulls the common ones out into a sub like the common method
parameters in $default_properties.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: statistics: remove unneeded RESTEnvironment
Stoiko Ivanov [Thu, 21 Jan 2021 15:51:02 +0000 (16:51 +0100)]
api: statistics: remove unneeded RESTEnvironment

none of the API calls in PMG::API2::Statistics use the
RESTEnvironment - so remove the unused code.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agopmg-daily: run sa-update for local channels
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:15 +0000 (11:38 +0100)]
pmg-daily: run sa-update for local channels

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: spamassassin: update local channels
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:14 +0000 (11:38 +0100)]
api: spamassassin: update local channels

This patch adds a helper to loop over all present Spamassassin
channels files in /etc/mail/spamassassin/channel.d and:
* import the included gpg key into sa-update's keyring
* run sa-update for each channel separately

the verbose argument of the helper is for reusing the code in
pmg-daily (where we only want to log errors and be less informative)

the $SA_UPDATE variable hardcoding the path of /usr/bin/sa-update was
dropped in favor of using 'sa-update' without path since we do have a
sensible setting of PATH everywhere, and hardcoding paths is
problematic (especially in usr-merged systems).

The choice of invoking sa-update for each channel separately, instead
of providing multiple '--channel' and '--gpgkey' options to a single
command was made to prevent downloading signatures, which were signed
by a key not configured for the channel.

Importing gpg-keys is also done with individual sa-update invocations,
because sa-update only imports the last present --import argument
(wrong use of Getopt::Long)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: spamassassin: read local channels
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:13 +0000 (11:38 +0100)]
api: spamassassin: read local channels

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoadd helper for parsing SA channel.d files
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:12 +0000 (11:38 +0100)]
add helper for parsing SA channel.d files

RHEL/CentOS based SpamAssassin implementations ship an update script,
which reads shell snippets from
/etc/mail/spamassassin/channel.d/*.conf and uses the information there
to update SA rules from the configured channels [0].

Noticed the existence of this directory/mechanism while reading the
announcement of the updatechannel for the KAM ruleset [1].

Parsing the file as text, instead of sourcing it in a shell, since I
hope that the channel files distributed don't rely on running commands
to get the ruleset url and gpg key.

The parser has some minimal tests added (inspired by the
convert_size_test.pl from pve-common)

[0] https://src.fedoraproject.org/rpms/spamassassin/blob/master/f/sa-update.cronscript
[1] https://mcgrail.com/template/kam.cf_channel

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobuildsys: fix PERLLIB setting in tests/Makefile
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:11 +0000 (11:38 +0100)]
buildsys: fix PERLLIB setting in tests/Makefile

Make variables don't need quoting - and with quotes the PERLLIB is
literally set to ".." instead of .. (only the latter works)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobuildsys: fix check target in main Makefile
Stoiko Ivanov [Tue, 19 Jan 2021 10:38:10 +0000 (11:38 +0100)]
buildsys: fix check target in main Makefile

the tests are in src/ - the test target in the main Makefile still
tries to run them in the main directory.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobuild-depends: remove dh-systemd
Dietmar Maurer [Thu, 19 Nov 2020 07:39:31 +0000 (08:39 +0100)]
build-depends: remove dh-systemd

no longer required

3 years agobump version to 6.3-5
Thomas Lamprecht [Wed, 25 Nov 2020 09:21:55 +0000 (10:21 +0100)]
bump version to 6.3-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoutils: ignore leading whitespace in sa description
Stoiko Ivanov [Thu, 19 Nov 2020 15:48:39 +0000 (16:48 +0100)]
utils: ignore leading whitespace in sa description

load_sa_descriptions is used to parse the 'describe' lines for SpamAssassin
rules for the SpamInfo in the quarantine view.

The regex for parsing is too strict, since config lines can contain
leading whitespace (e.g. due to indentation in an 'ifplugin' block)

checked Mail::SpamAssassin::Conf::Parser and they strip leading/trailing
whitespace as well.

tested on my local setup with a quarantined mail which hit KAM_DMARC_STATUS.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoapi: termproxy: adapt to newer PVE/PBS interface
Thomas Lamprecht [Wed, 25 Nov 2020 09:17:23 +0000 (10:17 +0100)]
api: termproxy: adapt to newer PVE/PBS interface

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-4
Thomas Lamprecht [Wed, 18 Nov 2020 18:53:01 +0000 (19:53 +0100)]
bump version to 6.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoremove debug code
Thomas Lamprecht [Wed, 18 Nov 2020 18:52:18 +0000 (19:52 +0100)]
remove debug code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-3
Thomas Lamprecht [Wed, 18 Nov 2020 18:47:09 +0000 (19:47 +0100)]
bump version to 6.3-3

...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofixup: use File::Path qw(rmtree)
Thomas Lamprecht [Wed, 18 Nov 2020 18:46:40 +0000 (19:46 +0100)]
fixup: use File::Path qw(rmtree)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-2
Thomas Lamprecht [Wed, 18 Nov 2020 18:24:55 +0000 (19:24 +0100)]
bump version to 6.3-2

re use previous changelog, it's just a small bug fix after all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: pbs: remove state after backup
Stoiko Ivanov [Wed, 18 Nov 2020 17:59:35 +0000 (18:59 +0100)]
api: pbs: remove state after backup

else left-over files will continue to be included (e.g. statistics database)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agopbs: api: add statistic parameter to run_backup
Stoiko Ivanov [Wed, 18 Nov 2020 17:59:34 +0000 (18:59 +0100)]
pbs: api: add statistic parameter to run_backup

Without it the backup does not include the statistics database

Reported-by: Martin Maurer <martin@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 6.3-1
Thomas Lamprecht [Wed, 18 Nov 2020 16:59:45 +0000 (17:59 +0100)]
bump version to 6.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: bump versioned dependency on pve-common
Thomas Lamprecht [Wed, 18 Nov 2020 17:00:34 +0000 (18:00 +0100)]
d/control: bump versioned dependency on pve-common

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoquarantine: user self service: add some response delays
Thomas Lamprecht [Wed, 18 Nov 2020 16:45:00 +0000 (17:45 +0100)]
quarantine: user self service: add some response delays

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>