]> git.proxmox.com Git - pmg-docs.git/blobdiff - pmgconfig.adoc
installation: add proxmox-mailgateway-container
[pmg-docs.git] / pmgconfig.adoc
index 1db30492aa202b90561845be704bab4acc9057f9..384fa2b60dba90bd511866223c2edd74be259377 100644 (file)
@@ -143,8 +143,8 @@ We use a template based approach to generate those files. The {tts} is
 a well known, fast and flexible template processing system. You can
 find the default templates in `/var/lib/pmg/templates/`. Please do not
 modify them directly, because your modification would get lost on the
-next update. Instead, copy them to `/etc/pmg/templates/`, then apply
-your changes there.
+next update. Instead, copy the template you wish to change to
+`/etc/pmg/templates/`, then apply your changes there.
 
 Templates can access any configuration setting, and you can use the
 `pmgconfig dump` command to get a list of all variable names:
@@ -167,7 +167,7 @@ or when you directly edit configuration files
 # pmgconfig sync --restart 1
 ----
 
-Above commands also restarts services if underlying configuration
+The above command also restarts services if the underlying configuration
 files are changed. Please note that this is automatically done when
 you change the configuration using the GUI or API.
 
@@ -175,6 +175,7 @@ NOTE: Modified templates from `/etc/pmg/templates/` are automatically
 synced from the master node to all cluster members.
 
 
+[[pmgconfig_systemconfig]]
 System Configuration
 --------------------
 
@@ -186,7 +187,7 @@ image::images/screenshot/pmg-gui-network-config.png[]
 endif::manvolnum[]
 
 Normally the network and time is already configured when you visit the
-GUI. The installer asks for those setting and sets up the correct
+GUI. The installer asks for those settings and sets up the correct
 values.
 
 The default setup uses a single Ethernet adapter and static IP
@@ -235,6 +236,7 @@ include::pmg.admin-conf-opts.adoc[]
 Mail Proxy Configuration
 ------------------------
 
+[[pmgconfig_mailproxy_relaying]]
 Relaying
 ~~~~~~~~
 
@@ -247,6 +249,7 @@ using the following configuration keys:
 
 include::pmg.mail-relaying-conf-opts.adoc[]
 
+[[pmgconfig_mailproxy_relay_domains]]
 Relay Domains
 ~~~~~~~~~~~~~
 
@@ -259,6 +262,7 @@ system will relay mail to. The system will reject incoming mails to
 other domains.
 
 
+[[pmgconfig_mailproxy_ports]]
 Ports
 ~~~~~
 
@@ -272,6 +276,7 @@ using the following configuration keys:
 include::pmg.mail-ports-conf-opts.adoc[]
 
 
+[[pmgconfig_mailproxy_options]]
 Options
 ~~~~~~~
 
@@ -285,6 +290,7 @@ using the following configuration keys:
 include::pmg.mail-options-conf-opts.adoc[]
 
 
+[[pmgconfig_mailproxy_transports]]
 Transports
 ~~~~~~~~~~
 
@@ -301,6 +307,7 @@ You can add the IP addresses, hostname and SMTP ports and mail domains (or
 just single email addresses) of your additional e-mail servers.
 
 
+[[pmgconfig_mailproxy_networks]]
 Networks
 ~~~~~~~~
 
@@ -315,6 +322,7 @@ NOTE: Hosts in the same subnet with Proxmox can relay by default and
 it’s not needed to add them in this list.
 
 
+[[pmgconfig_mailproxy_tls]]
 TLS
 ~~~
 
@@ -368,6 +376,7 @@ NOTE: If you use a backup MX server (e.g. your ISP offers this service
 for you) you should always add those servers here.
 
 
+[[pmgconfig_spamdetector]]
 Spam Detector Configuration
 ---------------------------
 
@@ -390,6 +399,7 @@ false negatives.
 include::pmg.spam-conf-opts.adoc[]
 
 
+[[pmgconfig_spamdetector_quarantine]]
 Quarantine
 ~~~~~~~~~~
 
@@ -411,9 +421,11 @@ and not in the webinterface.
 include::pmg.spamquar-conf-opts.adoc[]
 
 
+[[pmgconfig_clamav]]
 Virus Detector Configuration
 ----------------------------
 
+[[pmgconfig_clamav_options]]
 Options
 ~~~~~~~
 
@@ -439,6 +451,7 @@ updated. But you can see the database status on the GUI, and you can
 trigger manual updates there.
 
 
+[[pmgconfig_clamav_quarantine]]
 Quarantine
 ~~~~~~~~~~
 
@@ -462,7 +475,7 @@ Custom SpamAssassin configuration
 
 This is only for advanced users. To add or change the Proxmox
 {spamassassin} configuration please login to the console via SSH. Go
-to directory `/etc/mail/spamassasin/`. In this directory there are several
+to directory `/etc/mail/spamassassin/`. In this directory there are several
 files (`init.pre`, `local.cf`, ...) – do not change them.
 
 To add your special configuration, you have to create a new file and
@@ -478,12 +491,106 @@ If you run a cluster, the `custom.cf` file is synchronized from the
 master node to all cluster members.
 
 
+[[pmgconfig_custom_check]]
+Custom Check Interface
+----------------------
+
+For use cases which are not handled by the {pmg} Virus Detector and
+{spamassassin} configuration, advanced users can create a custom check
+executable which, if enabled will be called before the Virus Detector and before
+passing an e-mail through the Rule System. The custom check API is kept as
+simple as possible, while still providing a great deal of control over the
+treatment of an e-mail. Its input is passed via two CLI 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
+
+The expected output need to be printed on STDOUT and consists of two lines:
+
+* the 'api-version' (currently 'v1') - see above
+
+* one of the following 3 results:
+** 'OK' - e-mail is ok
+** 'VIRUS: <virusdescription>' - e-mail is treated as if it contained a virus
+    (the virusdescription is logged and added to the e-mail's headers)
+** 'SCORE: <number>' - <number> is added (negative numbers are also possible)
+    to the e-mail's spamscore
+
+The check is run with a 5 minute timeout - if it is exceeded the check
+executable is killed and the e-mail is treated as OK.
+
+All output written to STDERR by the check is written with priority 'err' to the
+journal/mail.log.
+
+A simple sample script following the API (and yielding a random result) for
+reference:
+
+----
+#!/bin/sh
+
+echo "called with $*" 1>&2
+
+if [ "$#" -ne 2 ]; then
+  echo "usage: $0 APIVERSION QUEUEFILENAME" 1>&2
+  exit 1
+fi
+
+apiver="$1"
+shift
+
+if [ "$apiver" != "v1" ]; then
+  echo "wrong APIVERSION: $apiver" 1>&2
+  exit 2
+fi
+
+queue_file="$1"
+
+echo "v1"
+
+choice=$(shuf -i 0-3 -n1)
+
+case "$choice" in
+  0)
+    echo OK
+    ;;
+  1)
+    echo SCORE: 4
+    ;;
+  2)
+    echo VIRUS: Random Virus
+    ;;
+  3) #timeout-test
+    for i in $(seq 1 7); do
+      echo "custom checking mail: $queue_file - minute $i" 1>&2
+      sleep 60
+    done
+    ;;
+esac
+
+exit 0
+----
+
+The custom check needs to be enabled in the admin section of `/etc/pmg/pmg.conf`
+
+----
+section: admin
+    custom_check 1
+----
+
+The location of the custom check executable can also be set there with the key
+`custom_check_path` and defaults to `/usr/local/bin/pmg-custom-check`.
+
+
 User Management
 ---------------
 
 User management in {pmg} consists of three types of users/accounts:
 
 
+[[pmgconfig_localuser]]
 Local Users
 ~~~~~~~~~~~
 
@@ -521,6 +628,7 @@ Local user related settings are saved in `/etc/pmg/user.conf`.
 
 For details of the fields see xref:pmg_user_configuration_file[user.conf]
 
+[[pmgconfig_ldap]]
 LDAP/Active Directory
 ~~~~~~~~~~~~~~~~~~~~~
 
@@ -563,6 +671,7 @@ After a successfull sync, the groups and users should be visible on the web
 interface. After that, you can create rules targeting LDAP users and groups.
 
 
+[[pmgconfig_fetchmail]]
 Fetchmail
 ~~~~~~~~~