Author Topic: PostfixAdmin bridge  (Read 54068 times)

nejko

  • Guest
PostfixAdmin bridge
« on: June 15, 2008, 06:07:06 PM »
Hello,

I have written a patchset for RoundCube, to integrate PostfixAdmin's functions:
password change, vacation, forwarding - and also to copy user's full name from
postfixadmin's db when creating the default identity.

You can get my code here: http://nejc.skoberne.net/rcpfa .

I hope you'll find it useful. Send bugs and feature requests to skoberne.net>.

Bye,
Nejc

Offline guilichou

  • Jr. Member
  • **
  • Posts: 19
PostfixAdmin bridge
« Reply #1 on: July 28, 2008, 06:58:40 AM »
I didn't get it to work at all...

The first problem of your patch is that it implies that the postfix database and RC database are one unique database... Which isn't my case...

And when I dumped my RC database in the postfix database... it doesn't seem to work. I did look as the parameters you added in the main.inc.php but didn't change anything...
When I change the vacation message, I get a blank page...

nejko

  • Guest
PostfixAdmin bridge
« Reply #2 on: July 28, 2008, 08:07:52 AM »
Hey,

Quote from: guilichou;13123

The first problem of your patch is that it implies that the postfix database and RC database are one unique database... Which isn't my case...


I assumed that most users use PostfixAdmin and Roundcube together this way. You can also add support for a separate database, of course. Patches are welcome.

Quote from: guilichou;13123

And when I dumped my RC database in the postfix database... it doesn't seem to work. I did look as the parameters you added in the main.inc.php but didn't change anything...
When I change the vacation message, I get a blank page...


It works for me and many other people, so it is likely to be a problem with your setup. Saying "it doesn't seem to work" is completely helpless since I can't guess what errors did you get. If you could paste the errors you get in Apache error log file, the chances of getting help would increase. Getting blank page usually means something went wrong with a PHP script. It's perfectly possible you hit a bug since your configuration might be unusual.

Also, this morning (GMT+1) I released RCPFA 1.0.3, which fixes two annoying bugs. Check the project's page.

Oh, and what versions of software do you use?

Bye,
Nejc

Offline STiAT

  • Newbie
  • *
  • Posts: 8
PostfixAdmin bridge
« Reply #3 on: July 28, 2008, 11:18:09 AM »
This one is far from perfect.
-> It requires that the rc and pa dbs are the same (?)
-> It requires that the login name actually is the e-mail address (why? just because pa wants it like this?)
-> In 1.0.3, I can't get it working at all - the newly gained tabs do not do anything at all in 0.2rc

Seems like it needs some fixing ...

nejko

  • Guest
PostfixAdmin bridge
« Reply #4 on: July 28, 2008, 12:11:59 PM »
Quote from: STiAT;13128
This one is far from perfect.


I agree. But, we can make it better together, right?

Quote from: STiAT;13128
-> It requires that the rc and pa dbs are the same (?)


Actually, after patching, you can configure the database which PostfixAdmin uses in db.inc.php:

// PEAR database DNS for read/write operations on PostfixAdmin database
$rcmail_config['pfa_db_dsnw'] = 'mysql://postfixadmin:mail2c0kq@localhost/postfix';

Quote from: STiAT;13128
-> It requires that the login name actually is the e-mail address (why? just because pa wants it like this?)


Yes. What behaviour would you expect?

Quote from: STiAT;13128
-> In 1.0.3, I can't get it working at all - the newly gained tabs do not do anything at all in 0.2rc


0.2rc? Am I missing something here? The latest official release is 0.2-alpha? As the project's page says, it works with 0.2-alpha and some latest SVN revisions (but not the latest).

Quote from: STiAT;13128
Seems like it needs some fixing ...


I am interested in fixing it and providing a better link between RC and PA and it is great if you want to help me.

Thanks,
Nejc

Offline jcip

  • Newbie
  • *
  • Posts: 4
Berkeley DB
« Reply #5 on: July 28, 2008, 10:00:30 PM »
Do you think it might be possible to modify this script to work with a Berkley DB based postfix install?  I believe that's what a vanilla OS X based mail server uses, I could be mistaken however.  I'd love to replace Squirrel Mail and have this functionality added in roundcube.

nejko

  • Guest
PostfixAdmin bridge
« Reply #6 on: July 29, 2008, 02:19:14 AM »
Quote from: jcip;13134
Do you think it might be possible to modify this script to work with a Berkley DB based postfix install?  I believe that's what a vanilla OS X based mail server uses, I could be mistaken however.  I'd love to replace Squirrel Mail and have this functionality added in roundcube.


Hello, actually RCPFA only needs PostfixAdmin's database. Do you have MySQL database for PostfixAdmin? If not, what db do you use for PostfixAdmin (not Postfix)?

Bye,
Nejc

Offline guilichou

  • Jr. Member
  • **
  • Posts: 19
PostfixAdmin bridge
« Reply #7 on: July 29, 2008, 01:08:11 PM »
Totally ready to help to improve the plugin!

Nevertheless, I can't get anything from the apache log... what parameter do use?
I have:
        LogLevel emerg (I tried warn, error)
        ErrorLog        /var/log/apache2/log-mailbeta.log
        CustomLog       /var/log/apache2/log-mailbeta.log combined

Thanks

nejko

  • Guest
PostfixAdmin bridge
« Reply #8 on: July 29, 2008, 01:20:59 PM »
Quote from: guilichou;13148
Totally ready to help to improve the plugin!

Nevertheless, I can't get anything from the apache log... what parameter do use?
I have:
        LogLevel emerg (I tried warn, error)
        ErrorLog        /var/log/apache2/log-mailbeta.log
        CustomLog       /var/log/apache2/log-mailbeta.log combined


Make sure you have "log_errors = On" in php.ini. Try writing ErrorLog to another file than CustomLog. The error should appear in the ErrorLog.

Bye,
Nejc

Offline guilichou

  • Jr. Member
  • **
  • Posts: 19
PostfixAdmin bridge
« Reply #9 on: July 29, 2008, 04:14:33 PM »
Followed your instructions, but i still couldn't get any interesting info out in the log files... i'll try and search the web to try and get more infos...

Offline STiAT

  • Newbie
  • *
  • Posts: 8
PostfixAdmin bridge
« Reply #10 on: August 02, 2008, 06:05:03 AM »
@nejko:
I meant 0.2alpha actually. The buttons just never get active in the last version, and I havn't found the reason in the code yet.

Of course we can improve it.

The behaviour I'd expect is actually being able to provide a list of fields of a table which shall be taken for login.
In example, I configured roundcube and dovecot, so the users can either use their mail address OR a username to login (I simply used the name field in postfixadmin).

The reason for this is, that I'll one day disable mail logins. The reason is simple: Being able to be hacked just needs 2 informations: The e-mail and the password. Most likely, the guys trying to hack an address have the mail address of the user they'd like to log in to. If i disable the mail address, and just have a username to login, he'd need to hack two different informations, and has quite endless possibilities, and never knows the right account.

The patches seem to work properly (for the plugin side of view). Still, the plugin isn't functional. Allthough, as I said I'm still looking where the problem is located.

For the database: I've already found that there is a configuration, and adobted it. Allthough - still not working ;-).

// STi

Offline denis123

  • Newbie
  • *
  • Posts: 2
works great
« Reply #11 on: August 20, 2008, 08:26:21 AM »
Great patchset. works just fine. Thanks.

Offline raffe1234

  • Newbie
  • *
  • Posts: 2
PostfixAdmin bridge
« Reply #12 on: October 09, 2008, 05:04:23 PM »
To get it to work, I needed to patch index.php manually (I think it has changed since the release of pfa patch).

Before it showed the new tabs, but when I clicked on them I just got to the "Settings" tab.

After the change, it worked OK.

After this code:
Code: [Select]
// allow 5 "redirects" to another action
$redirects = 0; $incstep = null;
while ($redirects < 5) {
  $stepfile = !empty($action_map[$RCMAIL->task][$RCMAIL->action]) ?
    $action_map[$RCMAIL->task][$RCMAIL->action] : strtr($RCMAIL->action, '-', '_') . '.inc';
   
  // try to include the step file
  if (is_file(($incfile = 'program/steps/'.$RCMAIL->task.'/'.$stepfile))) {
    include($incfile);
    $redirects++;
  }
  else {
    break;
  }
}

I put this code (the code is from index.php.diff)
Code: [Select]
 // >> pfa patch
  if ($RCMAIL->action=='vacation' || $RCMAIL->action=='save-vacation')
  {
    if ($RCMAIL->config->get('pfa_enable_vacation'))
      include('program/steps/settings/pfa_vacation.inc');
    else
 $OUTPUT->show_message('vacationdisabled', 'error');
  }
 
  if ($RCMAIL->action=='password' || $RCMAIL->action=='save-password')
  {
    if ($RCMAIL->config->get('pfa_enable_password'))
      include('program/steps/settings/pfa_password.inc');  
    else
 $OUTPUT->show_message('passworddisabled', 'error');
  }

  if ($RCMAIL->action=='forwarding' || $RCMAIL->action=='save-forwarding')
  {
    if ($RCMAIL->config->get('pfa_enable_forwarding'))
      include('program/steps/settings/pfa_forwarding.inc');
    else
 $OUTPUT->show_message('forwardingdisabled', 'error');
  }
  // << pfa patch

Offline gyrex

  • Newbie
  • *
  • Posts: 4
PostfixAdmin bridge
« Reply #13 on: October 17, 2008, 03:58:23 AM »
Hi,

I'm running 0.2 beta and i've added this code to index.php. Unfortunately it's not working as expected though.

I can see the vacation password and forwarding tabs but when I click on them nothing happens. Has anyone been able to get this to work with the pfa patch?

Any help would be greatly appreciated!

Offline gyrex

  • Newbie
  • *
  • Posts: 4
PostfixAdmin bridge
« Reply #14 on: October 17, 2008, 04:10:28 AM »
Sorry - the page was cached for some reason!!! It's all working now!

Many thanks!