VQADMIN:

Vqadmin is a system wide admin interface. Allows for addition and deletion of domains. Supports multiple admins accessing user accounts and domains.

QMR package provides vqadmin-2.3.6.tar.gz . The homepage of vqadmin http://www.inter7.com/vqadmin/ provides us vqadmin-2.3.7.tar.gz . Lets use that.

cd /downloads/qmailnew/

wget http://www.inter7.com/vqadmin/vqadmin-2.3.7.tar.gz

tar xzf vqadmin-2.3.7.tar.gz

cd /downloads/qmailnew/vqadmin-2.3.7

📝Note: The placement of the vqadmin directories below, follows QMR instructions. This is not the optimal method. In my next howto, I will use a different method. In future I intend to use seperate subdomains for vqadmin, qmailadmin, etc, under example.com, and each one will have it’s own home directory. I still don’t know, how successful I will be, or what will be the limitations. Till then, I will use the following method, adopted from QMR.

📝Note: Since the “–enable-htmldir” switch has been removed from vqadmin in latest release, the following two commands as suggested by QMR are useless. The html part of vqamin will get installed in /var/www/html by default. Explanation is further below.

mkdir /var/www/vqadmin # don’t use

chown apache:apache /var/www/vqadmin -R # don’t use

Note that –enable-html directory in the command is deprecated in newer versions of vqadmin (even in the one I am using, right now). This means it is not required to be mentioned to the ./configure script, as it has no effect.

đź“ťNote: Issue the following (libtools command) ONLY on 64 bit systems (64-bit version of Linux)

[root@www vqadmin-2.3.7]# libtoolize --force

Remember to add `AC_PROG_LIBTOOL’ to `configure.in’.

Using `AC_PROG_RANLIB’ is rendered obsolete by `AC_PROG_LIBTOOL’

You should update your `aclocal.m4’ by running aclocal.

A little help on the ./configure switches:

--enable-qmaildir=dir directory where qmail is installed.

--enable-vpopuser=vpopmail user vchkpw was installed as.

--enable-vpopgroup=vchkpw group vchkpw was installed as.

--enable-cgibindir={dir} HTTP server’s cgi-bin directory.

đź“ťNote: According to the INSTALL file:

  • vQadmin comes with full HTML templates. This means that the CGI does not generate any HTML at all, and thatthe templates are responsible for providing the correct information to the CGI.

  • vQadmin will require it’s own CGI-allowed, access-protected, directory to operate. First, you will need tocreate a < Directory > tag inside your Apache configuration, which sets the directory to have ExecCGIpermissions, allows the directory to override authority, and sets the directory to deny everyone by default.vQadmin will not function without this setup.

< Directory “/usr/local/apache/cgi-bin/vqadmin” >

deny from all

Options ExecCGI

AllowOverride AuthConfig

Order deny,allow

< /Directory >

After you’ve created the directory, you will need to create an .htaccess for the directory so Apache knows how to authenticate users trying to access the directory.

Before we do the actual configuration, lets discuss a little on the cgibindir and htmldir. If you open the configure script in an editor, you will see a line such as:

ac_subst_vars=’……. CPP EGREP vpopuser vpopgroup vpopmaildir vpopmailuid vpopmailgid lib_deps inc_deps wwwroot cgibindir LIBOBJS LTLIBOBJS’

This shows that there is a wwwroot variable being used! At another location in the file, you will see code as :

cgibindir=””

wwwroot=””

for f in /home/httpd /usr/local/apache /usr/local/www /var/lib/httpd /var/www /usr/local/www /var/www

do

if test -d $f/html

then

wwwroot=$f/html

fi


if test -d $f/cgi-bin

then

cgibindir=$f/cgi-bin

fi

done

…
…

  • This indicates that “/html” will be appended to the value of variable wwwroot . And the values of variable wwwroot is being searched from a hardcoded list of possible values / paths. This is bad. A search for htmldir , or enable-htmldir, or enable-wwwroot was done in the configure script and nothing was found. This means that it is hard coded.

  • For any of the shared hosting installations, you are not using /var/www/html anyway. So you can safely let the vqadmin installer install it’s HTML components in the default (hard-coded: /var/www/html) directory. However, if you are using this directory for some other purpose, then one of the solutions which come to my mind is to *hack the configure script and put in your desired wwwroot path manually. Say, if I want to have my wwwroot directory as /var/www/vqadmin/html, and my cgibin directory as /var/www/vqadmin/cgi-bin, then I would transform the piece of code shown above as:

cgibindir=""

wwwroot=""

for f in /var/www /usr/local/www /var/www/vqadmin

do

if test -d $f/html

then

wwwroot=$f/html

fi


if test -d $f/cgi-bin

then

cgibindir=$f/cgi-bin

fi

done

…

…

  • đź“ťNote 1: The last match in the loop, which satisfies the “if test -d” requirement, will be setup as wwwroot/html and cgibin/cgi-bin. That is why, I have put /var/www/vqadmin in the last of the loop options in the code above.

  • đź“ťNote 2: Also, the directories /var/www/vqadmin/html and /var/www/vqadmin/cgi-bin MUST exist before you actually run the ./configure script. (Create them manually if you want to do vqadmin this way). Notice that “/var/www” also satisfies this requirement by default. Recall, that /var/www has both “html” and “cgi-bin” directories existing in it. That is why you always get your vqadmin installed under that location by default.

Unless you want to move away from the standard location of (/var/www/cgi-bin), as your cgibin, there is no need to provide the “–enable-cgibindir” directive. It becomes optional in such situation, and a simple ./configure would do.

[root@www vqadmin-2.3.7]# ./configure --enable-cgibindir=/var/www/cgi-bin

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

/downloads/qmailnew/vqadmin-2.3.7/missing: Unknown `--run' option

Try `/downloads/qmailnew/vqadmin-2.3.7/missing --help' for more information

configure: WARNING: `missing' script is too old or missing

…

…

configure: creating ./config.status

config.status: creating Makefile

config.status: creating config.h

config.status: executing depfiles commands

Current settings

vpopmail directory = /home/vpopmail

uid = 708

gid = 702

cgi-bin dir = /var/www/cgi-bin

vqadmin dir = /var/www/cgi-bin/vqadmin

[root@www vqadmin-2.3.7]#

Time to compile and install it:

[root@www vqadmin-2.3.7]# make && make install-strip


...    

...    

chown nobody /var/www/cgi-bin/vqadmin/.htaccess

chmod u+rw /var/www/cgi-bin/vqadmin/.htaccess

chmod go+r /var/www/cgi-bin/vqadmin/.htaccess

make[3]: Leaving directory `/downloads/qmailnew/vqadmin-2.3.7'

make[2]: Leaving directory `/downloads/qmailnew/vqadmin-2.3.7'

make[1]: Leaving directory `/downloads/qmailnew/vqadmin-2.3.7'

[root@www vqadmin-2.3.7]#

Setup a .conf file in /etc/httpd/conf.d/ as vqadmin.conf

cat > /etc/httpd/conf.d/vqadmin.conf << EOF


Alias /vqadmin /var/www/vqadmin

<Directory /var/www/vqadmin>

Order deny,allow

Allow from all

</Directory>


<Directory "/var/www/cgi-bin/vqadmin">

Allow from all

Options ExecCGI

AllowOverride AuthConfig

Order deny,allow

</Directory>

EOF

Restrict access to your VQADMIN installation:

cat > /var/www/cgi-bin/vqadmin/.htaccess << EOF

AuthType Basic

\# AuthUserFile will also be at a common place, such as /var/www/.htpasswd.vqadmin

AuthUserFile /var/www/.htpasswd.vqadmin

AuthName vQadmin

require valid-user

EOF


chown apache:apache /var/www/cgi-bin/vqadmin/.htaccess

chmod 640 /var/www/cgi-bin/vqadmin/.htaccess # The QMR guide suggests 644 , which is too lax.

htpasswd -bc /var/www/.htpasswd.vqadmin admin redhat

chown yourftpuser:apache /var/www/.htpasswd.vqadmin # This step is not in QMR, but is a must.

chmod 640 /var/www/.htpasswd.vqadmin

Restart Apache service :

service httpd restart

Open the following link in web browser:

http://www.example.com/cgi-bin/vqadmin/vqadmin.cgi

You should see a blue page with a (very simple) text menu. Try creating a domain in it. If successful, you are all done for Vqadmin.

Add a domain “example.com” in vqadmin .

postmaster password: redhat

Created Domain

Domain postmaster added

Alhumdulillah, vqadmin is now installed.

Vqadmin errors / Trouble-shooting :

linuxoldld’: machine `x86_64-unknown’ not recognized:

On 64 bit systems, you must run “ libtoolize –force”, before you go ahead with ./configure , otherwise you will get an error such as:

[root@www vqadmin-2.3.7]# ./configure   
--enable-cgibindir=/var/www/cgi-bin   
--enable-htmldir=/var/www/vqadmin  

. . .  

. . .  

checking for a BSD-compatible install... /usr/bin/install -c  

checking whether build environment is sane... yes  

/downloads/qmailnew/vqadmin-2.3.7/missing: Unknown `--run' option  

Try `/downloads/qmailnew/vqadmin-2.3.7/missing --help' for more information  

configure: WARNING: `missing' script is too old or missing   

checking for gawk... gawk  

checking whether make sets $(MAKE)... yes  

checking build system type... Invalid configuration `x86_64-unknown-linuxoldld': machine `x86_64-unknown' not recognized  

configure: error: /bin/sh ./config.sub x86_64-unknown-linuxoldld failed  

White screen with menu:

If you see a white page with Vqadmin menu on it, it means that vqadmin is unable to find its style sheet:

Apache error log:-

[Thu May 08 16:51:18 2008] [error] [client 203.82.59.56] File does not exist: /var/www/vhosts/somedomain.com/httpdocs/images,

referer: http://10.2.3.4/cgi-bin/vqadmin/vqadmin.cgi

In such a case, you may want to do this:-

ln -s /var/www/html/images /var/www/vhosts/somedomain.com/httpdocs/

chown apache:apache /var/www/html -R

Why did this happen?

Well, if you access your vqadmin through any of your virtually hosted domins, using a url, such as:http://www.somedomain.com/cgi-bin/vqadmin/vqadmin.cgi , this will happen. As vqadmin will not be able to find it’s style sheets in the somedomain.com/httpdocs/images directory.

If you use your base website name, hosted in /var/www/html , this will not happen. That is why the linking of images file from /var/www/html/images directory to /var/www/vhosts/somedomain.com/httpdocs/ made it work. This is a silly solution. Because it will work until there are no conflicts of the images folder with your websites’s own images folder. And you can’t copy the vqadmin style sheets to each virtualhost’s images directory just like that. Basically there is no need to give control of vqadmin to your virtual domain owners, and no need to copy / link the images into vhosts’ docroots in the first place . This tool is for mail-server’s super owner who will create domains for the other virtual domain owners. So there is no need to run vqadmin’s cgi from any other domain, such as someotherdomain. It just needs to be accessed from http://example.com/cgi-bin/vqadmin/vqadmin.cgi. That’s all.