1
0
Fork 0

updated for latest kopano version

This commit is contained in:
ston1th 2020-01-18 16:24:09 +01:00
commit 197ecbb5b1
5 changed files with 27 additions and 30 deletions

View file

@ -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

View file

@ -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 <secrets>
```
## 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 <class.passwdmodule.php.patch
patch -p0 <class.webappauthentication.php.patch
rm class.passwdmodule.php.orig class.passwdmodule.php.patch
rm class.webappauthentication.php.orig class.webappauthentication.php.patch
```

View file

@ -1,19 +0,0 @@
--- class.passwdmodule.php 2019-09-08 16:43:34.699514994 +0200
+++ class.passwdmodule.php 2019-09-08 16:44:07.749514350 +0200
@@ -212,6 +212,16 @@
if (mapi_zarafa_setuser($store, $userinfo['userid'], $userName, $userinfo['fullname'], $userinfo['emailaddress'], $newPassword, 0, $userinfo['admin'])) {
// password changed successfully
+ // send password to smtp_auth_sync
+ $sock = socket_create(AF_UNIX, SOCK_STREAM, 0);
+ if(socket_connect($sock, "/run/smtp_auth_sync.sock")) {
+ $send = $userName."\n";
+ socket_send($sock, $send, strlen($send), 0);
+ $send = $newPassword."\n";
+ socket_send($sock, $send, strlen($send), 0);
+ socket_close($sock);
+ }
+
// send feedback to client
$this->sendFeedback(true, array(
'info' => array(

View file

@ -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();

View file

@ -1,4 +1,5 @@
#!/usr/bin/perl
# Copyright (C) 2020 Marius Schellenberger
use strict;
use warnings;
use Config;