Closed (fixed)
Project:
Secure Login
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Dec 2012 at 01:33 UTC
Updated:
27 Jan 2013 at 22:20 UTC
My goal is to secure the login screen and any subsequent traffic by logged-in users to avoid session hijacking. However, we want to serve all anonymous traffic over HTTP for now.
I think I can accomplish this with the Secure Login module and a few .htaccess lines. Here's what I'm currently testing.
# Redirect SSL requests to non-SSL except when:
# A secure cookie is present with "SSESS." (User is probably logged in.)
# Requesting a file like images or CSS. Users can still request over SSL.
# Requesting a JavaScript file. Admin Menu breaks without this line.
# Requesting a URL starting with "/user." (User is trying to log in.)
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_COOKIE} !^.*SSESS.*$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^.*js/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/user.*$ [NC]
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R]Can someone look over this code and let me know:
P.S. We will go all-SSL eventually, but right now I'm just quickly trying to secure the login form and pass a PCI scan.
Comments
Comment #1
mfbI didn't test your configuration, but one thing I would say in general about redirects is do not unintentionally redirect POST requests. Browsers do not resubmit post data if a POST request is redirected, they make a GET request instead.
Comment #2
jtherkel commentedGood point, mfb. The POST could be an issue if we placed the login block on insecure pages, but we don't do that on our site. After a day of testing, this seems to be working as desired, but others might find issues with the code. (If so, please reply here!)
Comment #3
mfbSounds like this solution is working so I'm setting this issue to fixed.
Comment #4.0
(not verified) commentedMade session cookie condition less restrictive.