As mentioned above, setting up services (ie. POP/SMTP, FTP) for certain virtual servers is very flexible. You can specify whether vserver2.com should have FTP service, or if vserver1.com should have email. I am going to cover the basics of how to set up virtuald through the common services.
Basically for each service in your inetd
configuration file, you want to add:
/path/to/virtuald virtuald /virtual/conf.file
But, if you are using tcp_virtuald, you will want to use:
/path/to/tcp_virtuald virtuald /virtual/conf.file tcpd
For xinetd
, please read the section below. It will still be helpful not to
skip this section...
The configuration files needed for each service should contain the IP address and the directory where the virtual service resides. For example, xxx.xxx.xxx.xxx:/virtual/vserver2.com
. (where xxx.xxx.xxx.xxx is the IP number)
Each of these on a new line, but do not alter these files, as Virtfs will do this for you.
The configuration file for say, FTP, is by default (in the /etc/virt.conf
file) conf.ftp
and this must reside in the leading virtual sub directory, ie. /virtual/conf.ftp
. For mail services, it is /virtual/conf.pop
.
There should only be ONE configuration file for each service, and not multiple. Virtfs will add entries for each server into the configuration file when you select to add it, so you need not edit it directly (and you probably shouldn't). When you delete a virtual server, Virtfs removes the entry for the chosen server.
You must specify the full path to each service in /etc/inetd.conf. For example:
ftp stream tcp nowait root /path/to/virtuald virtuald /virtual/conf.ftp wu.ftpd -l -a
On my system, wu.ftpd is in the /usr/sbin
directory on the main server as well as the virtual server (/virtual/vserver1.com/usr/sbin
).
Make sure you follow the general rules to avoid problems:
/usr/sbin
make sure it's on the same location in the virtual directory, ie. /virtual/vserver1.com/usr/sbin
.inetd.conf
, it is fine just to leave wu.ftpd
(the service), but when using it with virtuald you should note the full path name to the service.
In your /etc/inetd.conf
file, you will have to edit this to place the virtuald wrapper to accept connections for the FTP service. I changed mine to the following, where /virtual/conf.ftp
is the configuration file for servers allowed to FTP in:
ftp stream tcp nowait root /path/to/virtuald virtuald /virtual/conf.ftp /path/to/wu.ftpd -l -a
If you are using tcp_virtuald, you will have to specify the above line as such:
ftp stream tcp nowait root /path/to/tcp_virtuald virtuald /virtual/conf.ftp tcpd /path/to/wu.ftpd -l -a
There are two common mail packages: Sendmail and Qmail. The setup for virtual servers is different, depending on what package you use. Your IMAP/POP services should be easily configured though. Virtfs takes care of the mail configuration file (by default: conf.pop
). You will just have to alter the lines in inetd.conf
to:
pop-3 stream tcp nowait root /path/to/virtuald virtuald /virtual/conf.pop /path/to/ipop3d
You can configure mail services for tcp_virtuald as it has been done above for FTP.
Unlike using Sendmail's virtual email support, you can have multiple accounts with
same names, on main server. As explained above, bob@vserver1.com
and
bob@mainserver.com
are actually different accounts. This is a great
advantage.
As far as setting up a virtual server for email though, Virtfs copies over the main
server's /etc/sendmail.cf
file (which you must set in virt.conf under
Sendmail CF
) to the virtual server's /etc
directory and edits the line:
#Dj$w.Foo.COM
to:
Djvserver1.com
(replacing vserver1.com with your server's real entry).
We set up Sendmail within inetd
as follows:
smtp stream tcp nowait root /path/to/virtuald virtuald /virtual/conf.pop /path/to/sendmail -bs
You can configure mail services for tcp_virtuald as it has been done above for FTP.
Please note that Virtfs will automatically add/delete entries from the conf.pop configuration file. This file permits the servers listed to accept connections from the ports.
Upon creation of a virtual server, Virtfs will automatically create the sendmail.cf
(as of v.0.60.0) in /virtual/vserver2.com/etc/sendmail.cw
.
Virtfs will add these lines into the sendmail.cw file (replacing vserver2.com with your virtual server's name):
mail.vserver2.com
vserver2.com
vserver2
localhost
You will need to replace your current sendmail.init file with the sendmail.init
shell script included with the Virtfs package. This script shell will start, stop and restart Sendmail services for all your virtual servers and main servers.
Unfortunately, I am unable to test Virtfs with Qmail, however, there is a little package which will help you. You may read on it and download it from the Virtfs Qmail page. This additional package does not come with the standard Virtfs package. Reading the Virtual Services HOWTO will also help you in this (the sources from the Qmail page were taken from the HOWTO).
Apache has an excellant method of configuring VirtualHosts, and I suggest you use that method. Setting up Apache is regardless of virtuald, although Virtfs will edit the httpd.conf
adding the appropriate configuration. Refer to Apache's documentation on how to set this up for a virtual service.
You may want to create a web directory, ie /virtual/vserver1.com/web
so that people with access to vserver1.com can access these files - do not place the web directory on the main server, as the users of vserver1.com will not be able to access them.
You can acheive similar results with configuring your inetd
file, as I have done above. In the chance you are using a service (like some FTP clients) that do not run through inetd
, you will unfortunately have to go under their direction for virtual services.
If it does run through inetd, simply do the following:
inetd.conf
/virtual/conf.service
file.