Broken Email Server in Multiserver Setup

Discussion in 'Installation/Configuration' started by atjensen11, Sep 17, 2012.

  1. atjensen11

    atjensen11 New Member

    I followed the multiserver setup How To for Debian.

    Everything was working great until I tried to mess with it.

    I originally setup the mail server with the hostname "mail1". I decided I wanted to change the hostname to "mx1".

    I changed the value in the mail server's /etc/hostname and /etc/mailname files. I also went through /etc/postfix/main.cf and changed the appropriate hostnames.

    I went into the ISPConfig administration panel on the primary server and changed the hostname of the mail server under System->Servers.

    I then changed my mind and reverted all the changes I had made. After reverting the changes, the mail server will still send and receive emails, but it doesn't appear that they primary server can control the mail server anymore.

    For example, I tried creating a new email domain of "example.com". That domain was never created under /var/vmail of the mail server.

    Please help. I tried finding some log files, but the ISPConfig log file on the primary server was empty.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Most likely the mail server is not able to connect to the master server anymore trough mysql. The hostname of the slave servers (in this case the mail server) is part of the mysql user permissions, if you change the hostname of the mail server, it has to be changed in the /etc/hosts files of all servers in your cluster as well, then go trough all tables in the "mysql" MySQL database on the matser server, you will find the old hostname in several records, change all these records with e.g. phpmyadmin to the new hostname and then restart the mysql server on the master server.
     
  3. atjensen11

    atjensen11 New Member

    Till,

    When I was contemplating changing the hostname, I had planned to edit the entries in the database through phpmyadmin. It was at that point that I decided it was too much work and decided to revert back.

    I believe I created one new user entry within phpmyadmin for the new server instead of changing the one already there.

    I don't know if it helps at all, but there are some activities I can perform with the servers in the current state. For example, I can change the password of an email mailbox that was created prior to me messing with things. But as I mentioned, I cannot create a new domain.

    I also found some information about debug logging in ISPConfig over at FAQForge. I did enable that and attempted both creating a new email domain and changing existing mailbox passwords. The debug messaging didn't seem to have any clues indicating a problem with the mail server.

    Code:
    2012-09-17 02:49	mail1.example.com	Debug	Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock	
    2012-09-17 02:49	mail1.example.com	Debug	Processed datalog_id 877	
    2012-09-17 02:49	mail1.example.com	Debug	Replicated from master: REPLACE INTO mail_domain (`domain_id`,`sys_userid`,`sys_groupid`,`sys_perm_user`,`sys_perm_group`,`sys_perm_other`,`server_id`,`domain`,`active`) VALUES ('16','1','0','riud','ru','','3','example.com','y')	
    2012-09-17 02:49	mail1.example.com	Debug	Found 1 changes, starting update process.	
    2012-09-17 02:49	mail1.example.com	Debug	Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    
    Code:
    2012-09-17 02:51	mail1.example.com	Debug	Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock	
    2012-09-17 02:51	mail1.example.com	Debug	Processed datalog_id 878	
    2012-09-17 02:51	mail1.example.com	Debug	Calling function 'update' from plugin 'maildeliver_plugin' raised by event 'mail_user_update'.	
    2012-09-17 02:51	mail1.example.com	Debug	Created Maildir /var/vmail/[existing domain]/[existing mailbox]/Maildir with subfolder: Junk	
    2012-09-17 02:51	mail1.example.com	Debug	Created Maildir /var/vmail/[existing domain]/[existing mailbox]/Maildir with subfolder: Trash	
    2012-09-17 02:51	mail1.example.com	Debug	Created Maildir /var/vmail/[existing domain]/[existing mailbox]/Maildir with subfolder: Drafts	
    2012-09-17 02:51	mail1.example.com	Debug	Created Maildir /var/vmail/[existing domain]/[existing mailbox]/Maildir with subfolder: Sent	
    2012-09-17 02:51	mail1.example.com	Debug	Created Directory: /var/vmail/[existing domain]	
    2012-09-17 02:51	mail1.example.com	Debug	Calling function 'user_update' from plugin 'mail_plugin' raised by event 'mail_user_update'.	
    2012-09-17 02:51	mail1.example.com	Debug	Replicated from master: REPLACE INTO mail_user (`mailuser_id`,`sys_userid`,`sys_groupid`,`sys_perm_user`,`sys_perm_group`,`sys_perm_other`,`server_id`,`email`,`login`,`password`,`name`,`uid`,`gid`,`maildir`,`quota`,`cc`,`homedir`,`autoresponder`,`autoresponder_start_date`,`autoresponder_end_date`,`autoresponder_text`,`move_junk`,`custom_mailfilter`,`postfix`,`access`,`disableimap`,`disablepop3`,`disabledeliver`,`disablesmtp`,`disablesieve`,`disablelda`) VALUES ('16','1','0','riud','riud','','3','[existing mailbox]','[existing mailbox]','[password]','[name]','5000','5000','/var/vmail/[existing domain]/[existing mailbox]','0','','/var/vmail','n','0000-00-00 00:00:00','0000-00-00 00:00:00','','n','[custom_mailfilter]','y','n','n','n','n','n','n','n')	
    2012-09-17 02:51	mail1.example.com	Debug	Found 1 changes, starting update process.	
    2012-09-17 02:51	mail1.example.com	Debug	Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    
     
    Last edited: Sep 17, 2012
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The debug output seems to be ok. Has the maildir /var/vmail/[existing domain]/[existing mailbox]/Maildir been created?
     
  5. atjensen11

    atjensen11 New Member

    Till,

    The first debug output I posted is from when I try to add a new email domain that hasn't been previously created on this server. In this case, the folders are NOT created on the mail server.

    The second debug output I posted is from when I made changes to the password of an existing mailbox that was created prior to me messing things up. Therefore, the domain and mailbox folders already existed on the mail server. Furthermore, the password is actually changed so it appears that ISPConfig is performing the correct action.
     
  6. atjensen11

    atjensen11 New Member

    I did some more testing last night and today.

    When I create a new email domain, I have verified that it is populated within the ISPConfig database on the master server. As I've mentioned, I no longer see the folder physically created in the /var/vmail directory on the mail server.

    I have also verified that the new email domain is populated within the ISPConfig database on the mail server (not master server).

    Similarly, if I delete the email domain, the domain is removed from the ISPConfig database on both servers.

    I am using the mail_domain table to perform this testing.

    I also created a new email mailbox for a domain that was existing prior to my changes which broke this feature. This test was successful as a new user folder was created under the /var/vmail/[existing domain]/ directory.

    Therefore, I am led to believe the issue has to do with any scripts that are run after populating the database. However, I don't know ISPConfig well enough to test these scripts.

    I also performed the additional troubleshooting steps from the FaqForge article. The result when I run the server.sh script is rather uneventful with no errors reported.

    Code:
    root@mail1:/# /usr/local/ispconfig/server/server.sh
    finished.
    
    I would appreciate any additional help on this matter.
     
    Last edited: Sep 19, 2012
  7. atjensen11

    atjensen11 New Member

    I tried adding a domain again this evening. The data from the datagram is below:

    Code:
    a:2:{s:3:"new";a:9:{s:9:"domain_id";s:2:"20";s:10:"sys_userid";s:1:"1";s:11:"sys_groupid";s:2:"14";s:13:"sys_perm_user";s:4:"riud";s:14:"sys_perm_group";s:2:"ru";s:14:"sys_perm_other";s:0:"";s:9:"server_id";s:1:"3";s:6:"domain";s:11:"example.com";s:6:"active";s:1:"y";}s:3:"old";a:9:{s:9:"domain_id";N;s:10:"sys_userid";N;s:11:"sys_groupid";N;s:13:"sys_perm_user";N;s:14:"sys_perm_group";N;s:14:"sys_perm_other";s:0:"";s:9:"server_id";N;s:6:"domain";N;s:6:"active";N;}}
    
    Please help me troubleshoot this problem.
     
  8. atjensen11

    atjensen11 New Member

    [SOLVED] Broken Email Server in Multiserver Setup

    I decided to stand up a brand new email server and add it to the multiserver setup. After going through this effort, I repeated my test step and was disappointed to see the new server behaved just like the old server. I began to suspect a problem with the master server in the setup.

    I decided to step through the ISPConfig code. I noticed that the server.sh script calls the mail module. The mail module raises an event which is included in the mail plugin. Upon searching the mail plugin, I could not find any function that creates the mail domain directory. Instead, I noticed that the function which creates the user mailbox does a check to see if the mail domain directory exists. If the mail domain directory doesn't exist, the user mailbox function creates it.

    Therefore, I concluded that the test I was performing to see if the server was working correctly was flawed. I simply needed to create a mailbox within the new email domain in order for the mail domain directory to be created.
     

Share This Page