Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54358

Re: Simple security between prototype iPhone app and SimpleHTTPServer REST service?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; 'true,': 0.05; 'suppose': 0.07; 'correspond': 0.09; 'defines': 0.09; 'framework.': 0.09; 'http': 0.09; 'pointers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'replied': 0.09; 'sure)': 0.09; 'url:github': 0.09; 'warn': 0.09; 'python': 0.11; 'question.': 0.14; '"user': 0.16; "(it's": 0.16; 'enough?': 0.16; 'frameworks.': 0.16; 'https': 0.16; 'python;': 0.16; 'rarely': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'relates': 0.16; 'subject:between': 0.16; 'subject:security': 0.16; 'task.': 0.16; 'travis': 0.16; 'used).': 0.16; 'all,': 0.19; 'bit': 0.19; 'app': 0.19; "python's": 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'browsers': 0.24; 'ssl': 0.24; 'stick': 0.24; 'typical': 0.24; 'initial': 0.24; 'question': 0.24; 'sort': 0.25; 'task': 0.26; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'host': 0.29; 'appreciated.': 0.29; 'related': 0.29; "i'm": 0.30; 'keys': 0.31; 'piece': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'extend': 0.32; 'figure': 0.32; 'quite': 0.32; '(e.g.': 0.33; 'standards': 0.33; 'maybe': 0.34; 'basic': 0.35; 'common': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'passwords': 0.36; 'subject:Simple': 0.36; 'subject:service': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'should': 0.36; 'effort': 0.37; 'application': 0.37; 'so,': 0.37; 'two': 0.37; 'implement': 0.38; 'server': 0.38; 'depends': 0.38; 'e.g.': 0.38; 'tasks': 0.38; 'to:addr:python- list': 0.38; 'does': 0.39; 'embedded': 0.39; 'itself': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'how': 0.40; 'future': 0.60; 'simple,': 0.60; 'monitoring': 0.61; 'mentioned': 0.61; 'simple': 0.61; 'further': 0.61; 'you.': 0.62; 'received:217': 0.63; 'name': 0.63; 'kind': 0.63; 'personal': 0.63; 'therefore,': 0.64; 'provide': 0.64; 'more': 0.64; '(that': 0.65; 'iphone': 0.65; 'wall': 0.65; 'services': 0.66; 'determine': 0.67; 'services.': 0.70; 'secure': 0.71; 'records': 0.73; '"you")': 0.84; 'alone.': 0.84; 'replay': 0.84; 'subject:iPhone': 0.84; 'subject:skip:S 10': 0.84; 'encrypted': 0.91; 'prone': 0.91; 'imagine': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: Simple security between prototype iPhone app and SimpleHTTPServer REST service?
Date Wed, 18 Sep 2013 08:49:44 +0200
References <23487B84-131D-4685-81AB-EC62C8DBAC6D@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e0a4f3.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:6jQm14buAykGoPFib4u1zIfVTOw=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.104.1379486996.18130.python-list@python.org> (permalink)
Lines 70
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1379486996 news.xs4all.nl 15984 [2001:888:2000:d::a6]:58067
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:54358

Show key headers only | View raw


Travis Griggs <travisgriggs@gmail.com> writes:

> ...
> I found a example of how to add SSL to my python service (https://gist.github.com/ubershmekel/6194556). If I can figure out how to get the right keys embedded into my iPhone app (it's just on my phone, not anyone else's), is that enough? Or should I include some sort of auth? If so, what kind? And any pointers to how to start that would be much appreciated.

This is less a Python question. What kind of authentication you
need heavily depends on which data your HTTP server publishes.
You need no authentication at all, if anyone can see this data.

There are many standards related to HTTP authentication.
Using a standard has the advantage that common components
(e.g. the browser) may have support for it.
HTTP itself defines two authentication standards - both based
an a simple "login/password" scheme: "basic" (very simple, but
prone to replay and monitoring attacks) and "digest" (more
secure but rarely used).

There is also HTTPS (that is HTTP over SSL). This is HTTP over an
encrypted communication channel. As the data transmitted
is encrypted, monitoring and replay attacks get far more difficult.
Used this way, HTTP basic authentication gets much more secure.

HTTPS is typically also used for server identification (typical
browsers warn you, if it does not trust the (HTTPS) server certificate
or the host name inside the certificate does not correspond to the
host you try to contact).
However, HTTPS can also be used with client certificates; this
usage may be an alternative to HTTP authentication.

There are a lot of further standards related to authentication:
e.g. "OpenId", "SAML2", "OpenAuth", ...


> Some have blithely replied that I should be using Flask or Tornado. I get that I'm going to hit a wall with HTTPServer and that it's more of a "toy" implementation.

This may be the part of your question which relates to Python; more
precisely to "HTTPServer". I do not have an authoritative answer for
you. I suppose (!; I am not sure) that "HTTPServer" will somehow
support basic authentication and maybe HTTPS, however, it
may not support it alone.

For "basic" authentication, you need some kind of user "database"
which records the known users with their passwords and maybe
the services those users may use.
By itself "HTTPS" does not provide (client) authentication;
for client authentication, you need again some kind of
user "database" to determine which clients (identified by the
client certificate) you want to grant any and which services.

This user "database" may be quite simple (maybe, it contains just "you") -
but Python's "HTTPServer" cannot know - and does not provide
this piece of infrastructure. You must extend Python's
"HTTPServer" to provide it.

Authentication support is a fundamental task for web frameworks.
Therefore, they contain infrastructure to facilitate this task.
This include "modules" for the implementation of the "user database"
mentioned above.


My personal recommendation: if this is the only web application
you plan to implement, you may stick with "HTTPServer".
However, if you can imagine that in the future you
will implement further web applications, then look for a
web framework. True, you will have to learn quite a bit -
but you get components that facilitate typical tasks related
to web applications (e.g. authentication).
This initial learning effort may amortise when you plan
to implement more web applications in the future.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Simple security between prototype iPhone app and SimpleHTTPServer REST service? dieter <dieter@handshake.de> - 2013-09-18 08:49 +0200

csiph-web