[sudo] apt-get install stunnel
cd path/to/django/project
mkdir stunnel
cd stunnel
Create the key:
openssl genrsa 1024 > stunnel.key
openssl req -new -x509 -nodes -sha1 -days 365 -key stunnel.key > stunnel.cert
cat stunnel.key stunnel.cert > stunnel.pem
Create the dev_https
file with:
pid=
cert = stunnel/stunnel.pem
foreground = yes
output = stunnel.log
[https]
accept=8443
connect=8000
TIMEOUTclose=1
Now go to project root and create a runserver
file:
stunnel4 stunnel/dev_https &
python manage.py runserver&
Sets the permission:
chmod a+x runserver
The SSL works in:
https://localhost:8443
$ ll /usr/bin/stunnel
lrwxrwxrwx 1 root root 8 Sep 7 2017 /usr/bin/stunnel -> stunnel4*
$ stunnel -version
stunnel 5.30 on x86_64-pc-linux-gnu platform
Compiled/running with OpenSSL 1.0.2g 1 Mar 2016
Threading:PTHREAD Sockets:POLL,IPv6,SYSTEMD TLS:ENGINE,FIPS,OCSP,PSK,SNI Auth:LIBWRAP
Global options:
debug = daemon.notice
pid = /var/run/stunnel4.pid
RNDbytes = 64
RNDfile = /dev/urandom
RNDoverwrite = yes
Service-level options:
ciphers = FIPS (with "fips = yes")
ciphers = HIGH:+3DES:+DH:!aNULL:!SSLv2 (with "fips = no")
curve = prime256v1
debug = notice
logId = sequential
options = NO_SSLv2
options = NO_SSLv3
sessionCacheSize = 1000
sessionCacheTimeout = 300 seconds
stack = 65536 bytes
TIMEOUTbusy = 300 seconds
TIMEOUTclose = 60 seconds
TIMEOUTconnect = 10 seconds
TIMEOUTidle = 43200 seconds
verify = none