- Perl 70.6%
- Diff 16.3%
- Shell 13.1%
| class.webappauthentication.php.patch | ||
| install_linux.sh | ||
| install_openbsd.sh | ||
| LICENSE | ||
| README.md | ||
| smtp_auth_sync.pl | ||
SMTP Authentication Sync
This is a small daemon to sync Kopano users and passwords to an authentication file which can be used by OpenSMTPD.
Any successful webapp login 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>
Kopano Authentication Class Patch
Apply this patch to send passwords to smtp_auth_sync after a successful login:
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/server/includes/core
ftp -o class.webappauthentication.php.patch https://git.giftfish.de/ston1th/smtp_auth_sync/raw/branch/master/class.webappauthentication.php.patch
patch -p0 <class.webappauthentication.php.patch
rm class.webappauthentication.php.orig class.webappauthentication.php.patch