Web Server Design Week 10 Old Dominion University

Slides:



Advertisements
Similar presentations
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
Advertisements

CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2010 Martin Klein 8/31/10.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
Web Server Design Assignment #1: Basic Operations Due: 02/03/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
Web Server Design Week 11 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/24/10.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Web Server Design Assignment #2: Conditionals & Persistence Due: 02/24/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010.
Web Server Design Week 2 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/20/10.
Web Server Design Week 7 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/24/10.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
Web Server Design Assignment #4: Authentication Due: 04/14/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/17/10.
Web Server Design Week 12 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/31/10.
Web Server Design Week 10 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/17/10.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 02/07/12.
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2007 Michael L. Nelson 8/27/07.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/09/06.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
CS520 Web Programming Declarative Security (I) Chengyu Sun California State University, Los Angeles.
Web Server Design Week 3 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/23/06.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/13/06.
Lecture # 1 By: Aftab Alam Department Of Computer Science University Of Peshawar Internet Programming.
Authentication & .htaccess
Web Server Design Week 10 Old Dominion University
Web Server Design Week 4 Old Dominion University
Web Server Design Assignment #5: Unsafe Methods & CGI
Hypertext Transport Protocol
Web Server Design Assignment #4: Authentication
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 7 Old Dominion University
Web Server Design Assignment #5 Extra Credit
Web Server Design Week 4 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 15 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Week 13 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 2 Old Dominion University
Web Server Design Week 8 Old Dominion University
Web Server Design Week 8 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Old Dominion University Department of Computer Science
Web Server Design Week 6 Old Dominion University
Web Server Design Week 13 Old Dominion University
Web Server Design Week 13 Old Dominion University
Web Server Design Week 8 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 4 Old Dominion University
Web Server Design Week 16 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 14 Old Dominion University
Web Server Design Assignment #1: Basic Operations
Web Server Design Week 6 Old Dominion University
Web Server Design Assignment #5 Extra Credit
Web Server Design Week 3 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 7 Old Dominion University
Web Programming Week 1 Old Dominion University
Web Server Design Week 7 Old Dominion University
Presentation transcript:

Web Server Design Week 10 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson <mln@cs.odu.edu> 03/13/12

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 Extensible: other authentication mechanisms defined elsewhere e.g.: OAuth, RFC-5849

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

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)

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

How Apache Does It… (Note: our syntax will be different!) 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: http://httpd.apache.org/docs/current/howto/auth.html

Apache Example antares:/home/mln/public_html/teaching/cs595-s12/restrict % htpasswd -c ./passwd mln New password: Re-type new password: Adding password for user mln antares:/home/mln/public_html/teaching/cs595-s12/restrict % ls encode.pl* foo.txt passwd antares:/home/mln/public_html/teaching/cs595-s12/restrict % more passwd mln:Ggkaf46I4CTRI antares:/home/mln/public_html/teaching/cs595-s12/restrict % ls -al total 48 drwxr-xr-x 2 mln faculty 1024 2012-03-12 18:32 ./ drwxr-xr-x 14 mln faculty 1024 2012-01-30 10:48 ../ -rw-r--r-- 1 mln faculty 151 2012-03-12 18:32 .htaccess -rwxr-xr-x 1 mln faculty 94 2012-01-09 19:02 encode.pl* -rw-r--r-- 1 mln faculty 24 2012-01-09 19:02 foo.txt -rw-r--r-- 1 mln faculty 18 2012-03-12 18:32 passwd note: having your password file acccessible by the web server is generally not a good idea…

Apache Example (2) antares:/home/mln/public_html/teaching/cs595-s12/restrict % more .htaccess AuthType Basic AuthName "This is What the RFC Calls a Domain" AuthUserFile /home/mln/public_html/teaching/cs595-s12/restrict/passwd Require user mln antares:/home/mln/public_html/teaching/cs595-s12/restrict % more encode.pl #!/usr/bin/perl use MIME::Base64; $string = encode_base64("mln:mln"); print "$string\n"; antares:/home/mln/public_html/teaching/cs595-s12/restrict % ./encode.pl bWxuOm1sbg== antares:/home/mln/public_html/teaching/cs595-s12/restrict %

Original Request % telnet www.cs.odu.edu 80 Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s12/restrict/ HTTP/1.1 Host: www.cs.odu.edu HTTP/1.1 401 Authorization Required Date: Mon, 12 Mar 2012 22:40:55 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.5 mod_ssl/2.2.17 OpenSSL/0.9.8q WWW-Authenticate: Basic realm="This is What the RFC Calls a Domain" Content-Type: text/html; charset=iso-8859-1 Connection to xenon.cs.odu.edu closed by foreign host.

Second Request % telnet www.cs.odu.edu 80 Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s12/restrict/ HTTP/1.1 Host: www.cs.odu.edu Authorization: Basic bWxuOm1sbg== HTTP/1.1 200 OK Date: Mon, 12 Mar 2012 22:42:49 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.5 mod_ssl/2.2.17 OpenSSL/0.9.8q Content-Type: text/html;charset=ISO-8859-1 Connection to xenon.cs.odu.edu closed by foreign host.

Wrong user:pw == 401 % telnet www.cs.odu.edu 80 Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s12/restrict/ HTTP/1.1 Host: www.cs.odu.edu Authorization: Basic bWxuOm1alsdkfsldjslkdjfl== HTTP/1.1 401 Authorization Required Date: Mon, 12 Mar 2012 22:46:05 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.5 mod_ssl/2.2.17 OpenSSL/0.9.8q WWW-Authenticate: Basic realm="This is What the RFC Calls a Domain" Content-Type: text/html; charset=iso-8859-1 Connection to xenon.cs.odu.edu closed by foreign host.

401 Trumps 404 et al. why? % telnet www.cs.odu.edu 80 Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s12/restrict/THISDIRDOESNOTEXIST/ HTTP/1.1 Host: www.cs.odu.edu Authorization: Basic bWxuOm1alsdkfsldjslkdjfl== HTTP/1.1 401 Authorization Required Date: Mon, 12 Mar 2012 22:53:51 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.5 mod_ssl/2.2.17 OpenSSL/0.9.8q WWW-Authenticate: Basic realm="This is What the RFC Calls a Domain" Content-Type: text/html; charset=iso-8859-1 Connection to xenon.cs.odu.edu closed by foreign host. why?

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.

403 Reminder % touch bar.txt % chmod 000 bar.txt % telnet www.cs.odu.edu 80 Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s12/restrict/bar.txt HTTP/1.1 Host: www.cs.odu.edu Authorization: Basic bWxuOm1sbg== HTTP/1.1 403 Forbidden Date: Mon, 12 Mar 2012 22:56:15 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.5 mod_ssl/2.2.17 OpenSSL/0.9.8q Content-Type: text/html; charset=iso-8859-1 Connection to xenon.cs.odu.edu closed by foreign host.