{"id":188106,"date":"2013-07-31T09:53:03","date_gmt":"2013-07-31T05:53:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=188106"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=188106","title":{"rendered":"<span class=\"post_title\">Django development server \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HTTPS<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e,<\/p>\n<p>  \u0412\u044b\u0431\u0440\u0430\u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Django \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e <a href=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_Secure\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 HTTPS<\/a> \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/security\/#ssl-https\">\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443<\/a> \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 Django, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e HTTPS.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/install\/#install-apache-and-mod-wsgi\">Apache<\/a>) \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0443\u0434\u043e\u0431\u0441\u0442\u0432 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 Django?<\/p>\n<p>  \u041f\u043e\u0438\u0441\u043a \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u00abdjango + https\u00bb \u0432\u044b\u0434\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0434\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 <a href=\"http:\/\/www.ianlewis.org\/en\/testing-https-djangos-development-server\">2009<\/a> \u0438 <a href=\"https:\/\/blog.isotoma.com\/2012\/07\/running-a-django-dev-instance-over-https\/\">2012<\/a> \u0433\u043e\u0434\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f HTTPS \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.stunnel.org\">stunnel<\/a>. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <code>stunnel<\/code> \u043f\u043e\u0434 \u0441\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Django \u043d\u0430 Ubuntu 12.04.1 LTS x64. <br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u0430<\/h4>\n<p>  <\/p>\n<ul>\n<li>Ubuntu 12.04.1 LTS (x64)<\/li>\n<li>OpenSSL 1.0.1 14 Mar 2012<\/li>\n<li>Python 2.7.3<\/li>\n<li>virtualenv 1.8.4<\/li>\n<li>Django 1.5.1<\/li>\n<\/ul>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 stunnel<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <code>stunnel<\/code> (\u0432\u0435\u0440\u0441\u0438\u0438 4.\u0445, \u0432\u0435\u0442\u043a\u0430 3.\u0445 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f):<\/p>\n<pre><code class=\"bash\">$ sudo apt-get install stunnel4<\/code><\/pre>\n<p>  \u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <code>stunnel<\/code> \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>\/etc\/default\/stunnel4<\/code>:<\/p>\n<pre><code># \/etc\/default\/stunnel # Julien LEMOINE &lt;speedblue@debian.org&gt; # September 2003  # Change to one to enable stunnel automatic startup ENABLED=0 # Configuration file loacation mask FILES=&quot;\/etc\/stunnel\/*.conf&quot; \t OPTIONS=&quot;&quot;  # Change to one to enable ppp restart scripts PPP_RESTART=0<\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a <code>stunnel<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c Django \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 X.509.<\/p>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430<\/h4>\n<p>  \u0412 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 stunnel \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0443:  <\/p>\n<blockquote><p>\u2026. Each SSL enabled daemon needs to present a valid X.509 certificate to the peer. It also needs a private key to decrypt the incoming data. The easiest way to obtain a certificate and a key is to generate them with the free OpenSSL package \u2026<\/p>\n<p>  \u2026 The order of contents of the .pem file is important. It should contain the unencrypted private key first, then a signed certificate (not certificate request). There should be also empty lines after certificate and private key. Plaintext certificate information appended on the top of generated certificate should be discarded. So the file should look like this:<\/p>\n<p>  &#8212;&#8212;BEGIN RSA PRIVATE KEY&#8212;&#8212;<br \/>  [encoded key]<br \/>  &#8212;&#8212;END RSA PRIVATE KEY&#8212;&#8212;<br \/>  [empty line]<br \/>  &#8212;&#8212;BEGIN CERTIFICATE&#8212;&#8212;<br \/>  [encoded certificate]<br \/>  &#8212;&#8212;END CERTIFICATE&#8212;&#8212;<br \/>  [empty line]<\/p><\/blockquote>\n<p>  \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f OpenSSL (\u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 Ubuntu 12.04.1):<\/p>\n<pre><code class=\"bash\">$ cd ~ $ openssl genrsa -out private.key $ openssl req -new -x509 -key private.key -out stunnel.cert -days 365<\/code><\/pre>\n<p>  <i>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435 (<a href=\"http:\/\/countrycode.org\/\">\u043a\u043e\u0434\u044b \u0441\u0442\u0440\u0430\u043d<\/a> \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430).<\/i><\/p>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 <code>private.key<\/code> \u0438 <code>stunnel.cert<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<pre><code class=\"bash\">$ (cat private.key ; echo ; cat stunnel.cert ; echo) &gt; stunnel.pem<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u044f.<\/p>\n<h4>\u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h4>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <code>stunnel.conf-sample<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>\/usr\/share\/doc\/stunnel4\/examples\/<\/code>, \u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <code>man stunel4<\/code> \u0438\u043b\u0438 \u0432 <a href=\"https:\/\/www.stunnel.org\/static\/stunnel.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u041f\u043b\u044e\u0441 \u043a\u043e \u0432\u0441\u0435\u043c\u0443, \u0440\u0430\u0437\u0434\u0435\u043b <a href=\"https:\/\/www.stunnel.org\/faq.html\">FAQ<\/a> \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435:<\/p>\n<pre><code class=\"bash\">$ cd ~ $ vim stunnel.conf<\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u044f \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435:<\/p>\n<pre><code>; Certificate & Key cert = .\/stunnel.pem ; Use SSL version 3, which is more secure sslVersion = SSLv3 ; If next argument is empty, then no pid file will be created pid = ; if 'yes' stay in foreground (don't fork) and log to stderr instead of via syslog foreground = no  ; Performance tweak from FAQ (https:\/\/www.stunnel.org\/faq.html) socket = l:TCP_NODELAY=1 socket = r:TCP_NODELAY=1  ; Enable compression compression = zlib  ; Debugging - emerg (0), alert (1), crit (2), err (3), warning (4), notice (5), info (6), or debug (7) debug = 7 output = \/var\/log\/stunnel4\/stunnel.log  ; HTTPS service section [https] ; Port to listen incoming client connections accept = 8443 ; Port which Django development server listens to connect = 8000 ; Tweak for MSIE (see FAQ or manual) TIMEOUTclose = 0<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c?<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c <code>stunnel<\/code> \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Django \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <code>django-admin.py startproject<\/code>):<\/p>\n<pre><code class=\"bash\">$ cd ~ $ stunnel4 stunnel.conf $ source django\/bin\/activate (django)$ cd django\/projects (django)$ django-admin.py startproject testone (django)$ cd testone\/ (djanho)$ HTTPS=on python manage.py runserver<\/code><\/pre>\n<p>  <em>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f HTTPS=on \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 HTTPS \u0432 Django, \u0431\u0435\u0437 \u043d\u0435\u0435 \u043c\u0435\u0442\u043e\u0434 request.is_secure() \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c False.<\/em><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u00ab\u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435\u00bb \u043f\u043e\u0440\u0442\u044b:  <\/p>\n<pre><code class=\"bash\">$ netstat \u2013an<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address           Foreign Address         State ... tcp        0      0 0.0.0.0:8443            0.0.0.0:*               LISTEN tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN ...<\/code><\/pre>\n<p>  \u0422\u0443\u043d\u043d\u0435\u043b\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u2014 <code>stunnel<\/code> \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u043f\u043e\u0440\u0442 8443, \u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8000.<\/p>\n<p>  \u0414\u043b\u044f \u00ab\u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f\u00bb \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>killall<\/code>:<\/p>\n<pre><code class=\"bash\">$ ps -e | grep stunnel4<\/code><\/pre>\n<p>  <\/p>\n<pre><code>12530 pts\/1 00:00:00 stunnel4 12531 pts\/1 00:00:00 stunnel4 12532 pts\/1 00:00:00 stunnel4 12533 pts\/1 00:00:00 stunnel4 12534 pts\/1 00:00:00 stunnel4 12535 ? 00:00:00 stunnel4<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\">$ killall stunnel4<\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043b\u044e\u0431\u043e\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 URL, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>https:\/\/<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>http:\/\/<\/code>. \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0435, \u0442.\u043a. \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043e\u043d \u0431\u044b\u043b \u043d\u0430\u043c\u0438 \u043b\u0438\u0447\u043d\u043e, \u0430 \u043d\u0435 \u0430\u043a\u043a\u0440\u0435\u0434\u0438\u0442\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0446\u0435\u043d\u0442\u0440\u043e\u043c (Certificate Authority). \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 HTTPS.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/7a8\/863\/1ab\/7a88631abe386c890e618019342f1d62.png\"\/><br \/>  <i>\u0411\u044b\u043b\u043e<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/848\/fe1\/fc9\/848fe1fc973cb0a41ac442dd5bf5f666.png\"\/><br \/>  <i>\u0421\u0442\u0430\u043b\u043e<\/i><\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Django \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c HTTPS \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440. <\/p>\n<p>  \u0425\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <code>stunnel<\/code> \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f <a href=\"https:\/\/www.stunnel.org\/downloads\/stunnel-4.56-installer.exe\">Windows <\/a>\u0438 <a href=\"https:\/\/www.stunnel.org\/downloads\/stunnel-4.56-android.zip\">Android<\/a>, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0430 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445.<\/p>\n<p>  \u0412\u0441\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. <\/p>\n<p>  \u041f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e \u0442\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<h5>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h5>\n<p>  + \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430;<br \/>  + \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Django \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432;<br \/>  + \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0439\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<h5>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h5>\n<p>   \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 HTTPS;<br \/>   \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e;<br \/>   \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Django \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0441\u043c. \u043b\u043e\u0433\u0438 \u043d\u0438\u0436\u0435).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u043e\u0433\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">Validating models\u2026<\/p>\n<p>  0 errors found<br \/>  July 26, 2013 \u2014 10:06:33<br \/>  Django version 1.5.1, using settings &#8216;testone.settings&#8217;<br \/>  Development server is running at <a href=\"http:\/\/127.0.0.1\">127.0.0.1<\/a>:8000\/<br \/>  Quit the server with CONTROL-C.<br \/>  \u2026<br \/>  [26\/Jul\/2013 10:07:25] \u00abGET \/ HTTP\/1.1\u00bb 200 1955<br \/>  [26\/Jul\/2013 10:07:30] \u00abGET \/ HTTP\/1.1\u00bb 200 1955<br \/>  \u2026  <\/div>\n<\/div>\n<h4>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h4>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/security\/\">Security in Django<\/a><\/li>\n<li><a href=\"http:\/\/www.ianlewis.org\/en\/testing-https-djangos-development-server\">Testing HTTPS with Django&#8217;s Development Server<\/a><\/li>\n<li><a href=\"https:\/\/www.stunnel.org\/static\/stunnel.html\">stunnel manual<\/a><\/li>\n<li><a href=\"https:\/\/blog.isotoma.com\/2012\/07\/running-a-django-dev-instance-over-https\/\">Running a Django (or any other) dev instance over HTTPS<\/a><\/li>\n<li><a href=\"http:\/\/blog.trebacz.com\/2012\/03\/installing-stunnel-to-enable-ssl.html\">Installing Stunnel to Enable SSL Connections in Pan Newsreader<\/a><\/li>\n<\/ol>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/188106\/\"> http:\/\/habrahabr.ru\/post\/188106\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e,<\/p>\n<p>  \u0412\u044b\u0431\u0440\u0430\u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Django \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e <a href=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_Secure\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 HTTPS<\/a> \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/security\/#ssl-https\">\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443<\/a> \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 Django, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e HTTPS.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/docs.djangoproject.com\/en\/1.5\/topics\/install\/#install-apache-and-mod-wsgi\">Apache<\/a>) \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0443\u0434\u043e\u0431\u0441\u0442\u0432 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 Django?<\/p>\n<p>  \u041f\u043e\u0438\u0441\u043a \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u00abdjango + https\u00bb \u0432\u044b\u0434\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0434\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 <a href=\"http:\/\/www.ianlewis.org\/en\/testing-https-djangos-development-server\">2009<\/a> \u0438 <a href=\"https:\/\/blog.isotoma.com\/2012\/07\/running-a-django-dev-instance-over-https\/\">2012<\/a> \u0433\u043e\u0434\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f HTTPS \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.stunnel.org\">stunnel<\/a>. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <code>stunnel<\/code> \u043f\u043e\u0434 \u0441\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Django \u043d\u0430 Ubuntu 12.04.1 LTS x64.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-188106","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188106"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/188106\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}