From 197ecbb5b1008b8b71508e7ec2fd8ebf439b7805 Mon Sep 17 00:00:00 2001 From: ston1th Date: Sat, 18 Jan 2020 16:24:09 +0100 Subject: [PATCH] updated for latest kopano version --- LICENSE | 2 +- README.md | 18 ++++++++---------- class.passwdmodule.php.patch | 19 ------------------- class.webappauthentication.php.patch | 17 +++++++++++++++++ smtp_auth_sync.pl | 1 + 5 files changed, 27 insertions(+), 30 deletions(-) delete mode 100644 class.passwdmodule.php.patch create mode 100644 class.webappauthentication.php.patch diff --git a/LICENSE b/LICENSE index 45785b1..dd57fd8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2019 Marius Schellenberger +Copyright (C) 2020 Marius Schellenberger All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 7331e3c..3776bfb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # 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. +This is a small daemon to sync 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. +Any successful webapp login will be synced to this file. The passwords are stored as Bcrypt hashes generated by `smtpctl encrypt`. ## Install @@ -45,21 +45,19 @@ table secrets file:/etc/mail/secrets listen on egress port 587 smtps pki mx.example.com auth ``` -## Zarafa/Kopano Password Change Plugin +## Kopano Authentication Class Patch -Plugin (version 1.3): https://github.com/silentsakky/zarafa-webapp-passwd - -Apply this patch to send changed passwords to `smtp_auth_sync`: +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/plugins/passwd/php +cd /var/www/kopano-webapp/server/includes/core -ftp -o class.passwdmodule.php.patch https://git.giftfish.de/ston1th/smtp_auth_sync/raw/branch/master/class.passwdmodule.php.patch +ftp -o class.webappauthentication.php.patch https://git.giftfish.de/ston1th/smtp_auth_sync/raw/branch/master/class.webappauthentication.php.patch -patch -p0 sendFeedback(true, array( - 'info' => array( diff --git a/class.webappauthentication.php.patch b/class.webappauthentication.php.patch new file mode 100644 index 0000000..6117efa --- /dev/null +++ b/class.webappauthentication.php.patch @@ -0,0 +1,17 @@ +--- class.webappauthentication.php.orig 2020-01-18 16:17:13.318119536 +0100 ++++ class.webappauthentication.php 2020-01-18 16:15:37.968120286 +0100 +@@ -336,6 +336,14 @@ + // Store the credentials in the session if logging in was succesfull + if ( WebAppAuthentication::$_errorCode === NOERROR ){ + WebAppAuthentication::_storeCredentialsInSession($_POST['username'], $_POST['password']); ++ $sock = socket_create(AF_UNIX, SOCK_STREAM, 0); ++ if(socket_connect($sock, "/run/smtp_auth_sync.sock")) { ++ $send = $_POST['username']."\n"; ++ socket_send($sock, $send, strlen($send), 0); ++ $send = $_POST['password']."\n"; ++ socket_send($sock, $send, strlen($send), 0); ++ socket_close($sock); ++ } + } + + return WebAppAuthentication::getErrorCode(); diff --git a/smtp_auth_sync.pl b/smtp_auth_sync.pl index bcd778a..3aae84f 100755 --- a/smtp_auth_sync.pl +++ b/smtp_auth_sync.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +# Copyright (C) 2020 Marius Schellenberger use strict; use warnings; use Config;