1
0
Fork 0
smtp_auth_sync/README.md
2019-09-08 17:26:52 +02:00

65 lines
1.8 KiB
Markdown

# SMTP Authentication Sync
This is a small daemon to sync Zarafa/Kopano users and passwords to an authentication file which can be used by OpenSMTPD.
Any successful login or password change will be synced to this file.
The passwords are stored as Bcrypt hashes generated by `smtpctl encrypt`.
## Install
Copy `smtp_auth_sync.pl` to `/usr/local/sbin/smtp_auth_sync.pl` and set execute permissions:
`chmod 755 /usr/local/sbin/smtp_auth_sync.pl`
Use the `install_openbsd.sh` or `install_linux.sh` scripts to create the `rc` or `systemd` configs.
## Config Options
At the top of `smtp_auth_sync.pl` are some config options you may need to edit for your environment.
Defaults are for OpenBSD:
```
# Configs
# File to store the "user password-hash" mappings
my $authfile = "/etc/mail/secrets";
# UNIX Domain Socket inside the web chroot
my $sfile = "/var/www/run/smtp_auth_sync.sock";
# Absolute path of smtpctl
my $smtpctl = "/usr/sbin/smtpctl";
# Group OpenSMTPD runs with
my $smtp_group = "_smtpd";
# Group the webserver runs with
my $www_group = "www";
```
## smtpd.conf
The table name must be `secrets`.
The file path can be changed.
```
table secrets file:/etc/mail/secrets
listen on egress port 587 smtps pki mx.example.com auth <secrets>
```
## Zarafa/Kopano Password Change Plugin
Plugin (version 1.3): https://github.com/silentsakky/zarafa-webapp-passwd
Apply this patch to send changed passwords to `smtp_auth_sync`:
Depending on your setup you may need to change `"/run/smtp_auth_sync.sock"` to the appropriate socket path inside your chroot.
```
# Default path on OpenBSD
cd /var/www/kopano-webapp/plugins/passwd/php
ftp -o class.passwdmodule.php.patch https://git.giftfish.de/ston1th/smtp_auth_sync/raw/branch/master/class.passwdmodule.php.patch
patch -p0 <class.passwdmodule.php.patch
rm class.passwdmodule.php.orig class.passwdmodule.php.patch
```