FTP Security
Although not used by everybody, FTP is still a common method of providing an alternative way of downloading material from a Web site. Among the obvious benefits of FTP is its easy directory/file listing abilities and the easy method with which clients can upload files and information if they need to.
WebDAV has replaced FTP for most file sharing/uploading requirements, especially for updating and managing Web site information.
An alternative, and sometimes more common, use for FTP was for the so-called 'dropbox' used to communicate between clients. The idea of the dropbox is to provide an outgoing directory from internal users to supply files to a client, and incoming users to have an incoming box into which they could drop files. From the client's perspective, the outgoing box could be read and viewed, but not written to, whereas the incoming box could be written to, but the contents not viewed.
With previous versions of IIS, however, FTP was less than ideal for both Web site updating and dropbox needs. All FTP users were placed into the same global directory when they logged in, making it possible for clients to view or at least identify the Web sites and directories of other clients.
IIS 6, on the other hand, includes the capability to isolate users from each otherwhen an authorized user logs in, he can be placed in his own directory that is separate and secure from other users and the anonymous user directory. Three modes are availableNon-isolated mode, Isolated Mode, and Isolated Mode using Active Directory.
You cannot switch between the different modes at will; instead, you must select the corresponding mode according to your requirements when you create a new FTP site. If you want to change the mode of an existing FTP site, you will need to re-create it.
FTP over SSL
FTP can be made more secure by running over Secure Sockets Layer (SSL), but unfortunately IIS doesn't include an SSL variation. If you're interested in using FTP over SSL, you will need to look elsewhere for a solution.
Setting FTP Isolation Modes
You configure the Isolation mode for an FTP site when you are creating the site through the FTP Site Creation Wizard. To create a new FTP site and select the FTP User Isolation mode, follow these steps:
In IIS Manager, expand the local computer (or a remote one).
Select the FTP Sites folder; then right-click, choose New and then FTP Site.
Give the new site a identifying description. Click Next.
Choose an IP address and port number. Click Next.
Choose the FTP user Isolation mode. Click Next.
If you are creating a non-isolated or isolated FTP site, enter or use Browse to select the location of your FTP root directory. Click Next.
If you are creating an FTP site using the isolated using Active Directory mode, enter the username and password to be used to gain access to the specified active directory domain. Click Next.
Select the permissions (read and/or write) for the FTP site. Click Next.
Installing FTP Services
The FTP service is not installed by default when you install IIS using the Configure Your Server Wizard. To add FTP (and other) services to your IIS installation, you will need to use the Add/Remove Programs tool (in Control Panels). Switch to the Add/Remove Windows Components manager and drill down through the Application Server and IIS details until you can select the FTP service. You will probably need the Windows Server 2003 CD to finish the installation.
Depending on which isolation mode you have chosen, there might be some additional steps. These are included in the following sections, along with information on the performance and security affects each mode has.
Non-Isolated Mode
In Non-isolated mode, IIS 6 works in the same fashion as IIS 4/5users connecting to the site, anonymous or authorized, are placed in the same home directory as configured for the FTP site.
Isolated Mode
In Isolated mode, you can continue to have both anonymous and authorized users. However, anonymous and authorized users are placed in different directories.
If you are supporting anonymous connections, configure the user who needs to be used when granting access rights (see Figure 3.11); then create a directory called LocalUser within the configured FTP root directory for this site and create another directory within LocalUser called Public. Anonymous users will be placed into this directory when they log in.
Figure 3.11 Granting access rights for FTP users.For each authorized user, create a corresponding directory within the LocalUser directory. For example, the user MBrown would have a directory called LocalUser\MBrown. If your users will also specify their domain during log in, create an intermediary domain directory in place of LocalUser. That is, Sales\MBrown would be located within Sales\MBrown.
The main issue with isolated mode is that the initial login can be quite slow because it has to check the name across the entire domain and then locate the corresponding directory within the tree. It also restricts user directories to a location within the main FTP root, which isn't always practical.
On the plus side, the administration is much easier if you are creating a system for hundreds of users because you don't need to manually edit each user's properties.
Isolated Mode Using Active Directory
The Active Directory method is probably the easiest and most straightforward to work with for a small numbers of users because it enables you to control the user directories through the user's properties. It can also be faster because it verifies the credentials against a specific part of the active directory.
If you choose this method of isolation, IIS makes use of two new properties that have been added to the Active Directory schema for a user object. The FTPRoot property relates to the Universal Naming Convention (UNC) of the file server share on which the directory is located and FTPDir is the subdirectory within that share for the user. The combination of the two will be used as the user's home directory when he logs in via FTP.
File Sharing and FTP
Because this mode uses the file sharing system to provide the user's home directory, the server used for the system must have file sharing enabled.
As with the standard isolated mode, anonymous users are supported and the root directory set within the properties for the FTP site used as the directory for these users. However, the username applied to anonymous connections should be a user within the Active Directory domain rather than a local user.
Setting PASV Port Ranges
Passive FTP mode uses a different port number for sending files back to the client than the default FTP port of 21, which is used to send commands and responses.
You can't configure IIS to switch off passive FTP port support, but in IIS 6 you can configure the port range used, which makes it easier to select a port range and configure your firewall service to pass through the passive FTP traffic.
There is no front end for the configuration, but it can be set by directly modifying the XML metabase for IIS. The PassivePortRange property within the /LM/MSFTPSVC path should be used to specify the range of ports for PASV support.
For more information on editing the IIS Metabase, see the next chapter.