@brickert/kerio-connect-api
v0.0.8
Published
An unofficial API wrapper for Kerio Connect Mail Server jsonrpc Admin API.
Maintainers
Readme
kerio-connect-api
An unofficial API wrapper in NodeJS for Kerio Connect mail server.
Notes
Tested on Kerio Connect Linux (using Debian 12 .deb file install) version 10.0.8 Patch 2. You can download it here: http://download.kerio.com/archive/
Under the hood it uses jsonrpc protocol version 2. With session cookies SESSION_CONNECT_WEBADMIN and an X-Token Header for CSRF protection, and a json body
The official documentation can be viewed here: https://manuals.gfi.com/en/kerio/api/connect/admin/reference/index.html
Although the documentation looks hard to read I did find an official PHP library example that helped greatly.
Features
Currently only implemented a very small set of methods for the Administrative API under endpoint /admin/api/jsonrpc
When importing this library a log file is created relative to the where the process is started. E.g. node /opt/kerio/app.js will have a json log file at /opt/kerio/log/kerio.log Generated by the pino package. With also pino-pretty printed to stdout
Installation
Use the package manager npm to install.
npm install @brickert/kerio-connect-apiUsage
A typical quick one-off script can be such as:
import { Kerio } from "@brickert/kerio-connect-api";
var kerio = new Kerio({
hostname: "192.168.1.1",
port: 4040,
endpoint_url: '/admin/api/jsonrpc',
https: true
}, {
name: "kerio-connect-api",
vendor: "Example Inc",
version: "1.0"
}, {
logLevel: 'info'
});
try {
await kerio.login({
username: "operator",
password: "foobar"
});
let add_host_id = await kerio.IPAddressGroups.addHostToIPAddressGroup("192.168.1.2", "Example Client Name", "My Group Name", true);
console.log(add_host_id);
// keriodb://ipaddressgroup/1234-5678-901-2345
} catch (e) {
console.log(e);
}