Subdomains like mail.xxxx.xxx in any virtual server are webserved by default virtual server

1 post / 0 new
#1 Mon, 04/29/2013 - 08:37
sigma

Subdomains like mail.xxxx.xxx in any virtual server are webserved by default virtual server

hi!

I've been searching for help but did not find anything related to this matter, so I resourced into bothering you guys, that maybe can throw some light into it.

Virtualmin creates some subdomains by default whenever you add a new virtual server, namely:

admin.yourdomain.com m.yourdomain.com webmail.yourdomain.com
mail.yourdomain.com ftp.yourdomain.com etc.

Some of them,when invoked by a remote user through their browser seems to be catched and /or redirected to the correct port, like webmail and ftp.

Also, with some expertise and seach inside webmin / virtualmin interface, most of them you can deselect from the "new virtual server template" ... so they won't be automatically created at virtual server creation time.

But, for example, mail.yourdomain.com is created by default, you cannot choose to not be added to DNS at virtual server creation (or you may not want, since mx record links to such A record).

Now for the real problem:

mail.yourdomain.com (or m.yourdomain.com or admin.yourdomain.com etc) since they are defined in DNS, your DNS server will respond "yeah it's in here", but since you maybe (like me) do not have a website for such extensions, instead of showing a blank page, or an error (like in windows 2003 server, in these cases you get the "Bad Request (Invalid Hostname)" error), virtualmin (or apache inside virtualmin, sorry for my ignorance) defaults into the DEFAULT VIRTUAL SERVER for such ip.

This is bad. Very bad! for a start, google engine now scans, checks for malware, and indexes your m.yourdomain.com or mail.yourdomain.com or ftp.yourdomain.com ...

If you did not place on those subdomains suitable content, (or eventually configure each subdomain into the domain by creating an alias of it) then you may end up with your actual wordpress blog being indexed for your domain, but a completely different website indexed into your m.yourdomain.com subdomain.

WHAT IS WORSE: as just happened to me, by chance, my default virtual server for an IP was an old joomla 1.5.26 based website (lets it be called infecteddomain.com) , which in the last 24 hours got infected with malware.

There goes google, finds the virtualmin automatically created mail.mydomain.com and m.mydomain.com but sees and analyzes and indexes the OTHER (default) virtualserver (remember, the infecteddomain.com).

What a "nice" way to have your websites gone to hell.

I am in search of a way to tell apache or virtualmin: "if a subdomain served by my dns is not explicitely defined as served by a virtual server, then do not serve the website located as default virtual server for this IP".

Any way of doing it ? Thanks in advance and sorry for the lengthy text :)