FreedomBox/.gitignore
Sunil Mohan Adapa fd345aca80
web_framework: Generate and retain a secret key
- Secret is important for various functions of Django. There is no impact on
existing installations due to the change. Improves the security of existing
functions in minor ways and will be useful in future usage of Django.

- Create the file in /var/lib/plinth/ with 0o600 permissions.

- Make git ignore the file in code folder.

- Don't copy the file during './setup.py install' operation.

Impact to users after upgrade:

- All existing sessions will get logged out. This is because SECRET_KEY is used
to generate user session hash that is used to logout users when their password
changes.

Tests performed:

- Run development version of service. File should get created in
data/var/lib/plinth/django-secret.key. Permissions should be 0o600.

- Run again, the file should not be overwritten. Printing
django.conf.settings.SECRET_KEY should match the one in the file.

- Run `setup.py install`. This should not install django-secret.key in
/var/lib/plinth.

- Run `sudo -u plinth plinth`. This should create the secret key file in
/var/lib/plinth/django-secret.key. Permissions on the file should be 0o600.
Ownership should be plinth:plinth.

- Remove the file in both cases, a fresh new file should get created with new key.

- Truncate the file to less than 128 chars, the existing file should get
overwritten with new key.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-24 18:04:20 -05:00

55 lines
945 B
Plaintext

*.pyc
*.py.bak
*.tiny.css
data/var/log/plinth/*.log
data/var/lib/plinth/django-secret.key
data/var/lib/plinth/*.sqlite3
data/var/lib/plinth/sessions/*
data/var/lib/plinth/.ssh/
data/var/run/*.pid
doc/manual/*/*.pdf
doc/manual/*/*.html
doc/manual/*/*.xml
!doc/manual/*/*.raw.xml
doc/plinth.1
doc/dev/_build
\#*
.#*
*~
predepend
build/
*.egg-info/
dist/
.coverage
plinth/tests/config_local.py
htmlcov/
functional_tests.test_plinth/
functional_tests/test_plinth/
geckodriver.log
*.mo
.vagrant/
.DS_Store
*.box
.eggs
.pybuild/
debian/.debhelper/
debian/debhelper-build-stamp
debian/files
debian/freedombox.debhelper.log
debian/freedombox.postinst.debhelper
debian/freedombox.postrm.debhelper
debian/freedombox.preinst.debhelper
debian/freedombox.prerm.debhelper
debian/freedombox.substvars
debian/freedombox/
debian/plinth.debhelper.log
debian/plinth.substvars
debian/plinth/
*.pytest_cache/
# Editor settings
.vscode/
.idea/
*.swp
.emacs.desktop*