To apply protection to files there are a minimum of 2 things that must be done. The number of things to do can increase, but you cannot get away with less than:
In the SY:HTTPD.CON file, before the Pass rules,
add the following lines:
Protect /* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
We've just told the web server three things:
name:passwordThere are actually other fields that can be on the line, and the ':' is used as a separator, but we're taking the minimalist approach so we won't worry about them. The alert reader will note that since we store passwords in clear text that a password cannot contain a colon.
The password field in this file must be padded with upper case 'X' to a length of 13 characters. These final 'X''s are not part of the password proper but they must be in the file. Thus, in the entry for our friend Mr. Mott, whose password is "blackberry", we have one single line in the file:
mott:blackberryXXXWe just strung 'X''s out until we hit 13 characters for the password. The alert reader will wonder if 'X' can be part of the password, and the answer is yes. "ZXC123" is a valid passord, as is "XX123". If the last letter of the password is 'X' it will not be seen as part of the password, so that "ABCX" is equivalent to "ABC". For the curious, a valid password is 'XXXXX', which will end up in the file as
mott:XXXXXXXXXXXXXUnfortunately that also matches any number of 'X's strung together, so the sage advise on this matter is: Dont do that.
Now that we've set everything up this is a snap. Here is our protect rule from the first example.
Protect /* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
To protect the files in a directory we simply change the directory specification on the protect rule. Lets say that we want to protect the files in the \mott directory. To do this we change our protect rule to the following:
Protect /mott/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
Now when the client attempts to access files in /mott
they will be prompted for a username and password, but an
attempt to access any other directory will be allowed.
Before going further, we need to discuss the order that
translation of filespecs occurs in.
You're familiar with how a file specification can be passed through the pass/fail rules to allow mapping of a specification to an actual filename. The specification from the browser is the input, and the actual filename on disk is the output. The Protect rule evaluates the file specification as it is received from the browser.
To illustrate this, imagine that you have the following protect and pass rules:
Protect /private/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
pass /test /__c__/private/secret.htm
Then, imagine that the client requests the url http://domainname/test.
It is tempting to imagine that the pass rule will be processed first and the protect rule second, so that the protect rule is applied to the final, real filename. That way, all paths to the same disk file would end up going through the same Protect rule.
In actual operation the Protect rule is evaluated first, and in this sample it discovers that the directory that the user requested, /test, is not protected. Thus, the request will be translated and the file will be referenced.
The TSX-32 server implemented a new directive called ipmap . This directive allows you to map requests for all pages associated with a specific IP address to be mapped to a specific directory. In this way separate trees can be maintained for separate domain names.
The Protect rule is evaluated before the pass rules, as mentioned. However, it is also evaluated after the ipmap directive.
To illustrate, lets say you had the following directives:
Ipmap 123.123.123.123 /mydomain
Protect /mydomain* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
pass /mydomain/ /__c__/mydomain/*
Lets say the user connects to this site with the URL
http://123.123.123.123/. The following 3 things would occur.
Protect /mott/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
Protect /dan/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
This pair of directives will allow the user mott to access
the /mott and the /dan directories, after logging
in with a username and password.
mott:blackberryXXX dan:beachbumXXXXXTo allow additional users to access different directories we have two Protect directives, one for each directory each specifying a different user.
Protect /mott/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott
}
Protect /dan/* {
PassWdfile /__c__/pwfile.dat
GET-Mask dan
}
This will allow mott to access files in the /mott
directory and the user dan to access files in the /dan
directory.
In this example we'll allow the user mott and the user dan to access the /tpl directory.
Protect /tpl/* {
PassWdfile /__c__/pwfile.dat
GET-Mask mott,dan
}
In this example we'll allow anyone with an entry in the password file to access the /samples directory.
Protect /samples/* {
PassWdfile /__c__/pwfile.dat
Get-Mask All
}
Back to main
Next tutorial