1
0
Fork 0
No description
  • Perl 70.6%
  • Diff 16.3%
  • Shell 13.1%
Find a file
2020-01-19 13:38:03 +01:00
class.webappauthentication.php.patch updated for latest kopano version 2020-01-18 16:24:09 +01:00
install_linux.sh initial commit 2019-09-08 17:26:52 +02:00
install_openbsd.sh initial commit 2019-09-08 17:26:52 +02:00
LICENSE updated for latest kopano version 2020-01-18 16:24:09 +01:00
README.md updated readme 2020-01-19 13:38:03 +01:00
smtp_auth_sync.pl added syslog 2020-01-19 10:22:31 +01:00

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

Dependency: pkg_add p5-IPC-Run

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 "/etc/mail/secrets"

listen on egress port submission tls 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