To get Halon MTA working with MSUI you need to import multiple HSL files to its configuration. Start by adding three new files in Halon MTA with the following ID's:
- msui/config.hsl
- msui/msui.hsl
- msui/balist.hsl
And import the HSL code from /opt/halon/msui/share/docs/examples/hsl/msui
to the respective file. Update the credentials in msui/config.hsl
.
Next step is to import the new files to every existing HSL context you want to use it with, like RCPT TO and EOD.
// Managed Service UI
import { $localsettings } from "msui/config.hsl";
import { msui } from "msui/msui.hsl";
$defaults = [
"domain" => [
"antispam" => true,
"spamlevel" => "medium",
"antivirus" => true
],
"user" => []
];
$msui = msui(...$localsettings);
$msui->set_defaults($defaults);
After you have imported the class you have a set of methods available at your disposal. Most methods already have error handling and a logic to fall back to certain default values, and it is highly recommended to set the default value as above for every setting.
To fetch information for a specific recipient domain, you can use the following method, and then change the MTA's behaviour based on the value:
$domainsettings = $msui->get_domain_settings($recipientdomain);
$usersettings = $msui->get_user_settings($recipientdomain, $recipient);
if ($domainsettings["antispam"] !== false) {
// run antispam checks
} else {
// antispam disabled
echo "Antispam disabled for $recipientdomain";
}
For more examples how you can use this class please see /opt/halon/msui/share/docs/examples/hsl
which includes examples for both inbound and outbound.
For new Halon MTA installations, you can replace the default configuration with the HSL example files.
Synchronise domains, users and settings
Every API call to MSUI is cached by the builtin cache function in HSL, but to make it even more persistent you can synchronise all domains, users and settings to every Halon MTA. Start with adding a new HTTPS listener on port 8080 for each MTA, set type to Custom (with route). Restart the MTA server.
After restart, copy all files under /opt/halon/msui/share/halon-sync/script/
to /storage/www/htdocs/
to each MTA (requires that you have enabled root login). Rename and edit the file settings.php
, and set credentials and database path, create a database file and give read and write access to the user www
. The database table will be created by the script.
Note that you need to use the variable $localsettings from msui/config.hsl
when constructing a new msui class.
Last step is to enable synchronisation in the msui.yaml
file located on the MSUI server:
sync: enabled: true interval: 900 bulk: enabled: true size: 50 node: - name: "node1" address: "https://10.0.0.1:8080" username: "admin" password: "badpassword" tls: rejectUnauthorized: true - name: "node2" address: "https://10.0.0.2:8080" username: "admin" password: "badpassword" tls: rejectUnauthorized: true
Restart the MSUI service. When logging in as a superuser you can monitor the sync status, or you can check MSUI's service log for more information.
Comments
0 comments
Article is closed for comments.