Cannot delete server or edit users or email aliases

Cannot delete Virtual servers or edit users or email aliases - the edit users and aliases pages simply displays "ERROR" and nothing more and the delete Virtual servers page displays nothing at all anymore after completing the Postfix configuration (fir use as virtual with mariadb which IS now working. I saw another issue about the old style sql format being needed of the table and fields style statements needed in the Postfix cf files to map properly for Webnin/Virtualmin having something to do with this - but their was no resolution

Like this in a cf file - /etc/postfix/mysql-virtual_forwardings.cf is the example below

user = mail_admin

password = xxxxxxxxxxx

dbname = mail

table = forwardings

select_field = destination

where_field = source

query = SELECT destination FROM forwardings WHERE source='%s'

hosts = 127.0.0.1

the three lines

table = forwardings

select_field = destination

where_field = source

is the old style

AND

query = SELECT destination FROM forwardings WHERE source='%s'

is the new style - and without both the webmin Virtualmin configuration complains about not being ready to use

The Virtual servers were created with a cPanel migration and that still works

BEFORE getting Postfix configured the mailserver would not start and the pages DID work then

Is there a known fix or workaround or place to start resolving this ??

Status: 
Active

Comments

The system does not save code formatting

Can you post the exact error message you are getting from Virtualmin?

Ummm ... are those pages actually blank like that? I don't see any error message text.

I was also puzzled - it is a screenshot - are errors LOGGED somewhere else also ??

Could you hit 'View Source' on your browser, and see if there's any error in the source of those pages?

If you like, feel free to copy and paste the full source of the web pages into the request here, and we can review that.

The errors are also logged to /var/webmin/miniserv.error

I have noticed the var/mail directory is Webmin's default and the mailis in the form "user.domain"

After I set up Postfix for virtual mailboxes - currently at /var/www/vmail/domain.com/username/ using this guide => https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and... and then using this to re-create the tables because they had no indexes => https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and... -- and got it working properly to send and receive -------- I then discovered postfixadmin ( http://postfixadmin.sourceforge.net/ ) and a found a RPM to install version 3.0 since Virtualmin / webmin apparently still uses the old style interface to mysql and was not working and does not have an elegant admin interface for Postfix Mariadb SQL virtual mailbox setup and admin

I have since discovered that the cPanel migrations each setup only ONE mail user before delivering this error and dying for each of the domains I migrated

"" Re-creating mail users for domain.com .. HTTP/1.0 500 Perl execution failed Server: MiniServ/1.830 Date: Mon, 16 Jan 2017 22:07:44 GMT Content-type: text/html; Charset=iso-8859-1 Connection: close

Error - Perl execution failed Can't call method "flock" on an undefined value at /usr/libexec/webmin/exim/exim-lib.pl line 257. ""

cPanel uses Exim and Dovecot

I have also discovered that Postfixadmin sets up the Mariadb SQL database tables just slightly different than the guides I used - and I can go back through them and re-name the tables to match so postfixadmin will read them and work - mainly the "domains" table needs to be named "domain" and the "users" table is the "mailbox" table and there is the user "vmail" which currently forms and holds and acts a mailbox mailman which virtualmin actually sees as a user

AFTER I got Postfix working I migrated two other cpanel virtual account servers and virtualmin set up users as the domain name only in var/mail

It seems otherwise Virtualmin sees no configuration of Postfix I have done at all

So . . . . before I go hacking into modifying my Postfix setup to fit also Postfixadmin - is there any special known "how to"--- to get Webmin working with Postfix with virtual domains and users

Can you try adding the line error_stack=1 to /etc/webmin/config , and then re-try editing a user? That should display more details on exactly where in the code the error message is coming from.

StatusFileSize
new43.99 KB

Also uploaded a screenshot - in case this destroys an easy to read format. Looks like it is those mysql mapping issues

Call Stack Trace

File Line Function
/usr/libexec/webmin/postfix/postfix-lib.pl 785 WebminCore::error
/usr/libexec/webmin/virtual-server/feature-mail.pl 1363 postfix::get_maps
/usr/libexec/webmin/virtual-server/virtual-server-lib-funcs.pl 647 virtual_server::list_virtusers
/usr/libexec/webmin/virtual-server/list_users.cgi 11 virtual_server::list_domain_users
(eval 64) 6 (eval)
/usr/libexec/webmin/miniserv.pl 2402 (eval)
/usr/libexec/webmin/miniserv.pl 914 miniserv::handle_request

Yeah, looks like an error connecting to MySQL. What's odd is that the message doesn't say what the specific error is!

Are you running the latest version of Webmin there (1.831) ?

I'll upgrade to 1.831 - I thought it updated automatically via yum and webmins repo

upgraded to 1.831 and this is now the error

Call Stack Trace

File Line Function /usr/libexec/webmin/postfix/postfix-lib.pl 785 WebminCore::error /usr/libexec/webmin/virtual-server/feature-mail.pl 1363 postfix::get_maps /usr/libexec/webmin/virtual-server/virtual-server-lib-funcs.pl 647 virtual_server::list_virtusers /usr/libexec/webmin/virtual-server/list_users.cgi 11 virtual_server::list_domain_users (eval 64) 6 (eval) /usr/libexec/webmin/miniserv.pl 2402 (eval) /usr/libexec/webmin/miniserv.pl 914 miniserv::handle_request

StatusFileSize
new46.73 KB

As can be seen - it is still the same error.

If you say it cannot connect to mysql - what is the mysql user webmin is supposed to be ??

I never made a user for it - but the user and password IS in the cf files so it SHOULD be able to connect

StatusFileSize
new54.52 KB

The stack error also shows on the Virtual domains page under Postfix mail server in Webmin - see accompanying jpg

None of my Postfix configuration shows in webmin it appears

Ok, I see the issue now - the underlying problem is that you don't have the DBD::mysql perl module installed, which is needed to connect to MySQL. The fix to install this is to run :

perl -MCPAN -e 'install DBD::mysql'

The secondary bug (which will be fixed in the next Webmin release) is that the error message that should explain this isn't being displayed properly.

StatusFileSize
new50.08 KB
new46.07 KB

OK . . . that was the foundation issue it appears. I Installed perl-DBD-MySQL.x86_64 0:4.023-5.el7 as an RPM via yum from the base repo. The new error pointed me to the Postfix virtual set up page at http://www.postfixvirtual.net/postfixconf.html where the expected tables and SQL queries to set them up are found.

Creating those tables from that page at http://www.postfixvirtual.net/postfixconf.html allowed Virtuamin to display the users and the delete Virtual server page is also working again

perl-DBD-Pg.x86_64 was installed but not perl-DBD-MySQL.x86_64

Now I need to modify the postfixadmin config and my postfix virtual config to match the postfix page's table names and keep the setup I have working - still working - and then hopefully be able to be seen and partly managed finally in Virtualmin because the user mailboxes still throw an error and are not recognized properly where they should be

However that setup at that page is using Cyrus SASL with Courier and I am using Dovecot - so right now only the table creation solved the page display errors

I will work on modifying the database tables but . . . . this brings me to the original issue I thought I was going to run into and apparently still exits - the mailbox format of Mbox that Virtualmin / Webmin apparently uses

There are two common formats for storage of mail messages. The first one is Mbox and the other one is Maildir. Mbox format keeps all mail messages in a single file which has some disadvantages that apparently Virtualmin / Webmin uses. The Maildir format keeps all mails in separate files in special folders. My installation uses the Maildir format so that each mail virtual user has a mail directory.

Mail directory for my users is currently " /var/www/vmail/domain.com/user/Maildir " which is working fine

Virtualmin / Webmin shows it is setup to use the Mbox format at /var/mail/"user" as user.domainname (without tjd extension => e.g. ".com") - which does not work in any fashion in Virtualmin but to display what thinks are users

It looks like this issue will still exist even when the tables issues are fixed

As I re-setup and adjust Postfix is there any way to use the maildir format with Virtualmin / Webmin instead

Virtualmin attempts to detect users' mail file locations by checking your Postfix config file. Make sure you have the line :

home_mailbox = Maildir/

That results in it tryingto look in `user/domainname/maildir when it needs to look in /var/www/vmail/domainname.com/user - now that I know - I will have to try to reconfigure

Yeah, you will need to adjust a combination of the home_mailbox and mail_spool_directory settings.

That is what I thought and have tried - but so far no luck - it always puts the path - behind ~user/domainname - and virtualmin keeps the mbox format it seems anyway - I won't know for sure until the mapping setup is all re-done and working into Virtualmin

Right now I am gluing the postfixadmin db setup to my postfix virtual settings and modifying the db tables and main.cf and master.cf so dovecot keeps working and re-doing the cf queries

Postfix has changed as Postfix version before 2.10, one uses smtpd_recipient_restrictions for a few commands but with 2.10 and above it is instead smtpd_relay_restrictions = (at least for these=>) permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

[for anyone who comes across this support post in the future]

Can you post the Postfix config entries that you have to deliver to /var/www/vmail/domainname.com/user ?

The links were posted in post #11 of this thread.

I used https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and... initially

The set up Postfix for virtual mailboxes - to put them at /var/www/vmail/domain.com/username/ uses that guide and those also at post #11

The one at http://www.postfixvirtual.net/postfixconf.html also uses that method as does one at http://mailboy.manurevah.com/install

It appears the relevant commands to create this format under the "vmail" user (or "vmailuser") is:

groupadd -g 5000 vmail && useradd -g vmail -u 5000 vmail -d /home/vmail -m -k /dev/null

postconf -e virtual_uid_maps=static:5000

postconf -e virtual_gid_maps=static:5000

I am still trying successfully to glue postfixadmin - I currently only have the domains table re-querying to the domain table and the users table re-querying to the mailbox table the maps cf files I am still working on

Oh, I see ... that's quite a complex setup.

Unfortunately, right now Virtualmin doesn't support this kind of mail delivery configuration :-(

Also, I'm not sure what the benefit of it is vs. just delivering to the home directory?

Virtualmin / Webmin could support this easily by integrating the Postfixadmin RPM as a browser base frontend (like phpmyadmin is) and a modified version of the setup found at http://www.postfixvirtual.net/postfixconf.html

Discussions on the advantages can be found here => http://serverfault.com/questions/564456/maildir-vs-mbox-what-are-the-pra... AND HERE => http://www.linuxmail.info/mbox-maildir-mail-storage-formats/

This is a complex project I am working on using sub-domains and common document root domains under Drupal multisite that will be able to send and receive mail for their ecommerce site without registering a top level domain unless they want one - and then be able to run their ecommerce site without having to be concerned with the backend of a server or vps themselves

Postfixadmin sets up five common mailboxes automatically as aliases and allows domains to be added via a dropdown box and email accounts also all managed through mysql. The articles above put forth the advantages - but in this - my - case the Mbox format will not work at all.

A module could be written for Virtualmin that acts just like phpmyadmin as a frontend to postfix using the browser using postfixadmin - at least easily for RHEL and Centos 7 and maybe 6.8 with the Postfixadmin RPM - as I almost have it fully working.

There were some index key and collation issues as it set up swedish ci in a few other table in the other setups

I came to Virtualmin from cPanel and its Exim and Dovecot setup uses the Maildir format. The sad thing is cPanel as a company and product is working at Dinosaur speed and ways of thought because they try to re-invent the wheel for everything and have hosed their own product into royal junk that way. One example is the free ssl - let encrypt they have just a mess of doing it their way because the httpd.conf file cannot be changed to allow *:443 with a complicated special vhost include file or on each update it will put it back to a ssl mis-match caused broken site. Oh joy.

The amount of of other files cPanel changes - the re-vamping of the web server and way their system works is a flashy piece of junk with lots of bad scripts that "automagically" screw up what one is trying to do - and will UNDO MANUALLY changed files and/or break working changes - that Webmin and Virtualmin will not do. THANKFULLY

In the migration from cPanel the email setup failed - and it could be because perl-dbd-mysql was not installed at the time, but all I can say it there is no backend in cPanel for the Exim configuration like Webmin / Virtualmin has where at least one can "see" the Postfix server configuration in part.

BUT it also lacks a frontend to elegantly manage email like Postfixadmin does - and it does it in the Mbox format which the two links provided show that most all persons in the know are now using or moving to the Virtual Postfix, MySQL/Mariadb and Maildir format

The kicker is of course in Webmin there are "some" config changes one should not make that right now Webmin will let be done - which will / would break the Postfix virtual set up

I used the postfixadmin-3.0-117.1.noarch.rpm which can be found in many places on the web - and after meeting the dependencies, it installed into var/www/html/postfixadmin and after setting up ssl for it as the hostname properly and making the manual changes needed to the config.inc.php file --- its database tables match the config set up found at http://www.postfixvirtual.net/postfixconf.html and it is basically ready to go as a front end to that virtual backend set up.

It should also be said again that setup solved a webmin error also as to a missing database table

I should also say - on a side shoot - that cPanel's set up for mail was weak and spammers were sending mail through some of my domains - which cPanel nor the hosting provider would assist with - while this new set up has shut them down and drops their mail. I have access to sender and relay and access restrictions via postfixadmin

There is little information on the web on how to work with Exim configurations.

So the answer is if you are using Webmin / Virtualmin - or are a hosting provider looking for a way to get away from cPanel - the missing link is an easy quick, solid Virtual Postfix set up for the Webmin / Virtualmin control panel with a frontend and backend that can configured to eventually set the Maildir in the users home directory instead of the mbox format in var/mail - and this is - or could be - it - a postfixadmin integration module that sets up virtual maiboxes Maildir format instead.

This could make hosting providers look at Webmin / Virtualmin more closely with and updated mail install that is virtual Postfix

I am not big time coder - but a script is pretty easy to implement the set up which is largely already done - because I can patch the three setups I used together with phpmyadmin - by just a few table changes and query mods

Good to know . . . but I was looking for a way to convert existing mbox format users to maildir format and have Virtualmin then create any new users ALWAYS to the new Maildir format

I stumbled across a script for doing that - but it does not have Virtualmin / Webmin mods built in - and I will have try to re-find it on the internet

Maybe then I can glue the two together