Re: [web2py] Re: Improving SSL Support

2012-10-04 Thread Yarin Kessler
Awesome thanks Massimo- will test tonight On Thu, Oct 4, 2012 at 4:13 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > OK. check trunk. Auth(db,secure=True). > > > On Thursday, 4 October 2012 13:01:51 UTC-5, Yarin wrote: >> >> Yes exactly >> >> On Thursday, October 4, 2012 12:38:34 PM

[web2py] Re: Improving SSL Support

2012-10-04 Thread Massimo Di Pierro
OK. check trunk. Auth(db,secure=True). On Thursday, 4 October 2012 13:01:51 UTC-5, Yarin wrote: > > Yes exactly > > On Thursday, October 4, 2012 12:38:34 PM UTC-4, Massimo Di Pierro wrote: >> >> So... would replaing this in gluon.main.py >> >> is_https = env.wsgi_url_scheme in ['https', 'HTTPS']

[web2py] Re: Improving SSL Support

2012-10-04 Thread Yarin
Yes exactly On Thursday, October 4, 2012 12:38:34 PM UTC-4, Massimo Di Pierro wrote: > > So... would replaing this in gluon.main.py > > is_https = env.wsgi_url_scheme in ['https', 'HTTPS'] or env.https=='on') > > with > > is_https = env.wsgi_url_scheme in ['https', 'HTTPS'] or env.https=='on' or

[web2py] Re: Improving SSL Support

2012-10-04 Thread Massimo Di Pierro
So... would replaing this in gluon.main.py is_https = env.wsgi_url_scheme in ['https', 'HTTPS'] or env.https=='on') with is_https = env.wsgi_url_scheme in ['https', 'HTTPS'] or env.https=='on' or request.env.http_x_forwarded_proto in ['https', 'HTTPS'] address the first issue? Massimo On T

[web2py] Re: Improving SSL Support

2012-10-04 Thread Yarin
I'm revising my stance on this. After further digging around, I'm gonna go with Niphlod's position that securing only the login traffic without securing the entire session is for the most part pretty worthless. While this might have value to some sites that have to deal with mixed content, the

[web2py] Re: Improving SSL Support

2012-09-21 Thread Yarin
Done http://code.google.com/p/web2py/issues/detail?id=1023 On Friday, September 21, 2012 2:05:41 PM UTC-4, Massimo Di Pierro wrote: > > Yarin, please open an issue on google code as suggested enhancement so ti > does not get lost. Also feel free to move the discussion on web2py > developers. > >

[web2py] Re: Improving SSL Support

2012-09-21 Thread Massimo Di Pierro
Yarin, please open an issue on google code as suggested enhancement so ti does not get lost. Also feel free to move the discussion on web2py developers. On Friday, 21 September 2012 12:22:57 UTC-5, Yarin wrote: > > Here's a complete example of our own implementation (simplified, untested) > us

[web2py] Re: Improving SSL Support

2012-09-21 Thread Yarin
Here's a complete example of our own implementation (simplified, untested) using the proposed auth settings: in our model: def force_https(trust_proxy = False, secure_session = False): """ Enforces HTTPS in appropriate environments Args: trust_proxy: Can we trust proxy header '

[web2py] Re: Improving SSL Support

2012-09-21 Thread Yarin
You can't detect this- it must be a setting. Please see my previous answer: https://groups.google.com/forum/#!msg/web2py/me1e5d6Dudk/VQRQhdiryccJ "you cannot detect whether proxied traffic is real because headers are unreliable. Instead you must securely set up a server behind a proxy and set th

[web2py] Re: Improving SSL Support

2012-09-21 Thread Massimo Di Pierro
Yes but how do you detect if is_proxied reliably? On Friday, 21 September 2012 10:28:26 UTC-5, Yarin wrote: > > FYI this is the enforcer function we wrote for our implementation- > basically a rewrite of request.requires_https(): > > def force_https(trust_proxy = False): > """ Enforces HTTPS in

[web2py] Re: Improving SSL Support

2012-09-21 Thread Yarin
FYI this is the enforcer function we wrote for our implementation- basically a rewrite of request.requires_https(): def force_https(trust_proxy = False): """ Enforces HTTPS in appropriate environments Args: trust_proxy: Can we trust proxy header 'http_x_forwarded_proto' to determine SSL

[web2py] Re: Improving SSL Support

2012-09-21 Thread Yarin
The completely naive approach would be to do: if request.env.http_x_forwarded_for and \ request.env.http_x_forwarded_proto in ['https', 'HTTPS']: # Is HTTPS... But you cannot detect whether proxied traffic is real because headers are unreliable. Instead it is up to the user to securely

[web2py] Re: Improving SSL Support

2012-09-21 Thread Massimo Di Pierro
Can you suggest a way to detect that? On Thursday, 20 September 2012 13:56:55 UTC-5, Yarin wrote: > > @Massimo - that'd be great. > > One more kink to throw in is recognizing proxied SSL calls. This requires > knowing whether you can trust the traffic headers (e.g. having apache > locked down t

[web2py] Re: Improving SSL Support

2012-09-20 Thread Niphlod
> > Wrong- this is a matter of protecting the user. I may have a site that > doesn't deal with anything important. Let's say it allows users to see > their friends' baby pictures. They need to login so that we know what > babies to show. Session gets hijacked? Big deal, you can see someone else

[web2py] Re: Improving SSL Support

2012-09-20 Thread Yarin
@Niphlod 1) "only valid point here is a sort of "netiquette" among web developers" Wrong- this is a matter of protecting the user. I may have a site that doesn't deal with anything important. Let's say it allows users to see their friends' baby pictures. They need to login so that we know what

[web2py] Re: Improving SSL Support

2012-09-20 Thread Yarin
@Massimo - that'd be great. One more kink to throw in is recognizing proxied SSL calls. This requires knowing whether you can trust the traffic headers (e.g. having apache locked down to all traffic except your load balancer), so maybe we need a trust_proxied_ssl or is_proxied setting somewher

[web2py] Re: Improving SSL Support

2012-09-20 Thread Niphlod
Well, this list is often used to discuss "good behaviours", so, let's brainstorm. > - Is a hijacked session the same as an exposed password? a hijacked > session compromises a single session on a single system, while a stolen > password constitutes a cross-session and (because passwords are r

[web2py] Re: Improving SSL Support

2012-09-20 Thread Massimo Di Pierro
I think we should do something like this. I think we should have auth.settings.force_ssl_login and auth.settings.force_ssl_login. We could add secure=True option to existing requires validators. This should not be enforced from localhost. On Thursday, 20 September 2012 09:07:14 UTC-5, Yarin

[web2py] Re: Improving SSL Support

2012-09-20 Thread Yarin
Was wrestling with these points myself... With respect to case-1 adding 0% security: - Is a hijacked session the same as an exposed password? a hijacked session compromises a single session on a single system, while a stolen password constitutes a cross-session and (because passwords are re-use

[web2py] Re: Improving SSL Support

2012-09-20 Thread Niphlod
ok, i got the point on having a hard time implementing case-1 with web2py. Please humour me, what I didn't got over those kind of requirements is basically...case-1 adds 0% security. If there is a man in the middle, he can "scoop" the cookie just as he would scoop the password in the case of