Enabling web tools
In the two previous section, we 've installed 2 useful web tools (vqadmin and qmailadmin). We'll now enabling it ...
You first need to create appropriate name record in your DNS system (CNAME or A record). I advice you to create the alias mailadmin.yourdomain.tld pointing to your server IP. Whatever is your choice, this name should NOT BE THE SAME as your server hostname.
Then, create a virtual host corresponding to this new name record. Create the file /etc/apache2/sites-available/mailadmin.yourdomain.tld.conf as following :
ServerAdmin your_email_adress
DocumentRoot /var/www/mail
ServerName mailadmin.yourdomain.tld
ErrorLog /var/log/apache2/mailadmin.yourdomain.tld-error.log
CustomLog /var/log/apache2/mailadmin.yourdomain.tld-access.log common
<Directory /var/www/mail>
AllowOverride All
Options -Indexes
Require all granted
</Directory>
<Directory /var/www/mail/cgi-bin/>
Options +ExecCGI +FollowSymLinks
ForceType cgi-script
Require all granted
</Directory>
<Directory /var/www/mail/cgi-bin/vqadmin>
AddHandler cgi-script .cgi
ForceType Off
AllowOverride None
AuthType basic
AuthName "private"
AuthUserFile /var/www/mail/cgi-bin/vqadmin/.htpasswd
Require valid-user
</Directory>
<Directory /var/www/mail/images/qmailadmin/>
ForceType Off
Require all granted
</Directory>
</VirtualHost>
You can create this virtualhost file like this :
cd /etc/apache2/sites-available/
sed -i 's/mailadmin.yourdomain.tld/mailadmin.yourdomain.tld/' mailadmin.yourdomain.tld.conf
sed -i 's/your_email_adress/your_mail@domain.com/' mailadmin.yourdomain.tld.conf
sed -e '/ScriptAlias/ s/^#*/#/' -i /etc/apache2/conf-available/serve-cgi-bin.conf
a2enmod cgi
systemctl restart apache2
We finally can test our web interfaces ...
Point your browser on http://mailadmin.yourdomain.tld/cgi-bin/vqadmin/vqadmin.cgi to test vqadmin (login: admin and the password you had chosen in step 7)
Point your browser on http://mailadmin.yourdomain.tld/cgi-bin/qmailadmin to test qmailadmin
Users comments
There is another solution for wheezy debian v 7.11, for Enabling web tools?
/etc/apache2/conf-available/serve-cgi-bin.conf not available in wheezy debian ????
Hello,
Do you have an error message in the logs ? The CGI files are dowloaded instead of executed ?
Best Regards
Thibs
I am having a bit of an issue getting the vqadmin and qmailadmin not firing when called upon. Debian 8.2 64bit. I have followed the steps, typing very carefully twice and copy and pasted the commands once with the same result. All of the cgi paths in the config files etc. are correct. Any suggestions?
Bob
Hello,
You can indeed have 2 different names (the server name and a CNAME)
Hi,
Thanks for the wheezy post. One small question. Can I use hostname.orginialdomainname.tld on this apache host configuration. Later you have configure host.original domain.tld for SMTP configuration. If I give different name, then I have to create two alias on my cpanel. Please suggest whether I should put the same name for both apache site and during SMTP configuration.
Okay, false alarm.
Turns out I have a coworker who thought it would be funny to setup a redirect and remove it every time I logged in.
So, everything works great. Thanks
Hello, Do you confirm you have the same as this :
root@YOURSERVER:~# ls -lah /var/www/mail/cgi-bin/vqadmin/ total 172K drwxr-xr-x 3 vpopmail vchkpw 4.0K Feb 16 16:45 . drwxr-xr-x 3 root root 4.0K Feb 16 16:48 .. -rw-r--r-- 1 www-data www-data 116 Feb 16 16:44 .htaccess drwxr-xr-x 2 vpopmail vchkpw 4.0K Feb 16 16:43 html -rw-r--r-- 1 root root 44 Feb 16 16:45 .htpasswd -rw-r--r-- 1 vpopmail vchkpw 864 Feb 16 16:43 vqadmin.acl -rwsr-sr-x 1 root root 145K Feb 16 16:43 vqadmin.cgi
First, I've installed Qmailrocks on a number of servers and it works fine. This time has been different.
Okay, I've installed Qmailrocks on two different servers and twice on the same server with the same results when I am at this point to test the web tools.
On the first day, everything works fine. I can get to vqadmin.cgi and qmailadmin and I can add domains and accounts with no issues.
On the second day, I can't access these two pages again! Nothing was changed by me at all, all the files are still where they were. DNS is still the same. And even using the IP addres instead of the domain name, gets me an error.
Not Found
The requested URL /cgi-bin/vqadmin/vqadmin.cgi was not found on this server.
For those of you who don't have access to your companies (or your own) DNS system, you can add the IP address of your Qmail server to your client workstations "hosts" file.
For example I'm setting up a Debian test machine in VMware and don't have access to my companies DNS server. For this portion of the guide I set the FQDN as "mailadmin.acme.lan" with the ip 10.10.10.1(the address of my VM server) in my hosts file.
On Windows you can find this in your %SystemRoot%\Windows\System32\drivers\etc folder. On Linux systems /etc/hosts is where you'll find it.
Obiously this will only work for those in a testing environment, you'll eventually want to set it up proper.
Hope that helps!
~Allen
On ubuntu server need use
a2enmod cgi a2enmod perl
delete .htaccess and on virtual conf add
AuthType Basic AuthUserFile /var/www/mail/cgi-bin/vqadmin/.htpasswd AuthName vQadmin require valid-user Options +ExecCGI -Indexes order deny,allow
Gents,
I have been running a mail server based upon this tutorial for several years without any problems. Thanks for the effort.
However, when trying to implement a secure webserver I encounter problems. My I kindly request that the tutorial reflects also this important part. I would appreciate that the tutorial also cover this issue in the same excellent way that the rest of subjects.
Thanks in advance
stenhh
@Jurgen Your advice is good ... In my case I've made a certificate especially for that (https://mailadmin.thibs.com/cgi-bin/qmailadmin)
a feature for those who are interested, I added the following to the above vhost configuration to add SSL to everything using the mailadmin sub domain:
#a2enmod ssl
now edit the site vhost file:
<VirtualHost *:443>
....
+ SSLEngine On
+ SSLCertificateFile /var/qmail/control/clientcert.pem
+ SSLCertificateKeyFile /var/qmail/control/clientcert.pem
....
One year later..
Deploying next server.
Forgot about:
a2enmod ssl
Enabling module ssl.
Forgot about enabling SSL module:
a2enmod ssl
Good suggestion !
BTW, It's possible to have FREE official certificates through https://www.startssl.com/
Ok, now all is working fine.
I recommend use HTTPS instead of HTTP since there are clear passwords.
To enable HTTPS in Apache:
Generate certs:openssl genrsa -out /etc/apache2/ssl/apache.key 1024
openssl req -new -x509 -days 365 -key /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
and check it:openssl x509 -in /etc/apache2/ssl/apache.crt -noout -subject
Modify Apache website:
<VirtualHost *:443>
ServerName someweb.server.com
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<Directory /var/www/someweb/>
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
And it will work. I've disabled Qmail over 80, so only 443 is enabled.
It worked like a charm.
However, now I'm trying to add HTTPS support to every admin panel in Qmail.
There is /etc/apache2/sites-available/default-ssl file but seems it doesn't work (going to https://server_ip shows no page available, site is enabled anyway). No clear error in /var/log/apache2/error.log.. port is opened.. hmm still investigating issue
Invalid language file
cd /var/www/mail/cgi-bin/vqadmin/html
e.g.: cp de de-de
but be aware!
some browsers have set e.g. "de-DE" (the second "DE" is UPPERcase!)
so you have to cp de de-DE
You may get
Invalid language file
error if your browser uses a default language encoding other than the ones that are supported by vqadmin. The quick solution is to copy one of the language files with a new name.
Example:
assume your vqadmin is installed in /var/www/mail/cgi-bin/vqadmin/
than you can do
cd /var/www/mail/cgi-bin/vqadmin/html
cp en tr
that solved my problem with Turkish encoding.
Thanks for the greate site.
What is the default User Account , Domain Name and Password for qmailadmin ?? After this process ??
>In your instruction what FQDN do you use to access the webmail interface? mailadmin.yourdomain.tld/webmail
Refer to http://qmailrocks.thibs.com/roundcubemail.php for the webmail part
>Why do you suggest the hostname be different from the mailadmin.yourdomain.tld?
It's to avoid changing the default apache configuration. I just make the changes into a virtual host
Thanks.
In your instruction what FQDN do you use to access the webmail interface? mailadmin.yourdomain.tld/webmail
Why do you suggest the hostname be different from the mailadmin.yourdomain.tld?
If you are not able to add a new domain in vqadmin , try tail -n 20 /var/log/apache2/mailadmin.yourdomain.tld-error.log
If you see something like "Warning: Failed to delete dir_control for yourdomain.tld" then check your mysql connection settings in /home/vpopmail/etc/vpopmail.mysql
@Lorry :
If you are still using wheezy, try to add -wheezy on each page
For exemple the oldest version of this current page is
http://qmailrocks.thibs.com/webtools-wheezy.php