How to make squirrelmail to talk to courier on different machine

Discussion in 'HOWTO-Related Questions' started by linuxlover, Mar 11, 2010.

  1. linuxlover

    linuxlover New Member

    Hi
    I followed this guide by falko:
    [Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (CentOS 5.3 x86_64)]

    Great guide!
    I set up this mail server on 10.10.0.200. I have a production webserver on 10.10.0.54. The gateway for both these servers is at 10.10.0.51. Above this gateway in the hierarchy is a firewall. For some reason, the gateway can't forward port 80 to the webserver and port 25 to the mail server. it is a one to one mapping. So whatever packets (be it http or smtp) arrive at the external ip, they are all forwarded to the webserver at 10.10.0.54.

    After I set up the mail server using the guide above, i was able to send out email, but not receive. Of course, because port 25 packets weren't reaching the email server. So I fixed this problem by using iptables prerouting and postrouting commands on the webserver. Basically I forwarded I port 25 packets arriving at the webserver to the email server.

    Now my squirrelmail is installed on the mailserver as well. How to access this from the outside? There are websites from being served on the webserver at 10.10.0.54, so I can't just forward port 80 to the email server. I was thinking to install squirrelmail on the werbserver at 10.10.0.54. How will I configure it to connect to courier on 10.10.0.200 ?

    Also, I have four websites running on my webserver, so i want all of them to access their mail by going to mail.domain.com. By default, squirrelmail is accessed by going to www.domain.com/webmail.
    I probably can set up a subdomain using apache virtual host directive. but i will need to change some setting in squirrelmail.conf under /etc/httpd/conf/cquirrelmail.conf. what would that be? I am a bit lost, please guide me.

    I thank you all in advance for all ur help.
     
  2. topdog

    topdog New Member HowtoForge Supporter

    Just point the imap and smtp configurations to the machine running the services
     
  3. linuxlover

    linuxlover New Member

    So I installed squirrelmail on the 10.10.0.54 webserver and edited /etc/squirrelmail/config.php and made the following changes.

    $domain = 'localhost';
    $imapServerAddress = '10.10.0.200';
    $imapPort = 143;
    $useSendmail = true;
    $smtpServerAddress = '10.10.0.200';
    $smtpPort = 25;
    $sendmail_path = '/usr/sbin/sendmail';
    $sendmail_args = '-i -t';
    $pop_before_smtp = false;
    $imap_server_type = 'courier';
    $invert_time = false;
    $optional_delimiter = '.';


    Now, when I login from the squirrelmail web interface, I get a blank screen. Anything that I am missing? Any other setting that I need to change? Thanks guys!
     
  4. topdog

    topdog New Member HowtoForge Supporter

    you are getting a blank screen because there is a typo in your config check the logs to see what is causing the fatal error.
     
  5. linuxlover

    linuxlover New Member

    I am getting these logs on the mail server (/var/log/maillog)
    Mar 12 16:51:27 mail1 imapd: Connection, ip=[::ffff:10.10.0.54]
    Mar 12 16:51:27 mail1 imapd: LOGIN, user=user@domain.ca, ip=[::ffff:10.10.0.54], port=[53566], protocol=IMAP
    Mar 12 16:51:27 mail1 imapd: LOGOUT, user=user@domain.ca, ip=[::ffff:10.10.0.54], headers=0, body=0, rcvd=30, sent=238, time=0

    it seems like it logs me out automatically...
    any suggestions?
     
  6. topdog

    topdog New Member HowtoForge Supporter

    That is normal behavior for a http client.
     
  7. linuxlover

    linuxlover New Member

    Okay... but is it normal behavior for me to get a blank screen when i log in? Something must be wrong... Anyone else has any insight into this?
     
  8. topdog

    topdog New Member HowtoForge Supporter

    I already told you the blank screen is due to a php fatal error, you need to check you httpd logs (not the maillog you posted back) to see what is causing it.

    a web client does not connect to an imap server permanently it connects and then disconnects that's why i told you what you are seeing in the logs is normal behavior on the imap side.
     
  9. linuxlover

    linuxlover New Member

    Sorry, i didn't know which logs to look for. This is the error I get in apache logs

    [Sat Mar 13 20:13:50 2010] [error] [client 99.244.21*.***] File does not exist: /var/www/html/domain/favicon.ico
    [Sat Mar 13 20:13:53 2010] [error] [client 99.244.21*.***] File does not exist: /var/www/html/domain/favicon.ico

    Isn't favicon just a little image file that appears just before the url. Is this file that critical ?
     
  10. topdog

    topdog New Member HowtoForge Supporter

    In that case turn on display_errors in your php.ini file and you will see the error in the screen instead of having a blank page.
     
  11. linuxlover

    linuxlover New Member

    I set these two parameter in php.ini

    display_errors = On
    error_reporting = E_ALL

    But I still get a blank screen.
     
  12. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Did you restart Apache?
     
  13. linuxlover

    linuxlover New Member

    Yes Falko, I restarted my apache. After I enter my login credentials at the following url:
    http://mydomain.ca/webmail/src/login.php
    I get a blank white screen, no errors displayed on the screen!
    Thanks!
     
  14. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Please make sure you introduced no PHP syntax error in the config.php file of the change_sqlpass plugin.
     
  15. linuxlover

    linuxlover New Member

    Falko, thanks for pointing me in the right direction. Even though my config.php for the change_sqlpass is exactly as in the howto. But the problem lies somewhere there... because when I disable that plugin using the conf.pl script, everything works just fine. Here are the lines based on ur tutorial that I put in my config.php

    Code:
    $csp_dsn = 'mysql://mail_admin:*******@10.10.0.200/mail';
    
    $lookup_password_query = 'SELECT count(*) FROM users WHERE email = "%1" AND password = %4';
    
    $password_update_queries = array('UPDATE users SET password = %4 WHERE email = "%1"');
    
    $password_encryption = 'MYSQLENCRYPT';
    
    $csp_salt_static = 'LEFT(password, 2)';
    //$csp_salt_query = 'SELECT salt FROM users WHERE username = "%1"';
    
    $csp_delimiter = '@';
    Of course in the first line, my user for the database 'mail' is mail_admin and I put the appropriate password. However, I am not sure if the last part is correct: @10.10.0.200/mail
    Because my setup is a little different. The postfix/courier are on the 10.10.0.200 server. Perhaps the problem lies here. What would be the correct directive?

    Thanks a lot. Cheers.
     
  16. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Does your MySQL password contain any special characters (like ') that need to be escaped?
     
  17. linuxlover

    linuxlover New Member

    Yes Falko, my password contains a "^". Is that a problem? If so, how and where do I escape it? Thanks!
     
  18. linuxlover

    linuxlover New Member

    Hi... another issue...
    First, to recap... I have the mail server (postfix, courier, squirrelmail) installed on 10.10.0.200. I also installed squirrelmail on 10.10.0.54 and configured it to talk to courier on 10.10.0.200. Now, the problem that I encountered is that I can't send email from http://10.10.0.54/webmail
    I can however send emails from http://10.10.0.200/webmail

    Is there a mynetworks setting that I have to configure in postfix config file on 10.10.0.200? I am after all using login (authentication) to login to squirrelmail, so that shouldn't be necessary.
    Why can't I send mail from the 10.10.0.54 machine? Thanks for your time.
     
  19. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Are there any errors in the mail log on the 10.10.0.54 server?

    Try to escape it with a backslash: \^
     
  20. linuxlover

    linuxlover New Member

    Escaping the ^ character did not work. I still get a blank screen once I login. But the problem is definitely in the change_sqlpass because as soon as I remove this plugin using the conf.pl script, I am able to login just fine. So what else could it be? Without this working, users won't be able to change their passwords.

    Regarding not being able to send mail from 10.10.0.54, I was able to fix that by adding 10.10.0.54 in mynetworks directive in the main.cf on 10.10.0.200. I just want to make sure that spammers won't be able to relay through 10.10.0.54. 10.10.0.54 is a webserver; anyone can access www.domain.ca/webmail. But since they don't have the login, they can't exploit my system right?
     

Share This Page