Skip to main content
Version: 1.3

Internal configuration

The server module reads its configuration from two files inside the installation directory (/opt/msh-pm-milter):

  • lib/defaults.cf - the defaults shipped with every release. Do not edit this file - it is overwritten on every update.
  • etc/config.cf - your host-local overrides. This file is never shipped in the package, so your changes survive updates.

Both files are sourced by the service launchers, etc/config.cf after lib/defaults.cf, so any value you set there wins.

How to override a parameter​

  1. Create (or edit) /opt/msh-pm-milter/etc/config.cf and add only the keys you want to change, one per line:
MILTER_PORT=9999
MAIL_SMTP_HOST=relay.example.com
JAVA_XMX=2048M
  1. Restart the services so the launchers pick up the new values:
sudo systemctl restart msh-pm-settings.service msh-pm-milter.service

Parameters​

KeyDefaultDescription
MSH_JAVA_BINjavaJava executable used to start the services
MSH_USERmshSystem user that owns the installation
MILTER_PORT7080Port the milter listens on for Postfix
SETTINGS_PORT_IN1207RMI registry port of the settings service
SETTINGS_PORT_OUT1208RMI data port of the settings service
JAVA_XMS128MInitial JVM heap size
JAVA_XMX1024MMaximum JVM heap size
POOL_SIZE10Message processing worker threads
QUEUE_SIZE20Queue capacity for waiting messages
STATS_UPDATE_TIME60Statistics refresh interval (seconds)
MAIL_SMTP_HOSTlocalhostSMTP host used to send mail
MAIL_SMTP_PORT25SMTP port used to send mail
MAIL_SMTP_CONNECTION_TIMEOUT10000SMTP connection timeout (milliseconds)
MAIL_SMTP_TIMEOUT30000SMTP read timeout (milliseconds)
SCRIPTS_DIRscriptsScripts directory of the External script condition and the Run executable action; empty disables external scripts
SCRIPTS_MAX_CONCURRENT5How many external scripts may run at the same time

MSH_JAVA_BIN​

The Java executable used to start both the milter and the settings service - either a command name resolved from PATH or an absolute path to the binary. The launchers verify that it points to Java 21 or newer and refuse to start otherwise. See Custom Java location for details and examples.

MSH_USER​

The system user that owns the installation tree and runs the services. Used by lib/fixperms.sh when re-applying ownership and permissions after an update. If you change it, adjust the systemd unit files accordingly.

MILTER_PORT​

The TCP port the milter listens on for connections from Postfix.

note

If you change MILTER_PORT, make sure to update the corresponding value in /etc/postfix/main.cf as well so Postfix continues to communicate with the milter on the correct port. See Postfix configuration.

SETTINGS_PORT_IN and SETTINGS_PORT_OUT​

The two ports of the settings service:

  • SETTINGS_PORT_IN - the RMI registry port. Both the milter (locally) and the Administrator Panel (remotely) connect to it to look up the settings service.
  • SETTINGS_PORT_OUT - the fixed port used for the actual RMI data connections. Without pinning this port, RMI would pick a random one, which makes firewall rules impossible.

If the Administrator Panel connects from another machine, both ports must be reachable through the firewall. See Connection problems if the panel cannot connect.

JAVA_XMS and JAVA_XMX​

The initial and maximum JVM heap size for both services, in JVM notation (128M, 2G, ...). Increase JAVA_XMX if the application runs out of heap space - see Java for the symptoms.

POOL_SIZE and QUEUE_SIZE​

The milter processes messages in a worker thread pool. POOL_SIZE is the number of threads working concurrently; QUEUE_SIZE is how many messages can wait for a free thread before the milter starts refusing work. The current utilization is written to var/log/milter.stats - if the queue keeps filling up, increase POOL_SIZE. See Logs for how to read the statistics file.

STATS_UPDATE_TIME​

How often the milter rewrites the var/log/milter.stats snapshot, in seconds.

MAIL_SMTP_HOST and MAIL_SMTP_PORT​

The SMTP server the milter uses when it sends mail itself - for example autoreplies generated by autoresponder rules. By default it hands mail to the local Postfix on localhost:25. Point it at a different host or port if your MTA listens elsewhere or you want the milter's own mail routed through a specific relay.

MAIL_SMTP_CONNECTION_TIMEOUT and MAIL_SMTP_TIMEOUT​

Timeouts (in milliseconds) for the SMTP connection above: MAIL_SMTP_CONNECTION_TIMEOUT limits how long establishing the connection may take, MAIL_SMTP_TIMEOUT limits how long the milter waits for a response while sending. They prevent message processing from hanging when the SMTP server is unreachable or stalled.

SCRIPTS_DIR and SCRIPTS_MAX_CONCURRENT​

The directory the External script condition and the Run executable action may run programs from. The default scripts is resolved against the installation directory, so it means /opt/msh-pm-milter/scripts, where the examples accept.sh and reject.sh and a README are installed. An absolute path points elsewhere. Rules can run only executable files inside this directory; set SCRIPTS_DIR empty to disable external scripts, then rules run nothing.

Keep the directory owned by root and not writable by the msh user, and make each script writable by its owner only - a script that its group or other users can change is refused. After adding scripts, run lib/fixperms.sh as root: it creates the directory if needed and applies exactly these permissions. A change of SCRIPTS_DIR takes effect after a restart of msh-pm-milter.service; an added script needs no restart.

SCRIPTS_MAX_CONCURRENT caps how many scripts run at the same time, so a burst of mail cannot start hundreds of processes. A script waiting for a free slot uses up its own timeout while it waits.

Additional resources​