Skip to main content

Django app for forcing password rotation

Project description

Django password rotation app

This app provides configurable rotation of passwords.

Features

  • Configurable password duration and warning duration
  • Visual warning to user using Django messages
  • Prevents user from accessing any page in after expiration unless the password is changed
  • Forces the new password to be different from previously used passwords
  • Prevents similar passwords (ex: "password1", "password2", ...)

Requirements

This Django app requires Python >= 3.6 and has been tested with Django 4.2.

Installation

  1. pip install https://github.com/alexandriagroup/django-password-rotate/archive/refs/heads/main.zip.
  2. Add password_rotate to INSTALLED_APPS.
  3. Add 'password_rotate.middleware.PasswordRotateMiddleware' to MIDDLEWARE. It should be listed after authentication and session middlewares.
  4. Add password_rotate.validators.NotPreviousPasswordValidator to AUTH_PASSWORD_VALIDATORS:
AUTH_PASSWORD_VALIDATORS = [
...
{
    "NAME": "password_rotate.validators.NotPreviousPasswordValidator",
},
]
  1. Add the pattern in the urls of your project:
urlpatterns = [
    ...
    path("password_rotate/", include("password_rotate.urls")),
]
  1. Configure the app in your settings:
    # rotate passwords after 90 days
    PASSWORD_ROTATE_SECONDS = 90 * 24 * 60 * 60
    # start warning 10 days before expiration
    PASSWORD_ROTATE_WARN_SECONDS = 10 * 24 * 60 * 60
    # keep at most the 3 previous (encrypted) passwords
    PASSWORD_ROTATE_HISTORY_COUNT = 3
    # when changing the password, allow only a new password with similarity ratio greater than 50
    PASSWORD_ROTATE_MAX_SIMILARITY_RATIO = 50
    
  2. Run python manage.py migrate to create the required database tables.

If you want to exclude superusers from the password expiration, set this flag:

PASSWORD_ROTATE_EXCLUDE_SUPERUSERS = True

Acknowledgements

This app is a direct modification of:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_password_rotate-0.0.8.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_password_rotate-0.0.8-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file django_password_rotate-0.0.8.tar.gz.

File metadata

File hashes

Hashes for django_password_rotate-0.0.8.tar.gz
Algorithm Hash digest
SHA256 b9448b7c45be734535c559a6da5584f7a95bbc8be455bc5cd743b0e4bd3f9f3c
MD5 df64cf15890b8cb1fba34e9ae657d0de
BLAKE2b-256 b22852176d561bd25a9f12cb2e530fb8b92e2430e3415f8716e6df595c3acb99

See more details on using hashes here.

File details

Details for the file django_password_rotate-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for django_password_rotate-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4bb211050e083c508aed08e506fb744e0987705b47f1aa04572fa1030a2674ef
MD5 3297f04806971a5e07ddcc1d7c2f8d94
BLAKE2b-256 a788f91ad5298b481428a3c88043d29e0ce4415a444e7a084d544bb87f3d9c28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page