Tag Archives: IPv6

iRedMail on Nginx

This is my experiment to get iRedMail to work with Nginx. In the end I got everything to work other than awstats, although with some caveats. I don’t like awstats very much and it seemed quite troublesome to get it setup. There is a mode to run awstats in that lets it just generate static files, which to me seem to be a better solution. I did testing only on Debian 6.0.7, although it should also work in Ubuntu just fine. It was also limited testing on brand new VMs.

So I am starting out with a brand new Debian 6.0.7 system. First things first we setup our hosts and hostname file. For my test environment I used mail.debian.test as my test environment. Then I grabbed the latest iRedMail which happened to be 0.8.3 at the time of writing this. I did this via wget in a ssh session. I had to install bzip2 to “tar -xf” it, so a quick “apt-get install bzip2” resolved that. I then ran the iRedMail installer and let it complete.

Now to stop apache services for good:

Optionally we can run “apt-get remove apache2” to get rid of apache binaries as well.

Now, I needed Nginx and php5-fpm (as I prefer fpm). This takes a little work as Debian 6.0.7 doesn’t have it in its default sources. This would have been easier on Ubuntu.

What I did her is first install nginx and curl. Then I added dotdeb to the sources list, added its key and then updated my sources. Finally I was able to install fpm.
Now that the applications are in place, I need to write their configuration files. Here is the list of files I will be using:
Nginx’s iRedMail site configuration file
php5’s FPM iRedMail web pool file
iRedMail init.d file to launch the iredadmin pyton webservice

During additional testing I uploaded the files and just used curl to put them into place. The init.d script is borrowed from the web (exactly where I can’t remember as I used bites and pieces from multiple places). However I don’t feel the need to write out or explain in great detail all off the changes.

You will need to modify the nginx file (/etc/nginx/sites-available/iRedMail) to contain the correct domain. As well you will need an additional dns enter for iredadmin.domain.tld (in my case iredadmin.debian.test). If this is your only/first ssl site or you prefer it to be default you will need to adjust the ssl section. I added comments to explain that. Nginx expects a default website and if none exist it won’t start.

As for the additional domain, I tried my best, but it seems there is no way to have the perl script to be aware its in a sub directory and pass the correct urls to its output templates. Although the template has the capability to do a homepath variable, this seems to be set from ctx in perl which from my limited knowledge I don’t believe is changeable via environment/server variables. I also didn’t see a way to change that in any setting. Hopefully the iRedMail developers can make this change in future versions.
The good news is the iRedMail developers had foresight to setup the script to run very smoothly as a stanalone python web server via a cgi socket. So no additional work to make that run is needed. I had hoped to use the iredapd service to launch this, but it appears to crash and fail horribly. So I setup a second instance to do this.

Now just a little more work to activate the new service, link the file as a live nginx site and restart some services.

Thats it. Now when I hit mail.debian.test I get the webmail portal. When I access iredadmin.debian.test I get the admin portal. phpmyadmin is also setup on mail.debian.test/phpmyadmin

Setting this up for Ubuntu should be easier, as 12.04 has php5-fpm in its packages so there is no need to add in the dotdeb resources. Everything else would be the same for it.

Nginx has always been flaky for me while doing Ipv6 services. I intended to include them but it just wasn’t playing nicely enough. Sometimes just doing [::]:80 to a listen will make it listen. Other times I have to specify it twice (and it doesn’t complain). Then again if I try it on 443 using [::]:443 nginx may not want to start at all, while it accepted [::]:80 just fine. So because of how picky it can be at times, I just opted to go with ipv4 only support here.

Read More

Airport Extreme ignoring ICMP requests

After setting up my ISPs Modem/router combo unit to not run the router and act only as a bridge. I came across an issue where I couldn’t update my IPv6 settings with my new IP address because my router was not responding to ICMP requests.

Well, it turns out that I had enabled a default host, or as the rest of the world knows it, a DMZ. The machine I put into the DMZ was my windows machine and its firewall was prohibiting ICMP request.

Simple solution here is to just remove the machine and let the router respond to the ICMP request.

I also should note that you can also disable ICMP requests by setting the DMZ to a unused IP on your network. The request will silently fail as long as that IP is not in use on the network. Probably the easiest way to do this is to tell the router to only assign a range of IPs such as from 100 to 200 for its DHCP. All your normal systems will get a DHCP address in that range while systems you statically configure can obtain ones outside of that range and you can be sure that no normal system would get a DHCP address.

Read More

Nginx with IPv6 and vhosts

Linode.com has recently setup IPv6 natively and is deploying it across their data-centers.  This is great as I now have a native IPv6 address for my VPS.

I use Nginx as a replacement for Apache and I noticed today that my vhosts where not correctly responding on the IPv6 address.  Since I use a wildcard for my subdomains, it still would respond with my main domain, but it wouldn’t recongize any additional or subdomain.  From the configuration documentation it makes it sound like I only need to add “listen [::]:80;” to my vhosts in order to get this to work.  However despite my tries I received an error:

[emerg]: bind() to [::]:80 failed (98: Address already in use)

All documentation supports the suggested command and some suggest running the sockets separately (by adding ip6only=on to that listen).  However this still failed to make it work.

So, after going through all my configs, test configs (for test subdomains I have) and disabling any listen directives (which broke a few things), I still couldn’t get it to work.  In the end I am not quite sure how I got it to work.  I even checked with “lsof -i :80” to see anything that might of been running and couldn’t find anything.

But what I did to finally get this to work right was add this to my default config (ie for my main domain):

listen 80 default;
listen [::]:80 default ipv6only=on;

Then for each other vhost I added:

listen [::]:80;

This seems to make things work without any problem.  No errors whatsoever and ipv6 responds as it should.

As a final note, I should mention my ISP does not natively support IPv6 yet.  I am using a tunnel broker via HE.

Read More

Highslide for Wordpress Plugin