]> git.proxmox.com Git - pmg-api.git/log
pmg-api.git
4 years agopurge attachment quarantine with spamlifetime
Dominik Csapak [Thu, 10 Oct 2019 09:22:01 +0000 (11:22 +0200)]
purge attachment quarantine with spamlifetime

so that they get removed with the same lifetime as the spam quarantine

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoDBTools: add new default rule/objects for attachment quarantine
Dominik Csapak [Thu, 10 Oct 2019 09:22:00 +0000 (11:22 +0200)]
DBTools: add new default rule/objects for attachment quarantine

the new rule is disabled by default

also adapt the ruledb test for default rules

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoAPI2/Quarantine: add attachment quarantine api paths
Dominik Csapak [Thu, 10 Oct 2019 09:21:59 +0000 (11:21 +0200)]
API2/Quarantine: add attachment quarantine api paths

this introduces 3 new api paths in /quarantine/

* GET attachment
  lists all mails in the attachment quarantine, similar to the virus one

* GET listattachments
  lists all attachments for a specific mail in the quarantine

* GET download
  serves the attachment of a mail as a download to the user

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoRuleDB/Remove: add attachment quarantine option
Dominik Csapak [Thu, 10 Oct 2019 09:21:58 +0000 (11:21 +0200)]
RuleDB/Remove: add attachment quarantine option

So that users can choose to copy the mail to the attachment quarantine,
if they remove some (or all attachments)

also add 'ldap' parameter to execute (will be called with it in
pmg-smtp-filter) to pass it on to 'quarantine_mail'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoRuleDB/Remove: improve attachment detection for 'remove all'
Dominik Csapak [Thu, 10 Oct 2019 09:21:57 +0000 (11:21 +0200)]
RuleDB/Remove: improve attachment detection for 'remove all'

this patch improves the attachment detection in such a way that
instead of leaving the first part if it has a content-type of
text/* and removing all other parts we now leave the 'real' message, meaning:

* the first text/plain or text/html part if no multipart
* the first text/plain or text/html part if multipart/mixed
* all text/plain and text/html parts of the first multipart/alternative
  (if we did not already see the message)

this way the 'real' message including the text/html alternative
(or the only text/html part if no text/plain was sent) is
left in the message that is being sent to the receiver

also add missing '$rulename' parameter to the recursive call to
'delete_marked_parts'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoAPI2/Quarantine: refactor quarantine listing api
Dominik Csapak [Thu, 10 Oct 2019 09:21:56 +0000 (11:21 +0200)]
API2/Quarantine: refactor quarantine listing api

will be again used for the attachment quarantine

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoMailQueue: prepare for attachment quarantine
Dominik Csapak [Thu, 10 Oct 2019 09:21:55 +0000 (11:21 +0200)]
MailQueue: prepare for attachment quarantine

create the spooldir for the attachment quarantine, as well as
allow quarantining into it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agouse the refactored helpers from PMG::MIMEUtils
Dominik Csapak [Thu, 10 Oct 2019 09:21:54 +0000 (11:21 +0200)]
use the refactored helpers from PMG::MIMEUtils

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoadd PMG::MIMEUtils helper package
Dominik Csapak [Thu, 10 Oct 2019 09:21:53 +0000 (11:21 +0200)]
add PMG::MIMEUtils helper package

this package provides some often used MIME funcionality that we use

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoHTTPServer: extend download functionality
Dominik Csapak [Thu, 10 Oct 2019 09:21:52 +0000 (11:21 +0200)]
HTTPServer: extend download functionality

allow object as return value for 'download' api calls
this way, we can give additional information for download apis
(like the content-type and if it should be deleted after)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoRuleDB: load_object: do explicit return
Thomas Lamprecht [Tue, 8 Oct 2019 06:17:46 +0000 (08:17 +0200)]
RuleDB: load_object: do explicit return

While perl5 returns the result of the last expression implicitly, if
no explicit return statement is in a submethod's code path, it's much
nicer to do the things explicit most of the times, and a slight
modification could even break this.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix result verification for invalid mails
Dominik Csapak [Mon, 30 Sep 2019 12:55:30 +0000 (14:55 +0200)]
fix result verification for invalid mails

in case we cannot parse the mail to produce any sensible html/text
output, we got a 'result verification error', instead show 'No Content'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump version to 6.0-6
Thomas Lamprecht [Mon, 9 Sep 2019 06:06:18 +0000 (08:06 +0200)]
bump version to 6.0-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2360: cluster: reload pmg-smtp-filter on rulechange
Stoiko Ivanov [Fri, 6 Sep 2019 13:30:15 +0000 (15:30 +0200)]
fix #2360: cluster: reload pmg-smtp-filter on rulechange

When a node detects a change of the rule-database during clustersync,
the database update got done, however the running `pmg-smtp-filter`
instance was not notified of the updated ruleset. Adding a call to
PMG::DBTools::reload_ruledb (like in the API2 paths) fixes the issue.

As this is guarded by a digest change check it'll only reload if the
ruleDB really changed.

We do not pass the currewnt ruleDB instance to the reload method, as
it is only used for "rewrite_postfix_whitelist", which is already
executed through the pmgmirror::cluster_sync call to
PMG::Config->rewrite_config, if needed, so don't do that twice.

Tested by
* creating a 2 node PMG cluster
* adding and removing e-mail-addresses to the Blacklist (which was used in
  a high priority, active rule)
* sending e-mails from those addresses through PMG
* observing the action taken before/after the Rule DB got synced

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoFix #2224: override reference to openspf.org
Stoiko Ivanov [Mon, 2 Sep 2019 15:35:34 +0000 (17:35 +0200)]
Fix #2224: override reference to openspf.org

This is a fix for a small cosmetic issue, which keeps coming up on our various
support-channels:
pmgpolicy as user of 'Mail::SPF::Server' logs lines referencing the (now
defunct) url: http://www.openspf.org/Why

By overriding 'default_authority_explanation' [0] the logs now contain a simple
logmessage without any reference to an external url.

All macros used before are used in the new message as well, so the information
content stays the same.

Given that we are (by far) not the only users of this module I additionally
opened an issue upstream [1] (and linked it to the debian bug-report [2]).

Tested by providing a SPF policy not allowing the ip of the sender in my
testsetup and observing the logs.

[0] https://metacpan.org/pod/Mail::SPF::Server
[1] https://rt.cpan.org/Public/Bug/Display.html?id=130413
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930032

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agobump version to 6.0-5
Thomas Lamprecht [Wed, 28 Aug 2019 12:52:08 +0000 (14:52 +0200)]
bump version to 6.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi mime: code cleanup
Thomas Lamprecht [Wed, 28 Aug 2019 12:30:56 +0000 (14:30 +0200)]
api mime: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi mime: really return mimetypes, not undef
Thomas Lamprecht [Wed, 28 Aug 2019 12:29:23 +0000 (14:29 +0200)]
api mime: really return mimetypes, not undef

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-4
Thomas Lamprecht [Fri, 23 Aug 2019 09:30:59 +0000 (11:30 +0200)]
bump version to 6.0-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoclamav config: improve some descriptions
Thomas Lamprecht [Tue, 20 Aug 2019 12:03:44 +0000 (14:03 +0200)]
clamav config: improve some descriptions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoclose #2324 - improve docs on encrypted archives
Stoiko Ivanov [Mon, 19 Aug 2019 16:32:14 +0000 (18:32 +0200)]
close #2324 - improve docs on encrypted archives

The option for ClamAV 'Block Encrypted Archives and Documents', actually
triggers a Heuristic match from ClamAV, which is used by PMG to rais the
spam score of a message by the value of 'Heuristic Score' configured
at the 'Spam Detector' settings.

Since this has caused confusion (also for myself) a few times already, this
patch tries to address the issue by referring to the other option in the API
description of both properties

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agobump version to 6.0-3
Thomas Lamprecht [Sat, 17 Aug 2019 11:05:47 +0000 (13:05 +0200)]
bump version to 6.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmgproxy: add link to extjs for api-viewer
Thomas Lamprecht [Sat, 17 Aug 2019 10:45:12 +0000 (12:45 +0200)]
pmgproxy: add link to extjs for api-viewer

allows us to remove the external loading of extjs from the cloudflare
cdn in pmg-docs easier with having the external hosted version in
mind.

Adapted from the pveproxy version [0] with the same goal.

[0]: https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=eb65703b55ce97df59d82404fcdd6f6831658158

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoimprove csrf backward compatibility
Stoiko Ivanov [Fri, 16 Aug 2019 14:02:23 +0000 (16:02 +0200)]
improve csrf backward compatibility

this patch follows the code in pve-access-control
e149b1c6c9954c07672d63f23f696d5b1e6c11d4)

and should enable us to update pve-common in PMG 5.x along with PVE again.

Tested by:
* logging into PMG (get csrf token)
a) installing only the previous patch:
   * POSTing (with the previously obtained token) -> 401
b) installing previous and this patch
   * POSTing (with the previously obtained token) -> 200

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agouse hmac_sha_256 for csrf token
Oguz Bektas [Fri, 16 Aug 2019 14:02:22 +0000 (16:02 +0200)]
use hmac_sha_256 for csrf token

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agobump version to 6.0-1+3
Thomas Lamprecht [Tue, 13 Aug 2019 13:48:13 +0000 (15:48 +0200)]
bump version to 6.0-1+3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agomake journal parsing more robust
Fabian Grünbichler [Fri, 9 Aug 2019 10:17:36 +0000 (12:17 +0200)]
make journal parsing more robust

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoadapt journalctl invocation to buster
Stoiko Ivanov [Fri, 9 Aug 2019 07:07:30 +0000 (09:07 +0200)]
adapt journalctl invocation to buster

With Debian Buster the behavior of `journalctl` has changed when it finds
no entries for a given selection:
* The exit code was 0 in stretch, but is 1 in buster
* The output changed slightly - a header got added

Since PMG::Utils::scan_journal_for_rbl_rejects uses journalctl for reading the
IPs blocked by postscreen it needs to adapt for the new behavior (otherwise
run_command dies because of the exit code 1)

The patch addresses the problem by using the json-output of `journalctl`, which
still exits with 0 if no entries are present . Additionally the json-output
adds the current cursor to the output by default, removing the need to
explicitly scanning for it.(the exit code of 1 was due to '--show-cursor'
without a single result line).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agobump version to 6.0-1+2
Fabian Grünbichler [Fri, 9 Aug 2019 07:00:45 +0000 (09:00 +0200)]
bump version to 6.0-1+2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoadapt clamav.conf.in to new upstream version
Stoiko Ivanov [Thu, 8 Aug 2019 16:09:22 +0000 (18:09 +0200)]
adapt clamav.conf.in to new upstream version

The new version of clamav has changed a few options, which we ship in our
config template - see [0] for the details.
This patch changes all affected options to the new names and additionally
expands the Description of 'archiveblockencrypted' to reflect that the option
is used for both archives _and_ documents.

[0] https://blog.clamav.net/2018/12/clamav-01010-has-been-released.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoadapt postgresql.conf template to variable version
Stoiko Ivanov [Thu, 8 Aug 2019 13:36:11 +0000 (15:36 +0200)]
adapt postgresql.conf template to variable version

pass the postgres major version in template_vars->{postgres}->{version} and
use that in the template. Additionally use the version for the config file
location.

The start and end tags are changed to '<*' and '*>' since the original
postgresql.conf contains an occurence of the default start tag '[%' which
would need to get escaped

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoadd get_pg_server_version in PMG::Utils
Stoiko Ivanov [Thu, 8 Aug 2019 13:36:10 +0000 (15:36 +0200)]
add get_pg_server_version in PMG::Utils

PMG renders the postgresql.conf through its templating system (currently the
shipped template does not use any variables). postgresql.conf (in most
installations and in both debian and upstream packages) contains a few
occurrences (datadir, config files, pid-file, cluster name) of the postgres
major version number (see [0], for a description and why 9.6 and 11 are major
version numbers). The rendered config should use the correct version number
for the config of the currently used postgres installation (the one listening
on the default port (5432) and socket).

This fixes a bug observed while testing the upgrade to buster and postgres 11:
* a long running service (pmgmirror, pmgdaemon) still has the old config
  path in memory (/etc/postgresql/9.6/)
* while upgrading the pmg-api package the shipped template changes to one
  with the new major number (11)
* the next restart of the postgresql cluster fails, with an error not directly
  related to the broken config file

By reading [1] the version number through a connection to the current
postgresql server we rewrite the fitting configfile with the correct paths.

[0] https://www.postgresql.org/support/versioning/
[1] https://www.postgresql.org/docs/11/runtime-config-preset.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agomove postgres_admin_command into PMG::Utils
Stoiko Ivanov [Thu, 8 Aug 2019 13:36:09 +0000 (15:36 +0200)]
move postgres_admin_command into PMG::Utils

Take postgres_admin_command from PMG::DBTools and put it in PMG::Utils.
This avoids a cyclic dependency (PMG::DBTools calls
PMG::Config::rewrite_postfix_whitelist when reloading the RuleDB, and
PMG::Config needs access to the Postgres major version for rendering
the postgresql.conf)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoWhat: Spam: add uri hits to rule description
Dominik Csapak [Thu, 8 Aug 2019 08:49:14 +0000 (10:49 +0200)]
What: Spam: add uri hits to rule description

this is for the header info only, since we do not save the description
in the quarantine db

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoWho: Domain: improve speed
Dominik Csapak [Thu, 8 Aug 2019 08:49:13 +0000 (10:49 +0200)]
Who: Domain: improve speed

a split is about 20% faster than doing a regex match here, for
a typical email address and domain
(benchmarked with Benchmark::cmpthese)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agopostinst: always use pmgconfig sync --restart
Fabian Grünbichler [Mon, 29 Jul 2019 12:45:11 +0000 (14:45 +0200)]
postinst: always use pmgconfig sync --restart

since that already checks whether we need to reload the services,
'pmgconfig sync' alone only updates the config files..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoreplace /var/run with /run
Fabian Grünbichler [Mon, 29 Jul 2019 12:45:12 +0000 (14:45 +0200)]
replace /var/run with /run

since the former has been a symlink to the latter since forever.

systemd >= Buster will print lots of noisy messages regarding outdated
PIDFile paths if they point to /var/run.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agopmgsh: assemble ticket later
Fabian Grünbichler [Mon, 29 Jul 2019 12:45:10 +0000 (14:45 +0200)]
pmgsh: assemble ticket later

otherwise this fails when verifying the API in a clean build
environment, where no private key exists.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomimetypes: load on first access
Fabian Grünbichler [Mon, 29 Jul 2019 12:45:09 +0000 (14:45 +0200)]
mimetypes: load on first access

otherwise this generated file needs to be available at (docs) build
time, which is not the case in a clean chroot.

caching per worker remains identical.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add missing build-dependency
Fabian Grünbichler [Mon, 29 Jul 2019 12:45:08 +0000 (14:45 +0200)]
d/control: add missing build-dependency

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agopostinst: make service reload/restart more robust
Fabian Grünbichler [Mon, 29 Jul 2019 09:24:53 +0000 (11:24 +0200)]
postinst: make service reload/restart more robust

like debhelper would do when generating such snippets.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agorestart postfix after first installing pmg-api
Dominik Csapak [Fri, 26 Jul 2019 09:23:34 +0000 (11:23 +0200)]
restart postfix after first installing pmg-api

when installing on debian, restarting postfix is necessary for it
to change the bind address (default is 127.0.0.1)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoupdate our sources .list to buster
Thomas Lamprecht [Wed, 24 Jul 2019 19:22:12 +0000 (21:22 +0200)]
update our sources .list to buster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-1+1
Thomas Lamprecht [Wed, 24 Jul 2019 19:21:55 +0000 (21:21 +0200)]
bump version to 6.0-1+1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobetter postgres 11 compat in config/pidfile path references
Thomas Lamprecht [Wed, 24 Jul 2019 19:10:41 +0000 (21:10 +0200)]
better postgres 11 compat in config/pidfile path references

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agore-bump version to 6.0-1
Thomas Lamprecht [Wed, 24 Jul 2019 18:49:14 +0000 (20:49 +0200)]
re-bump version to 6.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-1
Thomas Lamprecht [Wed, 24 Jul 2019 14:38:28 +0000 (16:38 +0200)]
bump version to 6.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadapt to new pmgcfg version/release semantic
Thomas Lamprecht [Wed, 24 Jul 2019 18:39:34 +0000 (20:39 +0200)]
adapt to new pmgcfg version/release semantic

similar like we've done in PVE[0]

[0]: https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=b597d23d354665ddea247c3ad54ece1b84921768

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoallow to pass port to pmgpolicy and use it in test
Thomas Lamprecht [Wed, 24 Jul 2019 08:21:27 +0000 (10:21 +0200)]
allow to pass port to pmgpolicy and use it in test

instead of the, rather rough, "stop the live daemon and take it's
port" hack

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotest: create db: drop all active connections before dropping DB
Thomas Lamprecht [Wed, 24 Jul 2019 08:20:20 +0000 (10:20 +0200)]
test: create db: drop all active connections before dropping DB

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodrop now unused repoid.pl
Thomas Lamprecht [Tue, 23 Jul 2019 19:32:20 +0000 (21:32 +0200)]
drop now unused repoid.pl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: fix and add missing build dependencies
Thomas Lamprecht [Tue, 23 Jul 2019 19:31:29 +0000 (21:31 +0200)]
d/control: fix and add missing build dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosplit source and packaging, and clean latter a bit up
Thomas Lamprecht [Tue, 23 Jul 2019 19:30:57 +0000 (21:30 +0200)]
split source and packaging, and clean latter a bit up

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 5.2-6
Thomas Lamprecht [Fri, 12 Jul 2019 15:05:37 +0000 (17:05 +0200)]
bump version to 5.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2276: restore line format for pmg-log-tracker
Dominik Csapak [Fri, 12 Jul 2019 13:49:05 +0000 (15:49 +0200)]
fix #2276: restore line format for pmg-log-tracker

pmg-log-tracker requires a specific format of the output of the
smtp-filter to correctly detect and recognize emails and message ids

commit 365d5b9549d25a910c82cd37034f05e1c906565a
changed the format of some lines (by including the rule name)
so that pmg-log-tacker did not correctly parse it anymore

this patch changes the format in a way that the log-tracker
can parse and still display the new information

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agofix subscription url
Thomas Lamprecht [Thu, 4 Jul 2019 15:59:23 +0000 (17:59 +0200)]
fix subscription url

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 5.2-5
Thomas Lamprecht [Mon, 1 Jul 2019 15:53:52 +0000 (17:53 +0200)]
bump version to 5.2-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoavast: change 'scan' invocation
Stoiko Ivanov [Fri, 17 May 2019 12:45:45 +0000 (14:45 +0200)]
avast: change 'scan' invocation

Change the invocation of avast's 'scan' executable from a hardcoded '/bin/scan'
to 'scan', so that it checks for the executable in the PATH.

The hardcoded path became apparent, while testing the new upstream release
of avast (3.0.1), where 'scan' got moved from '/bin/scan' to '/usr/bin/scan'

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agofix use of uninitialized value
Mira Limbeck [Tue, 18 Jun 2019 09:26:03 +0000 (11:26 +0200)]
fix use of uninitialized value

Return early if $info is not defined.

When moving a mail directly to quarantine without running any checks
there's no spaminfo available. As a result the value $info is
undefined.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofall back to hostname only if no domain defined
Mira Limbeck [Tue, 11 Jun 2019 13:27:28 +0000 (15:27 +0200)]
fall back to hostname only if no domain defined

fall back to hostname only if no domain is defined in /etc/resolv.conf.
this removes the 'Use of uninitialized value' warning for
'$msginfo->{domain}'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofollouwp indentation fixup
Thomas Lamprecht [Fri, 7 Jun 2019 09:53:26 +0000 (11:53 +0200)]
follouwp indentation fixup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoextended fix #1974: traffic_stat_graph: go through all entries
Alexander Plank [Thu, 6 Jun 2019 12:54:56 +0000 (14:54 +0200)]
extended fix #1974: traffic_stat_graph: go through all entries

Extends a fix for #1974.
The commit cb609ca098823734dde590fcf42164f72bbfbf37 fixed the graph
for postscreen_stat_graph.  The code from the above commit was
adopted to fix the same error for traffic_stat_graph.

Signed-off-by: Alexander Plank <alexander.plank@siconnex.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agowrap and sort + debhelper 10 buildep
Thomas Lamprecht [Thu, 6 Jun 2019 12:24:36 +0000 (14:24 +0200)]
wrap and sort + debhelper 10 buildep

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 5.2-4
Thomas Lamprecht [Thu, 6 Jun 2019 12:02:29 +0000 (14:02 +0200)]
bump version to 5.2-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi apt/versions: add some missing packages
Thomas Lamprecht [Thu, 6 Jun 2019 12:20:45 +0000 (14:20 +0200)]
api apt/versions: add some missing packages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmg config: fix avast scan executable path documentation
Thomas Lamprecht [Thu, 6 Jun 2019 11:59:19 +0000 (13:59 +0200)]
pmg config: fix avast scan executable path documentation

as it changed in newer releases

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAdd default rulename of 'unknown' to Actions
Stoiko Ivanov [Thu, 6 Jun 2019 09:26:38 +0000 (11:26 +0200)]
Add default rulename of 'unknown' to Actions

To provide a better experience while logging - set the name to 'unknown' in
case it's not defined. Related to #2232

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agofix #2232: set rulename for default accept
Stoiko Ivanov [Thu, 6 Jun 2019 09:26:37 +0000 (11:26 +0200)]
fix #2232: set rulename for default accept

Logging the rulename along with the action taken introduced in
365d5b9549d25a910c82cd37034f05e1c906565a, introduced a regression, for the
default action (accept), since the accept-rule is instantiated directly it
did not set a name, resulting in an 'Use of uninitialized value' being written
to the mail.log for every mail not triggering any explicit rule.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
4 years agoDrop sa-awl output from pmg-system-report
Stoiko Ivanov [Tue, 28 May 2019 10:32:57 +0000 (12:32 +0200)]
Drop sa-awl output from pmg-system-report

After gathering some initial experience with `pmg-system-report` it seems
that the output of `sa-awl` is not too helpful in narrowing down problems.

Additionally the output tends to be quite large (multiple MiB) on larger/
longer-running installations, leading to timeouts or problems when sending
the report to the support.

Should the AWL checks skew the SA-results in a negative way this already shows
in the logs (which log the score for each rule).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agolimit precision of bayes-score in log
Stoiko Ivanov [Wed, 22 May 2019 15:31:52 +0000 (17:31 +0200)]
limit precision of bayes-score in log

Spamassassin's bayes_score is a float, and is written to the log during
filtering. Limiting the precision for the log to 2 decimal places keeps
logs a bit shorter and also prevents misreadings of values like:
5.55111571207834e-17

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agobump version to 5.2-3
Thomas Lamprecht [Thu, 16 May 2019 11:31:04 +0000 (13:31 +0200)]
bump version to 5.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agonode: journal: minor code cleanup
Thomas Lamprecht [Thu, 16 May 2019 11:06:01 +0000 (13:06 +0200)]
node: journal: minor code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agonode: journal: improve parameter schema
Thomas Lamprecht [Thu, 16 May 2019 11:05:34 +0000 (13:05 +0200)]
node: journal: improve parameter schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agonode: add journal api to index too
Thomas Lamprecht [Thu, 16 May 2019 11:04:55 +0000 (13:04 +0200)]
node: add journal api to index too

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agonode: add journal api
Dominik Csapak [Wed, 15 May 2019 09:38:19 +0000 (11:38 +0200)]
node: add journal api

this uses the new journalreader instead of journalctl, which is a bit
faster and can read from/to cursor and returns a start/end cursor

also you can give an unix epoch as time parameters

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoadd new parameters cidr(6) to the network api
Dominik Csapak [Fri, 3 May 2019 07:28:53 +0000 (09:28 +0200)]
add new parameters cidr(6) to the network api

to also allow to set it directly and not only via address/netmask

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoAdd rule name to RuleAction logging
Stoiko Ivanov [Thu, 18 Apr 2019 15:04:32 +0000 (17:04 +0200)]
Add rule name to RuleAction logging

With complicated rulesets knowing which rule is responsible for the action
applied to a mail can become complex. Since relevant actions [0] do log a line
when being executed adding the rule's name to this logline should simplify
understanding and debugging complex rules.

Additionally the mix of string interpolation and formatstrings in Quarantine.pm
got unified to formatstrings.

[0] Attach is covered via Notify, Disclaimer and ModField could result in too
verbose logging (i.e. users adding many headers to a mail) without any gain

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agobump version to 5.2-2
Thomas Lamprecht [Thu, 18 Apr 2019 11:53:33 +0000 (13:53 +0200)]
bump version to 5.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agod/control: bump verison dependency to pve-common
Thomas Lamprecht [Thu, 18 Apr 2019 11:46:58 +0000 (13:46 +0200)]
d/control: bump verison dependency to pve-common

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoFix setresuid to 'postgres' error handling
Stoiko Ivanov [Wed, 17 Apr 2019 08:55:43 +0000 (10:55 +0200)]
Fix setresuid to 'postgres' error handling

PMG::DBTools::postgres_admin_cmd switches the euid to postgres. The error
handling expected that the setresuid (2) call failed if $! was != 0, without
explicitly setting it to 0 beforehand. This lead to a false positive if errno
was set from a previous library call.

This patch changes the code to explicitly call the setresuid syscall (exposed
via a separate patch to pve-common) and check for an error.

Steps to reproduce:
* install nscd on a system
* try installing pmg-api (the postinst script invokes `pmgdb init`)

The issue was further discussed in [0].

[0] https://pve.proxmox.com/pipermail/pmg-devel/2019-April/000362.html

Reported-By: Patrick Fogarty <patrick.fogarty@patanne.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agorewrite config log followup: move common log message out in closure
Thomas Lamprecht [Fri, 12 Apr 2019 08:01:09 +0000 (10:01 +0200)]
rewrite config log followup: move common log message out in closure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix #2153: allow "'" in quarantine email addresses
Mira Limbeck [Wed, 10 Apr 2019 10:54:37 +0000 (12:54 +0200)]
fix #2153: allow "'" in quarantine email addresses

use the more relaxed standard option 'pmg-email-address' defined in
PMG/Utils.pm instead of the 'email' format defined in pve-common

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
5 years agolog before restarting services on rewrite_config
Stoiko Ivanov [Thu, 11 Apr 2019 16:48:58 +0000 (18:48 +0200)]
log before restarting services on rewrite_config

PMG::Config::rewrite_config is called from various places (e.g.
pmgmirror for clustered setups, pmgconfig sync --restart for CLI
operations) for rendering the config-templates and conditionally
restarting services.  This patch adds a syslog call for each service
that gets restarted.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agofix #2172: sort mynetworks template var to make postfix config rewrite stable
Stoiko Ivanov [Thu, 11 Apr 2019 16:48:57 +0000 (18:48 +0200)]
fix #2172: sort mynetworks template var to make postfix config rewrite stable

The mynetworks template_var is written to postfix/main.cf, causing a
postfix restart on every change. Since mynetworks is a hash the order
of the networks potentially changes with every invocation. This shows
quite readily in clustered setups where pmgmirror writes the configs
and checks for changes once every 2 minutes.

fixes #2172

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agoreload postfix instead of restart on config change
Stoiko Ivanov [Tue, 9 Apr 2019 16:13:17 +0000 (18:13 +0200)]
reload postfix instead of restart on config change

From `man 1 postfix`:
```
Note: in order to refresh the Postfix mail system after a
configuration change, do not use the start and stop commands in
succession. Use the reload command instead.
```

Additionally restarting postfix, while a mail has been passed to
pmg-smtp-filter but has not beed fed back to postfix again, causes it
to get passed a second time to pmg-smtp-filter (by qmgr) and this
results in duplicate maildelivery

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agopackage versions: code cleanup: remove unused variable
Thomas Lamprecht [Fri, 12 Apr 2019 07:37:16 +0000 (09:37 +0200)]
package versions: code cleanup: remove unused variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version to 5.2-1
Dietmar Maurer [Wed, 20 Mar 2019 05:59:48 +0000 (06:59 +0100)]
bump version to 5.2-1

5 years agobump version toö 5.1-7
Dietmar Maurer [Wed, 20 Mar 2019 05:51:53 +0000 (06:51 +0100)]
bump version toö 5.1-7

5 years agopmgversion: be compatible with minimized container installation
Thomas Lamprecht [Tue, 19 Mar 2019 07:04:08 +0000 (08:04 +0100)]
pmgversion: be compatible with minimized container installation

One can now install PMG in a CT envrionment through the new
proxmox-mailgateway-container meta package, but this wasn't correctly
checked by the API PMG versions code.

Add the new meta package as optional one, and if it is installed
replace the bare-metal meta packge info with it, both can never be
installed at the same time. Also move pve-firmware to the optional
package list.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agopmgversion: sort packages
Thomas Lamprecht [Tue, 19 Mar 2019 07:04:07 +0000 (08:04 +0100)]
pmgversion: sort packages

Similar adaptions as PVE got, initally list the most important
packages, pmg-api and pmg-gui, then the kernels sorted by real
version order, then the rest of intresting packages in alphabetical
order.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobetter error handling for ldap connect
Dominik Csapak [Mon, 18 Mar 2019 13:58:32 +0000 (14:58 +0100)]
better error handling for ldap connect

even though we create the ldap connection with 'onerror' => 'die',
it returns undef and sets $@ on error during connect, so we want to use
that instead of $!

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agobump version to 5.1-6
Dietmar Maurer [Mon, 18 Mar 2019 06:01:31 +0000 (07:01 +0100)]
bump version to 5.1-6

5 years agofix #2129: allow (some) filters for dnsbl-entry
Stoiko Ivanov [Thu, 14 Mar 2019 17:20:45 +0000 (18:20 +0100)]
fix #2129: allow (some) filters for dnsbl-entry

currently we only handle dnsbl-sites with optional <WEIGHT>, but postfix also
allows for an optional <FILTER> (which dns-answers to interpret as hit) [0].

The regex is extended to also allow for a filter with singular answers, as
well as ranges ([0..255])for each octet. Filters relying on 'lists' of numbers
split by ';' break the use of JSONSchema's '-list' format matching (it
uses split_list, which splits on ';') and were thus excluded.

[0] http://www.postfix.org/postconf.5.html#postscreen_dnsbl_sites

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agofix #1947: implement starttls for ldap
Dominik Csapak [Wed, 13 Mar 2019 14:17:08 +0000 (15:17 +0100)]
fix #1947: implement starttls for ldap

adds a new mode 'ldap+starttls' that enables the start_tls after
connection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agofix #1946: add verify and cafile options for ldap
Dominik Csapak [Wed, 13 Mar 2019 14:17:07 +0000 (15:17 +0100)]
fix #1946: add verify and cafile options for ldap

so that users can force the verification, either with the system
installed certificates or with a single explicit file

this also fixes #1944, since the option was 'scheme' not 'schema'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoshow all errors when we get an ldap connection error
Dominik Csapak [Wed, 13 Mar 2019 14:17:06 +0000 (15:17 +0100)]
show all errors when we get an ldap connection error

LDAP->new can also set $@

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agointegrate custom_check
Stoiko Ivanov [Wed, 13 Mar 2019 20:39:42 +0000 (21:39 +0100)]
integrate custom_check

for virus and spam detection and records its time spend in the Statistics DB
and the log

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agoadd custom_check handling
Stoiko Ivanov [Wed, 13 Mar 2019 20:39:41 +0000 (21:39 +0100)]
add custom_check handling

This patch enables users to create their own script for analyzing mails.
The 'custom_check' needs to be enabled via pmg.conf (optionally the check's
executable path ('custom_check_path') can be set, defaulting to
'/usr/local/bin/pmg-custom-check').

'pmg-smtp-filter' calls the check before analyze_virus (which in turn calls
clamav or avast). The custom_check 'api' is kept simple:
* Input: the check gets 2 arguments:
  * the 'api-version' (currently 'v1') - for potential future change of the
    invocation
  * the 'queue-file-name' - a filename, which contains the complete e-mail as
    rfc822/eml file
* Output: the check needs to return 2 lines on STDOUT:
  * the 'api-version' (currently 'v1') - see above
  * one of the following 3 results:
    * 'OK' - mail is ok
    * 'VIRUS: <virusdescription>' - mail is treated as if it contained a virus
      (the virusdescription is logged and added to the mail's headers)
    * 'SCORE: <number>' - <number> is added (negative numbers are also possible)
      to the mail's spamscore
* The check will be killed after a 5 minute timeout - and the mail is
  treated as OK
* All output written to STDERR by the check is written to the journal/mail.log
  (with priority 'err')

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agopmg-system-report: check for existing sa-awl db
Stoiko Ivanov [Tue, 26 Feb 2019 14:02:30 +0000 (15:02 +0100)]
pmg-system-report: check for existing sa-awl db

When run via pmgdaemon the pmg-system-report threw an error, while running
`sa-awl` (it relies on the environment variable HOME being set, for the default
location of the awl database).

This patch checks for the existance of /root/.spamassassin/auto-whitelist and
conditionally runs sa-awl with the file as argument.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
5 years agobump version to 5.1-5
Dietmar Maurer [Tue, 26 Feb 2019 12:03:17 +0000 (13:03 +0100)]
bump version to 5.1-5