Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Server Design Week 11 Old Dominion University

Similar presentations


Presentation on theme: "Web Server Design Week 11 Old Dominion University"— Presentation transcript:

1 Web Server Design Week 11 Old Dominion University
Department of Computer Science CS 495/595 Spring 2007 Michael L. Nelson 3/19/07

2 Authentication: Basic & Digest
Defined in RFC-2617 Basic very simple sends password in the clear (very bad) suitable for personalization; not real security Digest uses cryptographic hashes; password not sent in the clear stronger than Basic, but client support not as prevalent does not encrypt content… SSL, SHTTP or equivalent needed for that

3 Authentication Structure
Both methods are structurally similar: when the server receives a request for a protected resource, it responds with: status code “401 Unauthorized” “WWW-Authenticate:” response header the client reissues the same request with the addition of: “Authorization:” request header

4 Basic “WWW-Authenticate:” response header:
WWW-Authenticate: Basic realm=”ODU-CS-595-S06" auth type opaque string to differentiate auth files “Authorization:” request header: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== auth type Base64(username:password)

5 Scenario client server scenario 2: the client could have sent the
GET foo HTTP/1.1 client server 401 Unauthorized WWW-Authenticate: Basic realm=“xyz” GET foo HTTP/1.1 Authorization: Basic mln:gohokies! 200 OK scenario 2: the client could have sent the Authorization string with the initial request mln:gohokies! would be base64’d

6 How Apache Does It… (Note: we’re not going to do it this way!)
In either <Directory> entries in the config file, or “.htaccess” files in directories: AuthType Basic AuthName "Restricted Files" AuthUserFile /usr/local/apache/passwd/passwords Require user rbowen Many more options possible:

7 Authentication Example
tango.cs.odu.edu:/home/mln/public_html/teaching/cs595-s07/restrict % ls -al total 5 drwxr-xr-x 2 mln faculty Mar 18 15:26 ./ drwxr-xr-x 11 mln faculty Mar 18 15:02 ../ -rwxr-xr-x 1 mln faculty Mar 18 15:27 encode.pl* -rw-r--r mln faculty Mar 18 15:17 foo.txt -rw-r--r mln faculty Mar 18 15:03 .htaccess tango.cs.odu.edu:/home/mln/public_html/teaching/cs595-s07/restrict % more .htaccess AuthType Basic AuthName "This is What the RFC Calls a Domain" AuthUserFile /home/mln/passwd Require user mln tango.cs.odu.edu:/home/mln/public_html/teaching/cs595-s07/restrict % more encode.pl #!/usr/bin/perl use MIME::Base64; $string = encode_base64("mln:mln"); print "$string\n"; tango.cs.odu.edu:/home/mln/public_html/teaching/cs595-s07/restrict % ./encode.pl bWxuOm1sbg==

8 Request #1 AIHT.local:/Users/mln % telnet www.cs.odu.edu 80
Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s07/restrict/ HTTP/1.1 Host: HTTP/ Authorization Required Date: Sun, 18 Mar :00:30 GMT Server: Apache/2.2.0 WWW-Authenticate: Basic realm="This is What the RFC Calls a Domain" Content-Type: text/html; charset=iso Connection closed by foreign host.

9 Request #2 AIHT.local:/Users/mln % telnet www.cs.odu.edu 80
Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s07/restrict/ HTTP/1.1 Host: Authorization: Basic bWxuOm1sbg== HTTP/ OK Date: Sun, 18 Mar :05:01 GMT Server: Apache/2.2.0 Content-Type: text/html Connection closed by foreign host.

10 Why Not a “403 Forbidden” ? 10.4.4 403 Forbidden
The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.


Download ppt "Web Server Design Week 11 Old Dominion University"

Similar presentations


Ads by Google