RainLoop / rainloop-webmail

Simple, modern & fast web-based email client
http://rainloop.net
MIT License
4.1k stars 885 forks source link

stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known #1482

Open DGathagu opened 7 years ago

DGathagu commented 7 years ago

RainLoop version, browser, OS: I'm using RainLoop 1.11.1 on a ubuntu 14.04 vps server. I installed the rainloop web client a few weeks ago and everything worked fine including receiving and sending mail, a few days ago when i try to login into rainloop mailbox i get stuck at the login screen with an error can't connect to server. I have tried checking my ports and permissions to no avail. Here is the screenshot of my imap and smtp configurations and the errors im getting.

rainloop error

akmet commented 7 years ago

Looks like your server is not able to resolv your domain. Can you ping your address? And can you connect to the server via terminal?

kousu commented 7 years ago

I'm getting this too on RainLoop community edition version 1.11.1, running on OpenBSD httpd + php-fpm v7.0.

Here is my config for this setup:

# pkg_add php php-fpm php-curl #-> choose version 7.0
# rcctl enable php70_fpm && rcctl start php70_fpm

# unzip rainloop-community-latest.zip -d /var/www/htdocs/rainloop

# chown -R www:www /var/www/htdocs/rainloop
# find /var/www/htdocs/rainloop -type d -exec chmod 755 {} \;
# find /var/www/htdocs/rainloop -type f -exec chmod 644 {} \;

# cat /etc/httpd.conf

types { include "/usr/share/misc/mime.types" }

server "comms.kousu.ca" {
        listen on * tls port 443
        tls certificate "/etc/letsencrypt/live/comms.kousu.ca/fullchain.pem"
        tls key "/etc/letsencrypt/live/comms.kousu.ca/privkey.pem"
        directory index "index.php"
        root "/htdocs/rainloop/"
        location "*.php" {
            fastcgi socket "/var/www/run/php-fpm.sock"
        }
        location "/data*" {
            block
        }

        log syslog
}

# force https
server "comms.kousu.ca" {
        listen on * port 80
        block return 301 "https://$HTTP_HOST$REQUEST_URI"
}

I get it with any domain; even, for example, imap.gmail.com. If I, use 127.0.0.1 or my server's public IP the test passes (but then trying to log in doesn't work because I have dovecot running SSL and only SSL, which means rainloop needs to know its proper domain name).

I tried taking rainloop out of chroot and it fixed it; perhaps your server is choorted, @gathagu354?

My non-chrooted setup looks like:

# cat /etc/httpd.conf

types { include "/usr/share/misc/mime.types" }

chroot "/"

server "comms.kousu.ca" {
        listen on * tls port 443
        tls certificate "/etc/letsencrypt/live/comms.kousu.ca/fullchain.pem"
        tls key "/etc/letsencrypt/live/comms.kousu.ca/privkey.pem"
        directory index "index.php"
        root "/var/www/htdocs/rainloop/"
        location "*.php" {
            fastcgi socket "/var/www/run/php-fpm.sock"
        }
        location "/data*" {
            block
        }

        log syslog
}

# force https
server "comms.kousu.ca" {
        listen on * port 80
        block return 301 "https://$HTTP_HOST$REQUEST_URI"
}

# mkdir /logs  # because httpd(8) is hardcoded to use this path, assuming it will be under the chroot

and also patch /etc/php-fpm.conf:

-chroot = /var/www
+chroot = /

and rcctl restart php-fpm.

If I figure out how to get rainloop chroot'd I will post it here.

kousu commented 7 years ago

I figured it out!

Not having DNS inside a chroot is a reasonably common problem, and the fix is to make sure resolv.conf exists in the chroot:

# mkdir /var/www/etc/                                                                                                                                                    
# cp /etc/resolv.conf /var/www/etc/        

After this the IMAP tester works.

kousu commented 7 years ago

But mind, if your setup was working, then you must not have been in a chroot in the first place, probably. But maybe /etc/resolv.conf got corrupted or something?

kousu commented 7 years ago

And for future reference, you probably also want

# cp -r /etc/ssl /var/www/etc

so you can enable cert verification.

DGathagu commented 7 years ago

@akmet pinging my server works fine and my dns seems to be functional

DGathagu commented 7 years ago

@kousu My setup was working on the first installation but later everything just stopped.I havent installed anything else to my vps since i installed rainloop. Do you mind explaining how i chroot in the first place?i'm a newbie to ubuntu administration.:-)