Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a web and mail server running Ubuntu 12.04. I installed iRedMail and had it running fine, but this morning mail was not connecting and none of my sites worked. I checked some logs which told me to run mysqladmin flush-hosts. That may have put the sites online, but they went up and down and I'm not sure it did anything.

Mar 28 15:13:19 server1 roundcube: MDB2 Error: unknown error (-1): _doConnect: [Error message: Host 'server1.MY_DOMAIN.TLD' is not allowed to connect to this MySQL server] [Native code: 1130] [Native message: Host 'server1.MY_DOMAIN.TLD' is not allowed to connect to this MySQL server]

Then I found this and wondered why it didn't say localhost. Shouldn't localhost be trying to connect to mysql?

Here's /etc/hostname/

server1

Here's /etc/hosts

fe00::0     ip6-localnet
ff00::0     ip6-mcastprefix
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters


127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
MY.IP.222.333 server1.MY_DOMAIN.TLD  server1
::1     localhost ip6-localhost ip6-loopback

My hunch is that there is something wrong with these files, as requests should be coming from localhost.

EDIT: I've looked around in config files for something not pointing to 127.0.0.1 or localhost, but no joy, they all do.

I'm using Ubuntu 12.04 with iRedMail installed and ClamD removed using this tutorial

Edit: This pptp script was the problem. Particularly,

iptables -t nat -A POSTROUTING -j SNAT --to $ip
# saves iptables routing rules and enables them on-boot
iptables-save > /etc/iptables.conf

Where $ip is my server's public IP. After I enable that, I can VPN tunnel through the server, but all web traffic seems to lead back to itself? I would appreciate if someone knows another way.

share|improve this question

2 Answers 2

Looks like your webserver is connecting to your public IP to get to mysql. Check your application config to make sure the database server is 127.0.0.1 or localhost.

share|improve this answer
    
Ok, but it's happening with all services, websites, webmail, Mail.app. I will check each. –  Noah Mar 28 '13 at 21:40
    
Here's from /etc/dovecot-mysql.conf : connect = host=127.0.0.1 , Yet /var/log/dovecot.log says Mar 28 17:42:45 auth-worker: Error: mysql(127.0.0.1): Connect failed to database (vmail): Host 'server1.MY_DOMAIN.TLD' is not allowed to connect to this MySQL server - waiting for 125 seconds before retry –  Noah Mar 28 '13 at 21:50
    
/etc/amavis/conf.d/ says @storage_sql_dsn = ( ['DBI:mysql:database=amavisd;host=127.0.0.1;port=3306', 'amavisd', 'HASHEDPASSWORD?'], ); –  Noah Mar 28 '13 at 22:08
    
Can you think of other places to look? –  Noah Mar 28 '13 at 22:54
1  
The error message was from roundcoube, its config is still missing. By the way: please add additional information to your question, not to comments on an answer. Especially because my answer is looking a bit bogus by now and I may delete at so it doesn't distract. –  Dennis Kaarsemaker Mar 28 '13 at 22:58

This pptp script was the problem. Particularly,

iptables -t nat -A POSTROUTING -j SNAT --to $ip
# saves iptables routing rules and enables them on-boot
iptables-save > /etc/iptables.conf

Where $ip is my server's public IP. After I enable that, I can VPN tunnel through the server, but all web traffic seems to lead back to itself? I would appreciate if someone knows another way.

I found out by reinstalling 12.04, reinstalling iRedMail, putting my sites back, up, then doing the PPTP steps. I used the VPN for a while and realized everything else was down. Flushing the NAT tables fixed it.

share|improve this answer
    
The problem seems to be exclusive to ServerCrate OpenVZ VPS. I'm talking with them about a solution. I will comment again with how I feel about their responsiveness later. –  Noah Mar 30 '13 at 3:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.