Koni handles Mozilla Autoconfig, Microsoft Autodiscover and Apple mobileconfig profiles for all your domains, in one place. With automatic Let's Encrypt certificates for extra convenience.
These are the basic steps needed to install koni:
-
Download a release from the GitHub release page
-
Extract koni-$version.tar.gz to your server
-
Edit koni.conf to match your environment
-
Optional: Customize and install the koni.service systemd unit
-
Make koni reachable on ports 80 and 443
On Linux there are various methods to do this. See e.g. https://superuser.com/questions/710253/allow-non-root-process-to-bind-to-port-80-and-443
Alternatively, set up a TCP proxy like haproxy in front of koni.
-
Run koni (through systemd or directly)
For each domain you want to handle, add the following CNAME entries to DNS:
CNAME autoconfig.userdomain.com -> koniserver.mydomain.com
CNAME autodiscover.userdomain.com -> koniserver.mydomain.com
Additionally, you can set up a SRV record for clients that only use the SRV record during Autodiscover:
SRV _autodiscover._tcp.userdomain.com -> koniserver.mydomain.com:443
Koni listens for HTTPS requests on koniserver.mydomain.com and responds to any clients that request an URL from a autoconfig.* or autodiscover.* host or directly from koniserver.mydomain.com.
If a user configures their email client, the following happens:
- User starts mail configuration on the client, enters email address
user@userdomain.com. - Mail client looks up
autoconfig.userdomain.com(Mozilla and others) orautodiscover.userdomain.com(Microsoft and others) - Mail client sends HTTP(s) request to the domain
- Koni looks for a certificate of
autoconfig.userdomain.com/autodiscover.userdomain.comin its certs cache dir. If there is no cert or the cert is expired, koni requests a certificate from Let's Encrypt for the requested domain - Koni sends HTTP response to client, with valid TLS cert.
- Mail client proceeds with auto config of the user's email account
| Path | Purpose |
|---|---|
/mail/config-v1.1.xml, /.well-known/autoconfig/mail/config-v1.1.xml |
Mozilla Autoconfig (?emailaddress=) |
/autodiscover/autodiscover.xml, /Autodiscover/Autodiscover.xml |
Microsoft Autodiscover (POX, POST) |
/autodiscover/autodiscover.json |
Microsoft Autodiscover JSON, redirects to the XML endpoint |
/mobileconfig.xml |
Apple configuration profile (?emailaddress=) |
Plain HTTP requests are redirected to HTTPS, except for ACME http-01 challenges.
See comments in koni.conf. Unknown settings are rejected at startup.
Koni logs to stderr in key=value format without timestamps (systemd/journald adds those).
Set debug = true to additionally log full request dumps.
Each access log line has a category: autoconfig, autodiscover, mobileconfig, acme (Let's Encrypt
challenges) or noise (everything else, mostly bots scanning for vulnerabilities). For example:
journalctl -u koni | grep msg=request | grep -v category=noise # real traffic only
journalctl -u koni | grep -o 'category=[a-z]*' | sort | uniq -c # requests per category
Note that bots also probe the real endpoints, especially autodiscover. Requests from real clients usually
succeed (status=200), bot probes typically get status=400.
The response templates in templates/ (Go text/template syntax) are built into
the binary. To change them, edit the files and rebuild koni. All values are XML-escaped before rendering.
- Templates are now built into the binary; the
templates/directory is no longer needed at runtime. - The access log is now structured (
level=INFO msg=request client=... status=...) instead of Apache format. debugis now a TOML boolean (debug = true); the old"yes"/"no"values are rejected.letsencrypt.emailis optional.
Requires Go 1.26 or newer (go.mod selects the toolchain automatically).
- Clone the repo
- Hack on the code
- Run
make check(vet, gofmt, staticcheck, tests, govulncheck) - Run
git tag -a v<NEW VERSION> - Run
make releaseto build a release package - Run
git push --tagsto push changes to GitHub - Upload the release to GitHub