Virtualmin Virtual Servers (GPL)

Following my last post I now found out that Webmin does not allow multi virtual servers :-(, BUT there is a module called Virtualmin Virtual Servers (GPL) which is what I need.

To save myself hassle, I installed a compatible OS (CentOS 6 64bit) and simply installed virtualmin from the install.sh command after downloading it:

cd /root
wget http://software.virtualmin.com/gpl/scripts/install.sh
sh ./install.sh

After this my next  move was to install csf lfd from configserver.com:
(there is now a new URI for the archive which I changed on 2017-02-08)

wget http://www.configserver.com/free/csf.tgz
wget https://download.configserver.com/csf.tgz
tar zxvf csf.tgz
cd csf
sh ./install.sh

Once installed integrate it in Webmin and you’re good to go.

– Install the csf webmin module in:
Webmin > Webmin Configuration > Webmin Modules > From local file > /etc/csf/csfwebmin.tgz > Install Module

Email access problems

All worked well from the word go except SMTP/POP3 (Dovecot) server; I was getting Failed to connect to localhost:143 : Connection refused  (as well as port 993,995,110 and 25) when trying to connect either via my email client or usermin.

System Information was reporting that Dovecot IMAP / POP3 Server was offline, and trying to start Dovecot failed:

Starting dovecot: Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 110) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 995) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 143) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 993) failed: Address family not supported by protocol
Fatal: Failed to start listeners

After editing the /etc/dovecot/dovecot.conf file and commenting out/insert: listen = *  Here is how my edited file looks like:

# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
listen = *

Now, why would Dovecot server come with this line disabled is baffling, anyway, after this, Dovecot starts fine allowing usermin and email clients to connect without problems:

dovecot

 

Server heartbeat

This little perl program allows you to check the availability of an IP address via a cron command that outputs the result in a text file.

#!/usr/bin/perl
# This script pings IP addresses
#
# In a live application, read host list
# from a config file
@hosts = ("192.168.1.1","192.168.1.19");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
$mon = sprintf("%02d", $mon);
$mday = sprintf("%02d", $mday);
$year = sprintf("%02d", $year % 100);

@live = ();
foreach $h (@hosts) {
        $r = `ping -c2 $h`;
        if ($r =~ /2 re/) {
                push @live,$h;
                }
        }
$alive = "@live";
print ("You have $alive on $mday $mon $year @ $hour:$min:$sec\n");

This script can then be used in a cron like:

*/5 * * * * /path/to/file/pingtest.pl >> /some/path/pingtest.txt

This command will write the result on a new line in the file called pingtest.txt every 5 minutes. Which will look like that:

You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:05:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:10:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:15:01