[SOLVED] using pmgsh to query the quarantine (or anything)

IEM

Well-Known Member
Sep 4, 2018
69
10
48
48
Austria
i'm having a hard time, doing anything useful with `pmgsh` (besides interacting with the config; which i find easier to either do directly on the filesystem or via the webinterface).

esp. i'd like to query the quarantine database (e.g. which receivers have quarantined emails; list basic information about quarantined emails), but fail to do so. e.g:

Code:
# pmgsh get quarantine/quarusers
200 OK
[
   {
      "mail" : "somebody@example.com"
   },
   {
      "mail" : "another@example.com"
   }
]

this looks ok (note that the email-addresses are made up, just to illustrate my point; the actual query gives me 2 results), but in the webinterface i see about 50 different email-accounts for which ther are quarantine emails.

so i try to get some data:

Code:
# pmgsh get quarantine/content
400 Parameter verification failed.
id: property is missing and it is not optional
get quarantine/content --id <string> [OPTIONS]
# pmgsh get quarantine/content --id "somebody@example.com"
400 Parameter verification failed.
id: value does not match the regex pattern
get quarantine/content --id <string> [OPTIONS]
 pmgsh help quarantine/content
help [path] [--verbose]
cd [path]
ls [path]

Undefined subroutine &main::1 called at /usr/share/perl5/PVE/RESTHandler.pm line 630.
#

wtf? i have absolutely no idea how to properly get `quarantine/content`. it seems to require some obscure ID, but what that might be i have no idea (using an email-address obviously failed).
the online help only ever gives me "Undefined subroutine" errors.

I also tried accessing `quarantine/spam` with equally little success:

Code:
# pmgsh get quarantine/spam
400 Parameter verification failed.
pmail: parameter required with role 'root'
get quarantine/spam  [OPTIONS]
# pmgsh get quarantine/spam somebody@example.com
400 too many arguments
get quarantine/spam  [OPTIONS]
# pmgsh ls quarantine/spam
resource does not define child links
# pmgsh help quarantine/spam
help [path] [--verbose]
cd [path]
ls [path]

Undefined subroutine &main::1 called at /usr/share/perl5/PVE/RESTHandler.pm line 630.
#


so: how can i effectively use `pmgsh`? which paths can i access and how? which parameters do i need to pass?
 
i guess what you want are

pmgsh get /quarantine/spamusers # get users for which there are mails in the spam quarantine in the last 24 hours; can be modified with -starttime/-endtime (both need a unix epoch)
pmgsh get /quarantine/spam -pmail 'user@domain.com' # for the quarantine of the last 24 hours (can be modified with -starttime/-endtime) of 'user@domain.com'. this contains a field 'id'
pmgsh get /quarantine/content -id 'idfromapicallbefore' # get the content of the spam mail with id 'idfromapicallbefore'

see also https://ip-of-your-pmg:8006/pmg-docs/api-viewer/index.html
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!